diff --git a/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx b/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx index a0e24d9dcba..7d4222a57cf 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx @@ -20,6 +20,7 @@ #include "Common/DataModel/Centrality.h" #include "Common/DataModel/CollisionAssociationTables.h" #include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/PIDResponseTOF.h" #include "Common/DataModel/PIDResponseTPC.h" #include "Common/DataModel/TrackSelectionTables.h" @@ -41,13 +42,15 @@ #include #include +#include +#include #include #include #include -#include #include #include +#include #include #include #include @@ -221,18 +224,14 @@ enum CollisionLabels { kPassSelCol }; -enum TrackLabels { - kTracksBeforeHasMcParticle = 1, +enum LambdaLabels { + kLambdaBeforeHasMcParticle = 1, kAllV0Tracks, kPassV0KinCuts, kPassV0TopoSel, kPassK0ShortMassRej, kPassV0DauTrackSel, kAllSelPassed, - kEffCorrPtCent, - kEffCorrPtRapCent, - kMatchEffCorr, - kNoEffCorr, kGenTotAccLambda, kGenLambdaNoDau, }; @@ -246,6 +245,11 @@ enum KaonLabels { kKaonPassAllSel }; +enum EffCorrType { + kEffCorrPtCent = 0, + kEffCorrPtRapCent +}; + enum CentEstType { kCentFT0M = 0, kCentFT0C @@ -283,12 +287,6 @@ enum DMCType { kMC }; -enum CorrHistDim { - OneDimCorr = 1, - TwoDimCorr, - ThreeDimCorr -}; - struct LambdaTableProducer { // Table Producers Produces lambdaCollisionTable; @@ -303,7 +301,7 @@ struct LambdaTableProducer { // Collisions Configurable cCentEstimator{"cCentEstimator", 1, "Centrality Estimator : 0-FT0M, 1-FT0C"}; - Configurable cZVtxCut{"cZVtxCut", 10.0, "ZVtx cut"}; + Configurable cZVtxCut{"cZVtxCut", 10.0, "Z-Vtx cut"}; Configurable cSel8Trig{"cSel8Trig", true, "Sel8 (T0A + T0C) Selection Run3"}; Configurable cPileupReject{"cPileupReject", true, "Pileup rejection"}; Configurable cZVtxTimeDiff{"cZVtxTimeDiff", true, "z-vtx time diff selection"}; @@ -318,17 +316,17 @@ struct LambdaTableProducer { // Kaon Tracks Configurable cKaonMinPt{"cKaonMinPt", 0.3, "Kaon Min pT"}; - Configurable cKaonMaxPt{"cKaonMaxPt", 2.3, "Kaon Max pT"}; + Configurable cKaonMaxPt{"cKaonMaxPt", 2.4, "Kaon Max pT"}; Configurable cKaonRapCut{"cKaonRapCut", 0.5, "Kaon |y| cut"}; Configurable cKaonGlobalSel{"cKaonGlobalSel", true, "Global Track"}; Configurable cKaonDcaXYCut{"cKaonDcaXYCut", 0.1, "DcaXY Cut"}; - Configurable cKaonDcaZCut{"cKaonDcaZCut", 1., "DcaXY Cut"}; + Configurable cKaonDcaZCut{"cKaonDcaZCut", 1., "DcaZ Cut"}; Configurable cTpcElRejCutMin{"cTpcElRejCutMin", -3., "Electron Rejection Cut Minimum"}; Configurable cTpcElRejCutMax{"cTpcElRejCutMax", 5., "Electron Rejection Cut Maximum"}; Configurable cKaonTpcNSigmaCut{"cKaonTpcNSigmaCut", 2, "TPC Kaon NSigma Cut"}; - Configurable cTpcRejCut{"cTpcRejCut", 2, "TPC Rej Cut"}; + Configurable cTpcRejCut{"cTpcRejCut", 3, "TPC Rej Cut"}; Configurable cKaonTofNSigmaCut{"cKaonTofNSigmaCut", 2, "TOF Kaon NSigma Cut"}; - Configurable cTofRejCut{"cTofRejCut", 2, "TOF Rej Cut"}; + Configurable cTofRejCut{"cTofRejCut", 3, "TOF Rej Cut"}; Configurable cKaonTpcPtSel{"cKaonTpcPtSel", 0.7, "Kaon TPC pT cutoff"}; // V0s @@ -347,15 +345,14 @@ struct LambdaTableProducer { // V0s acceptance Configurable cLambdaMassWindow{"cLambdaMassWindow", 0.007, "Lambda Mass Window"}; - Configurable cLambdaMinPt{"cLambdaMinPt", 0.7, "Minimum Lambda pT"}; - Configurable cLambdaMaxPt{"cLambdaMaxPt", 3.7, "Minimum Lambda pT"}; + Configurable cLambdaMinPt{"cLambdaMinPt", 0.8, "Minimum Lambda pT"}; + Configurable cLambdaMaxPt{"cLambdaMaxPt", 3.8, "Maximum Lambda pT"}; Configurable cLambdaRapCut{"cLambdaRapCut", 0.5, "Lambda |rap| cut"}; Configurable cV0TypeSelection{"cV0TypeSelection", 1, "V0 Type Selection"}; // Efficiency Correction Configurable cGetCorrectionFlag{"cGetCorrectionFlag", false, "Apply correction flag"}; Configurable cGetEffFact{"cGetEffFact", false, "Get Efficiency Factor Flag"}; - Configurable cGetMatchEff{"cGetMatchEff", false, "Get Matching Efficiency Flag"}; Configurable cCorrFactHist{"cCorrFactHist", 0, "Efficiency Factor Histogram"}; // MC @@ -365,7 +362,6 @@ struct LambdaTableProducer { // CCDB Configurable cUrlCCDB{"cUrlCCDB", "http://alice-ccdb.cern.ch", "ALICE CCDB URL"}; Configurable cPathCCDBRecoEff{"cPathCCDBRecoEff", "Users/y/ypatley/LBF/PP/RecoEfficiency", "Path for ccdb-object for reco efficiency"}; - Configurable cPathCCDBMatchEff{"cPathCCDBMatchEff", "Users/y/ypatley/LBF/PP/MatchEfficiency", "Path for ccdb-object for matching efficiency"}; Configurable nolaterthan{"nolaterthan", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; // Initialize CCDB Service @@ -375,9 +371,14 @@ struct LambdaTableProducer { // Histogram Registry. HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; - // initialize corr_factor objects - std::vector> vCorrFactStrings = {{"hEffVsPtCentLambda", "hEffVsPtCentAntiLambda", "hEffVsPtCentKaonPlus", "hEffVsPtCentKaonMinus"}, - {"hEffVsPtYCentLambda", "hEffVsPtYCentAntiLambda", "hEffVsPtYCentKaonPlus", "hEffVsPtYCentKaonMinus"}}; + // Initialize corr_factor objects + std::vector> vCorrFactStrings = {{"hEffVsPtCentLambda", "hEffVsPtCentAntiLambda", "hEffVsPtCentKaonPlus", "hEffVsPtCentKaonMinus"}, {"hEffVsPtYCentLambda", "hEffVsPtYCentAntiLambda", "hEffVsPtYCentKaonPlus", "hEffVsPtYCentKaonMinus"}}; + + // Store correction histograms + struct CorrHist { + std::array vPtCentCorrHists{}; + std::array vPtRapCentCorrHists{}; + } corrHist; // Initialize Global Variables float cent = 0.; @@ -387,19 +388,10 @@ struct LambdaTableProducer { void init(InitContext const&) { - // Set CCDB url - ccdb->setURL(cUrlCCDB.value); - ccdb->setCaching(true); - ccdb->setLocalObjectValidityChecking(); - ccdb->setCreatedNotAfter(nolaterthan.value); - - // Get CCDB object - ccdbObjRecoEff = ccdb->getForTimeStamp(cPathCCDBRecoEff.value, nolaterthan.value); - ccdbObjMatchEff = ccdb->getForTimeStamp(cPathCCDBMatchEff.value, nolaterthan.value); - // initialize axis specifications const AxisSpec axisCols(5, 0.5, 5.5, ""); - const AxisSpec axisTrks(30, 0.5, 30.5, ""); + const AxisSpec axisTrks(15, 0.5, 15.5, ""); + const AxisSpec axisEffChecks(3, 0, 3, ""); const AxisSpec axisCent(100, 0, 100, "Centrality(%)"); const AxisSpec axisVarCent(cCentBins, "FT0C%"); const AxisSpec axisMult(10, 0, 10, "N_{#Lambda}"); @@ -436,15 +428,14 @@ struct LambdaTableProducer { // Event histograms histos.add("Events/h1f_collisions_info", "# of Collisions", kTH1F, {axisCols}); histos.add("Events/h1f_collision_posZ", "V_{z}-distribution", kTH1F, {axisVz}); + histos.add("Events/h1f_collision_cent", "Centrality distribution", kTH1F, {axisCent}); // QA - histos.add("Tracks/h1f_tracks_info", "# of tracks", kTH1F, {axisTrks}); - histos.add("Tracks/h1f_kaon_sel", "Kaon selection", kTH1F, {axisTrks}); + histos.add("Tracks/h1f_lambda_info", "Lambda selection info", kTH1F, {axisTrks}); + histos.add("Tracks/h1f_kaon_info", "Kaon selection info", kTH1F, {axisTrks}); + histos.add("Tracks/h1f_effcorr_info", "Efficiency correction info", kTH1F, {axisEffChecks}); histos.add("Tracks/h2f_armpod_before_sel", "Armentros-Podolanski Plot", kTH2F, {axisAlpha, axisQtarm}); histos.add("Tracks/h2f_armpod_after_sel", "Armentros-Podolanski Plot", kTH2F, {axisAlpha, axisQtarm}); - histos.add("Tracks/h2f_itstrack_centpt", "h2f_itstrack_centpt", kTH2F, {axisVarCent, axisITSTPCTrackPt}); - histos.add("Tracks/h2f_itstpctrack_centpt", "h2f_itstpctrack_centpt", kTH2F, {axisVarCent, axisITSTPCTrackPt}); - histos.add("Tracks/h2f_itstpctoftrack_centpt", "h2f_itstpctoftrack_centpt", kTH2F, {axisVarCent, axisITSTPCTrackPt}); // QA Lambda histos.add("QA/Lambda/h3f_centmasspt", "Invariant Mass", kTH3F, {axisCent, axisV0Pt, axisV0Mass}); @@ -466,8 +457,8 @@ struct LambdaTableProducer { histos.add("QA/Lambda/h2f_neg_prong_tpc_nsigma_pi_vs_p", "TPC n#sigma Neg Prong", kTH2F, {axisMomPID, axisTrackNsigma}); // Dca analysis histogram - histos.add("QA/Lambda/DCA/h2f_Dca_vs_pT", "DCA vs pT", kTH2F, {axisV0Pt, axisDcaLambda}); - histos.add("QA/KaonPlus/DCA/h2f_Dca_vs_pT", "DCA vs pT", kTH2F, {axisV0Pt, axisDcaKaon}); + histos.add("QA/Lambda/DCA/h3f_Dca_vs_pT_cent", "DCA", kTH3F, {axisCent, axisV0Pt, axisDcaLambda}); + histos.add("QA/KaonPlus/DCA/h3f_Dca_vs_pT_cent", "DCA", kTH3F, {axisCent, axisV0Pt, axisDcaKaon}); // QA Kaons histos.add("QA/KaonPlus/hdEdX", "dE/dx vs pT", kTH2F, {axisMomPID, axisTrackdEdx}); @@ -478,12 +469,12 @@ struct LambdaTableProducer { // MC Generated Histograms if (doprocessMCRecoGen || doprocessMCReco) { // DCA analysis - histos.add("QA/Lambda/DCA/h2f_Prm_Dca_vs_pT", "Primary DCA vs pT", kTH2F, {axisV0Pt, axisDcaLambda}); - histos.add("QA/Lambda/DCA/h2f_Scd_Dca_vs_pT", "Weak Decay DCA vs pT", kTH2F, {axisV0Pt, axisDcaLambda}); - histos.add("QA/Lambda/DCA/h2f_Mat_Dca_vs_pT", "Material DCA vs pT", kTH2F, {axisV0Pt, axisDcaLambda}); - histos.add("QA/KaonPlus/DCA/h2f_Prm_Dca_vs_pT", "Primary DCA vs pT", kTH2F, {axisV0Pt, axisDcaKaon}); - histos.add("QA/KaonPlus/DCA/h2f_Scd_Dca_vs_pT", "Weak Decay DCA vs pT", kTH2F, {axisV0Pt, axisDcaKaon}); - histos.add("QA/KaonPlus/DCA/h2f_Mat_Dca_vs_pT", "Material DCA vs pT", kTH2F, {axisV0Pt, axisDcaKaon}); + histos.add("QA/Lambda/DCA/h3f_Prm_Dca_vs_pT_cent", "Primary DCA", kTH3F, {axisCent, axisV0Pt, axisDcaLambda}); + histos.add("QA/Lambda/DCA/h3f_Scd_Dca_vs_pT_cent", "Weak Decay DCA", kTH3F, {axisCent, axisV0Pt, axisDcaLambda}); + histos.add("QA/Lambda/DCA/h3f_Mat_Dca_vs_pT_cent", "Material DCA", kTH3F, {axisCent, axisV0Pt, axisDcaLambda}); + histos.add("QA/KaonPlus/DCA/h3f_Prm_Dca_vs_pT_cent", "Primary DCA", kTH3F, {axisCent, axisV0Pt, axisDcaKaon}); + histos.add("QA/KaonPlus/DCA/h3f_Scd_Dca_vs_pT_cent", "Weak Decay DCA", kTH3F, {axisCent, axisV0Pt, axisDcaKaon}); + histos.add("QA/KaonPlus/DCA/h3f_Mat_Dca_vs_pT_cent", "Material DCA", kTH3F, {axisCent, axisV0Pt, axisDcaKaon}); // McGen Histos histos.add("McGen/h1f_collision_recgen", "# of Reco Collision Associated to One Mc Generator Collision", kTH1F, {axisMult}); @@ -497,9 +488,9 @@ struct LambdaTableProducer { histos.get(HIST("Events/h1f_collisions_info"))->GetXaxis()->SetBinLabel(CollisionLabels::kTotColBeforeHasMcCollision, "kTotColBeforeHasMcCollision"); histos.get(HIST("McGen/h1f_collisions_info"))->GetXaxis()->SetBinLabel(CollisionLabels::kTotCol, "kTotCol"); histos.get(HIST("McGen/h1f_collisions_info"))->GetXaxis()->SetBinLabel(CollisionLabels::kPassSelCol, "kPassSelCol"); - histos.get(HIST("Tracks/h1f_tracks_info"))->GetXaxis()->SetBinLabel(TrackLabels::kTracksBeforeHasMcParticle, "kTracksBeforeHasMcParticle"); - histos.get(HIST("Tracks/h1f_tracks_info"))->GetXaxis()->SetBinLabel(TrackLabels::kGenTotAccLambda, "kGenTotAccLambda"); - histos.get(HIST("Tracks/h1f_tracks_info"))->GetXaxis()->SetBinLabel(TrackLabels::kGenLambdaNoDau, "kGenLambdaNoDau"); + histos.get(HIST("Tracks/h1f_lambda_info"))->GetXaxis()->SetBinLabel(LambdaLabels::kLambdaBeforeHasMcParticle, "kLambdaBeforeHasMcParticle"); + histos.get(HIST("Tracks/h1f_lambda_info"))->GetXaxis()->SetBinLabel(LambdaLabels::kGenTotAccLambda, "kGenTotAccLambda"); + histos.get(HIST("Tracks/h1f_lambda_info"))->GetXaxis()->SetBinLabel(LambdaLabels::kGenLambdaNoDau, "kGenLambdaNoDau"); } // Clone histograms @@ -509,26 +500,63 @@ struct LambdaTableProducer { // QA KaonMinus histos.addClone("QA/KaonPlus/", "QA/KaonMinus/"); - // set bin labels + // Set bin labels histos.get(HIST("Events/h1f_collisions_info"))->GetXaxis()->SetBinLabel(CollisionLabels::kTotCol, "kTotCol"); histos.get(HIST("Events/h1f_collisions_info"))->GetXaxis()->SetBinLabel(CollisionLabels::kPassSelCol, "kPassSelCol"); - histos.get(HIST("Tracks/h1f_tracks_info"))->GetXaxis()->SetBinLabel(TrackLabels::kAllV0Tracks, "kAllV0Tracks"); - histos.get(HIST("Tracks/h1f_tracks_info"))->GetXaxis()->SetBinLabel(TrackLabels::kPassK0ShortMassRej, "kPassK0ShortMassRej"); - histos.get(HIST("Tracks/h1f_tracks_info"))->GetXaxis()->SetBinLabel(TrackLabels::kPassV0DauTrackSel, "kPassV0DauTrackSel"); - histos.get(HIST("Tracks/h1f_tracks_info"))->GetXaxis()->SetBinLabel(TrackLabels::kPassV0KinCuts, "kPassV0KinCuts"); - histos.get(HIST("Tracks/h1f_tracks_info"))->GetXaxis()->SetBinLabel(TrackLabels::kPassV0TopoSel, "kPassV0TopoSel"); - histos.get(HIST("Tracks/h1f_tracks_info"))->GetXaxis()->SetBinLabel(TrackLabels::kAllSelPassed, "kAllSelPassed"); - histos.get(HIST("Tracks/h1f_tracks_info"))->GetXaxis()->SetBinLabel(TrackLabels::kEffCorrPtCent, "kEffCorrPtCent"); - histos.get(HIST("Tracks/h1f_tracks_info"))->GetXaxis()->SetBinLabel(TrackLabels::kEffCorrPtRapCent, "kEffCorrPtRapCent"); - histos.get(HIST("Tracks/h1f_tracks_info"))->GetXaxis()->SetBinLabel(TrackLabels::kMatchEffCorr, "kMatchEffCorr"); - histos.get(HIST("Tracks/h1f_tracks_info"))->GetXaxis()->SetBinLabel(TrackLabels::kNoEffCorr, "kNoEffCorr"); - - histos.get(HIST("Tracks/h1f_kaon_sel"))->GetXaxis()->SetBinLabel(KaonLabels::kKaonAllChargedTracks, "kKaonAllChargedTracks"); - histos.get(HIST("Tracks/h1f_kaon_sel"))->GetXaxis()->SetBinLabel(KaonLabels::kKaonPassKinSel, "kKaonPassKinSel"); - histos.get(HIST("Tracks/h1f_kaon_sel"))->GetXaxis()->SetBinLabel(KaonLabels::kKaonPassGlobalSel, "kKaonPassGlobalSel"); - histos.get(HIST("Tracks/h1f_kaon_sel"))->GetXaxis()->SetBinLabel(KaonLabels::kKaonPassDcaSel, "kKaonPassDcaSel"); - histos.get(HIST("Tracks/h1f_kaon_sel"))->GetXaxis()->SetBinLabel(KaonLabels::kKaonPassElRejSel, "kKaonPassElRejSel"); - histos.get(HIST("Tracks/h1f_kaon_sel"))->GetXaxis()->SetBinLabel(KaonLabels::kKaonPassAllSel, "kKaonPassAllSel"); + histos.get(HIST("Tracks/h1f_lambda_info"))->GetXaxis()->SetBinLabel(LambdaLabels::kAllV0Tracks, "kAllV0Tracks"); + histos.get(HIST("Tracks/h1f_lambda_info"))->GetXaxis()->SetBinLabel(LambdaLabels::kPassK0ShortMassRej, "kPassK0ShortMassRej"); + histos.get(HIST("Tracks/h1f_lambda_info"))->GetXaxis()->SetBinLabel(LambdaLabels::kPassV0DauTrackSel, "kPassV0DauTrackSel"); + histos.get(HIST("Tracks/h1f_lambda_info"))->GetXaxis()->SetBinLabel(LambdaLabels::kPassV0KinCuts, "kPassV0KinCuts"); + histos.get(HIST("Tracks/h1f_lambda_info"))->GetXaxis()->SetBinLabel(LambdaLabels::kPassV0TopoSel, "kPassV0TopoSel"); + histos.get(HIST("Tracks/h1f_lambda_info"))->GetXaxis()->SetBinLabel(LambdaLabels::kAllSelPassed, "kAllSelPassed"); + histos.get(HIST("Tracks/h1f_kaon_info"))->GetXaxis()->SetBinLabel(KaonLabels::kKaonAllChargedTracks, "kKaonAllChargedTracks"); + histos.get(HIST("Tracks/h1f_kaon_info"))->GetXaxis()->SetBinLabel(KaonLabels::kKaonPassKinSel, "kKaonPassKinSel"); + histos.get(HIST("Tracks/h1f_kaon_info"))->GetXaxis()->SetBinLabel(KaonLabels::kKaonPassGlobalSel, "kKaonPassGlobalSel"); + histos.get(HIST("Tracks/h1f_kaon_info"))->GetXaxis()->SetBinLabel(KaonLabels::kKaonPassDcaSel, "kKaonPassDcaSel"); + histos.get(HIST("Tracks/h1f_kaon_info"))->GetXaxis()->SetBinLabel(KaonLabels::kKaonPassElRejSel, "kKaonPassElRejSel"); + histos.get(HIST("Tracks/h1f_kaon_info"))->GetXaxis()->SetBinLabel(KaonLabels::kKaonPassAllSel, "kKaonPassAllSel"); + + // Load correction factor + if (cGetCorrectionFlag) { + // Set CCDB url + ccdb->setURL(cUrlCCDB.value); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setCreatedNotAfter(nolaterthan.value); + + // Get CCDB object + ccdbObjRecoEff = ccdb->getForTimeStamp(cPathCCDBRecoEff.value, nolaterthan.value); + + // Load reco eff corrections + loadRecoEfficiencyHistograms(); + } + } + + template + void getCorrFactHists(T& vhists, std::vector const& strings) + { + using HistPtr = typename T::value_type; + for (size_t i = 0; i < vhists.size(); ++i) { + auto* obj = ccdbObjRecoEff->FindObject(strings[i].c_str()); + if (!obj) { + LOGF(fatal, "CCDB object %s not found!", strings[i].c_str()); + continue; + } + vhists[i] = dynamic_cast(obj->Clone()); + if (!vhists[i]) { + LOGF(fatal, "CCDB object %s could not be cast!", strings[i].c_str()); + } + } + } + + // Load reco efficiency histograms + void loadRecoEfficiencyHistograms() + { + if (cCorrFactHist == kEffCorrPtCent) { + getCorrFactHists(corrHist.vPtCentCorrHists, vCorrFactStrings[kEffCorrPtCent]); + } else if (cCorrFactHist == kEffCorrPtRapCent) { + getCorrFactHists(corrHist.vPtRapCentCorrHists, vCorrFactStrings[kEffCorrPtRapCent]); + } } // Get magnetic field @@ -570,12 +598,12 @@ struct LambdaTableProducer { return false; } - // FT0 Vz estimation + // Zvtx from FT0 time difference if (cZVtxTimeDiff && !col.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { return false; } - // ITS 7 layers hit + // Hit all layers in ITS if (cIsGoodITSLayers && !col.selection_bit(aod::evsel::kIsGoodITSLayersAll)) { return false; } @@ -609,7 +637,7 @@ struct LambdaTableProducer { } template - bool selLambdaDauTracks(const V& v0, const T& postrack, const T& negtrack, ParticleType& partType) + bool selLambdaDauTracks(V const& v0, T const& postrack, T const& negtrack, ParticleType& partType) { // Kinematic selection if (postrack.pt() <= cTrackMinPt || negtrack.pt() <= cTrackMinPt || std::abs(postrack.eta()) >= cTrackEtaCut || std::abs(negtrack.eta()) >= cTrackEtaCut || postrack.tpcNClsCrossedRows() <= cMinTpcCrossedRows || negtrack.tpcNClsCrossedRows() <= cMinTpcCrossedRows) { @@ -662,7 +690,7 @@ struct LambdaTableProducer { return false; } - histos.fill(HIST("Tracks/h1f_tracks_info"), kPassV0KinCuts); + histos.fill(HIST("Tracks/h1f_lambda_info"), kPassV0KinCuts); // Decay length float ctauLambda = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * MassLambda0; @@ -672,14 +700,14 @@ struct LambdaTableProducer { return false; } - histos.fill(HIST("Tracks/h1f_tracks_info"), kPassV0TopoSel); + histos.fill(HIST("Tracks/h1f_lambda_info"), kPassV0TopoSel); // K0s mass rejection if (std::abs(v0.mK0Short() - MassK0Short) <= cKshortRejMassWindow) { return false; } - histos.fill(HIST("Tracks/h1f_tracks_info"), kPassK0ShortMassRej); + histos.fill(HIST("Tracks/h1f_lambda_info"), kPassK0ShortMassRej); // Select Lambda / AntiLambda based on Armenteros-Podolanski bool lambdaFlag = false, antiLambdaFlag = false; @@ -700,7 +728,7 @@ struct LambdaTableProducer { return false; } - histos.fill(HIST("Tracks/h1f_tracks_info"), kPassV0DauTrackSel); + histos.fill(HIST("Tracks/h1f_lambda_info"), kPassV0DauTrackSel); // Remove lambda with ambiguous daughters if (cRemoveAmbiguousTracks && hasAmbiguousDaughters(v0, tracks)) { @@ -731,28 +759,28 @@ struct LambdaTableProducer { return false; } - histos.fill(HIST("Tracks/h1f_kaon_sel"), kKaonPassKinSel); + histos.fill(HIST("Tracks/h1f_kaon_info"), kKaonPassKinSel); // Global track selection if (cKaonGlobalSel && !track.isGlobalTrackWoDCA()) { return false; } - histos.fill(HIST("Tracks/h1f_kaon_sel"), kKaonPassGlobalSel); + histos.fill(HIST("Tracks/h1f_kaon_info"), kKaonPassGlobalSel); // Dca selection if (std::abs(track.dcaXY()) >= cKaonDcaXYCut || std::abs(track.dcaZ()) >= cKaonDcaZCut) { return false; } - histos.fill(HIST("Tracks/h1f_kaon_sel"), kKaonPassDcaSel); + histos.fill(HIST("Tracks/h1f_kaon_info"), kKaonPassDcaSel); // Electron rejection if (std::abs(track.tpcNSigmaPi()) > cTpcRejCut && std::abs(track.tpcNSigmaKa()) > cTpcRejCut && std::abs(track.tpcNSigmaPr()) > cTpcRejCut && track.tpcNSigmaEl() > cTpcElRejCutMin && track.tpcNSigmaEl() < cTpcElRejCutMax) { return false; } - histos.fill(HIST("Tracks/h1f_kaon_sel"), kKaonPassElRejSel); + histos.fill(HIST("Tracks/h1f_kaon_info"), kKaonPassElRejSel); // Kaon PID TPC + TOF if (track.hasTOF()) { @@ -765,72 +793,33 @@ struct LambdaTableProducer { } } - histos.fill(HIST("Tracks/h1f_kaon_sel"), kKaonPassAllSel); + histos.fill(HIST("Tracks/h1f_kaon_info"), kKaonPassAllSel); return true; } // Correction factors - template - float getCorrectionFactors(V const& v, T const&, float const& rap) + template + float getCorrectionFactors(V const& v, float const& rap) { // Initialize efficiency factor - float effCorrFact = 1., matchEffFact = 1.; + float effCorrFact = 1.; // Get Efficiency Factor if (cGetEffFact) { - auto* objEff = ccdbObjRecoEff->FindObject(Form("%s", vCorrFactStrings[cCorrFactHist][part].c_str())); - // check object - if (!objEff) { - LOGF(fatal, "Reco efficiency object not found !"); + if (cCorrFactHist == kEffCorrPtCent) { + histos.fill(HIST("Tracks/h1f_effcorr_info"), kEffCorrPtCent); + effCorrFact = corrHist.vPtCentCorrHists[part]->GetBinContent(corrHist.vPtCentCorrHists[part]->FindBin(cent, v.pt())); + } else if (cCorrFactHist == kEffCorrPtRapCent) { + histos.fill(HIST("Tracks/h1f_effcorr_info"), kEffCorrPtRapCent); + effCorrFact = corrHist.vPtRapCentCorrHists[part]->GetBinContent(corrHist.vPtRapCentCorrHists[part]->FindBin(cent, v.pt(), rap)); } else { - TH1F* histEff = dynamic_cast(objEff->Clone()); - if (histEff->GetDimension() == TwoDimCorr) { - histos.fill(HIST("Tracks/h1f_tracks_info"), kEffCorrPtCent); - effCorrFact = histEff->GetBinContent(histEff->FindBin(cent, v.pt())); - } else if (histEff->GetDimension() == ThreeDimCorr) { - histos.fill(HIST("Tracks/h1f_tracks_info"), kEffCorrPtRapCent); - effCorrFact = histEff->GetBinContent(histEff->FindBin(cent, v.pt(), rap)); - } else { - histos.fill(HIST("Tracks/h1f_tracks_info"), kNoEffCorr); - LOGF(warning, "CCDB OBJECT IS NOT A HISTOGRAM !!!"); - effCorrFact = 1.; - } - delete histEff; + LOGF(warning, "CCDB OBJECT IS NOT A HISTOGRAM !!!"); } } - // Get Matching Efficiency Correction - if (cGetMatchEff) { - auto* objITSTPCMatchEff = ccdbObjMatchEff->FindObject("hITSTPCMatchingEfficiency"); - auto* objITSTPCTOFMatchEff = ccdbObjMatchEff->FindObject("hITSTPCTOFMatchingEfficiency"); - if (!objITSTPCMatchEff || !objITSTPCTOFMatchEff) { - LOGF(fatal, "Matching efficiency object not found !"); - } else { - TH1F* histITSTPCMatchEff = dynamic_cast(objITSTPCMatchEff->Clone()); - TH1F* histITSTPCTOFMatchEff = dynamic_cast(objITSTPCTOFMatchEff->Clone()); - // Lambda / Anti-Lambda - if constexpr (part == kLambda || part == kAntiLambda) { - auto posTrack = v.template posTrack_as(); - auto negTrack = v.template negTrack_as(); - float posTrackMatchEff = histITSTPCMatchEff->GetBinContent(histITSTPCMatchEff->FindBin(cent, posTrack.pt())); - float negTrackMatchEff = histITSTPCMatchEff->GetBinContent(histITSTPCMatchEff->FindBin(cent, negTrack.pt())); - matchEffFact = posTrackMatchEff * negTrackMatchEff; - } - // K+ /K- - if constexpr (part == kKaonPlus || part == kKaonMinus) { - float trackItsTpcMatchEff = histITSTPCMatchEff->GetBinContent(histITSTPCMatchEff->FindBin(cent, v.pt())); - float trackItsTpcTofMatchEff = histITSTPCTOFMatchEff->GetBinContent(histITSTPCTOFMatchEff->FindBin(cent, v.pt())); - matchEffFact = trackItsTpcMatchEff * trackItsTpcTofMatchEff; - } - - histos.fill(HIST("Tracks/h1f_tracks_info"), kMatchEffCorr); - delete histITSTPCMatchEff; - delete histITSTPCTOFMatchEff; - } - } - - return effCorrFact * matchEffFact; + // Return correction factor + return effCorrFact; } // Lambda QA @@ -874,47 +863,22 @@ struct LambdaTableProducer { } } - // Get matching efficiency - template - void getMatchEffHist(T const& tracks) - { - for (auto const& track : tracks) { - if constexpr (dmc == kMC) { // Check corresponding MC particle - if (!track.has_mcParticle()) { - continue; - } - } - // ITS only track - if (track.pt() > cTrackMinPt && std::abs(track.eta()) < cTrackEtaCut && track.hasITS() && track.isQualityTrackITS()) { - histos.fill(HIST("Tracks/h2f_itstrack_centpt"), cent, track.pt()); - } - // ITS+TPC track - if (track.pt() > cTrackMinPt && std::abs(track.eta()) < cTrackEtaCut && track.hasITS() && track.hasTPC() && track.isQualityTrackITS() && track.isQualityTrackTPC()) { - histos.fill(HIST("Tracks/h2f_itstpctrack_centpt"), cent, track.pt()); - } - // ITS+TPC+TOF track - if (track.pt() > cTrackMinPt && std::abs(track.eta()) < cTrackEtaCut && track.hasITS() && track.hasTPC() && track.isQualityTrackITS() && track.isQualityTrackTPC() && track.hasTOF()) { - histos.fill(HIST("Tracks/h2f_itstpctoftrack_centpt"), cent, track.pt()); - } - } - } - // Dca analysis template void getDcaHist(T const& track, float const& dca) { // Fill histograms - histos.fill(HIST(SubDir[part]) + HIST("DCA/h2f_Dca_vs_pT"), track.pt(), dca); + histos.fill(HIST(SubDir[part]) + HIST("DCA/h3f_Dca_vs_pT_cent"), cent, track.pt(), dca); if constexpr (dmc == kMC) { auto mcpart = track.mcParticle(); if (mcpart.isPhysicalPrimary()) { - histos.fill(HIST(SubDir[part]) + HIST("DCA/h2f_Prm_Dca_vs_pT"), track.pt(), dca); + histos.fill(HIST(SubDir[part]) + HIST("DCA/h3f_Prm_Dca_vs_pT_cent"), cent, track.pt(), dca); } else { if (mcpart.getProcess() == cWeakDecayProcess) { // Weak decay - histos.fill(HIST(SubDir[part]) + HIST("DCA/h2f_Scd_Dca_vs_pT"), track.pt(), dca); + histos.fill(HIST(SubDir[part]) + HIST("DCA/h3f_Scd_Dca_vs_pT_cent"), cent, track.pt(), dca); } else { // Material - histos.fill(HIST(SubDir[part]) + HIST("DCA/h2f_Mat_Dca_vs_pT"), track.pt(), dca); + histos.fill(HIST(SubDir[part]) + HIST("DCA/h3f_Mat_Dca_vs_pT_cent"), cent, track.pt(), dca); } } } @@ -937,6 +901,7 @@ struct LambdaTableProducer { // Fill Collision Histograms histos.fill(HIST("Events/h1f_collisions_info"), kPassSelCol); histos.fill(HIST("Events/h1f_collision_posZ"), collision.posZ()); + histos.fill(HIST("Events/h1f_collision_cent"), cent); // Fill Collision Table float magField = getMagneticField(collision.template foundBC_as().timestamp()); @@ -954,13 +919,13 @@ struct LambdaTableProducer { // Check for corresponding MCGen Particle if constexpr (dmc == kMC) { - histos.fill(HIST("Tracks/h1f_tracks_info"), kTracksBeforeHasMcParticle); + histos.fill(HIST("Tracks/h1f_lambda_info"), kLambdaBeforeHasMcParticle); if (!v0.has_mcParticle() || !postrack.has_mcParticle() || !negtrack.has_mcParticle()) { // check corresponding MC particle continue; } } - histos.fill(HIST("Tracks/h1f_tracks_info"), kAllV0Tracks); + histos.fill(HIST("Tracks/h1f_lambda_info"), kAllV0Tracks); histos.fill(HIST("Tracks/h2f_armpod_before_sel"), v0.alpha(), v0.qtarm()); // Select V0 as Lambda/AntiLambda @@ -969,7 +934,7 @@ struct LambdaTableProducer { } // We have v0 as lambda - histos.fill(HIST("Tracks/h1f_tracks_info"), kAllSelPassed); + histos.fill(HIST("Tracks/h1f_lambda_info"), kAllSelPassed); histos.fill(HIST("Tracks/h2f_armpod_after_sel"), v0.alpha(), v0.qtarm()); // MC matching @@ -987,7 +952,7 @@ struct LambdaTableProducer { // Get Lambda mass and correction factor lambdaMass = (partType == kLambda) ? v0.mLambda() : v0.mAntiLambda(); if (cGetCorrectionFlag) { - lambdaCorrFact = (partType == kLambda) ? getCorrectionFactors(v0, tracks, v0.yLambda()) : getCorrectionFactors(v0, tracks, v0.yLambda()); + lambdaCorrFact = (partType == kLambda) ? getCorrectionFactors(v0, v0.yLambda()) : getCorrectionFactors(v0, v0.yLambda()); } // Fill lambda qa @@ -1020,7 +985,7 @@ struct LambdaTableProducer { } // All charged tracks - histos.fill(HIST("Tracks/h1f_kaon_sel"), kKaonAllChargedTracks); + histos.fill(HIST("Tracks/h1f_kaon_info"), kKaonAllChargedTracks); // Kaon rapidity std::array mom = {track.px(), track.py(), track.pz()}; @@ -1056,7 +1021,7 @@ struct LambdaTableProducer { // Get Kaon correction factor if (cGetCorrectionFlag) { - kaonCorrFact = (partType == kKaonPlus) ? getCorrectionFactors(track, track, rap) : getCorrectionFactors(track, track, rap); + kaonCorrFact = (partType == kKaonPlus) ? getCorrectionFactors(track, rap) : getCorrectionFactors(track, rap); } // Fill table @@ -1097,11 +1062,11 @@ struct LambdaTableProducer { continue; } - histos.fill(HIST("Tracks/h1f_tracks_info"), kGenTotAccLambda); + histos.fill(HIST("Tracks/h1f_lambda_info"), kGenTotAccLambda); // get daughter track info and check for decay channel flag if (!mcpart.has_daughters()) { - histos.fill(HIST("Tracks/h1f_tracks_info"), kGenLambdaNoDau); + histos.fill(HIST("Tracks/h1f_lambda_info"), kGenLambdaNoDau); continue; } auto dautracks = mcpart.template daughters_as(); @@ -1166,7 +1131,7 @@ struct LambdaTableProducer { // BC, Collision, tracks and V0s using BCsRun3 = soa::Join; - using Collisions = soa::Join; + using Collisions = soa::Join; using Tracks = soa::Join; using TracksMC = soa::Join; using McV0Tracks = soa::Join; @@ -1186,18 +1151,6 @@ struct LambdaTableProducer { PROCESS_SWITCH(LambdaTableProducer, processData, "Process for DATA", false); - void processMatchEffData(Collisions::iterator const& collision, Tracks const& tracks) - { - // check collision - if (!selCollision(collision)) { - return; - } - // Get Matching Efficiency - getMatchEffHist(tracks); - } - - PROCESS_SWITCH(LambdaTableProducer, processMatchEffData, "Process for Matching Efficieny Calculation", false); - void processMCReco(soa::Join::iterator const& collision, aod::McCollisions const&, BCsRun3 const& bc, McV0Tracks const& V0s, TracksMC const& tracks, aod::McParticles const&) { @@ -1210,18 +1163,6 @@ struct LambdaTableProducer { PROCESS_SWITCH(LambdaTableProducer, processMCReco, "Process for McReco DATA", false); - void processMatchEffMCReco(soa::Join::iterator const& collision, aod::McCollisions const&, TracksMC const& tracks, aod::McParticles const&) - { - // check collision - if (!selCollision(collision)) { - return; - } - // Get Matching Efficiency - getMatchEffHist(tracks); - } - - PROCESS_SWITCH(LambdaTableProducer, processMatchEffMCReco, "Process for Matching Efficieny Calculation at MC Reconstructed Level", false); - void processMCRecoGen(aod::McCollisions::iterator const& mcCollision, soa::SmallGroups> const& collisions, BCsRun3 const& bc, McV0Tracks const& V0s, TracksMC const& tracks, @@ -1434,12 +1375,14 @@ struct LambdaR2Correlation { Configurable cMinRap{"cMinRap", -0.5, "Minimum Rapidity"}; Configurable cMaxRap{"cMaxRap", 0.5, "Maximum Rapidity"}; Configurable cNPhiBins{"cNPhiBins", 36, "N Phi Bins"}; - Configurable cAnaPairs{"cAnaPairs", false, "Analyze pairs flag"}; + + // Analysis flags + Configurable cAnaPairs{"cAnaPairs", false, "Analyze Pairs Flag"}; Configurable cAnaEff{"cAnaEff", false, "Analyze efficiency flag"}; // Lambda Kaon femtoscopic correction Configurable cApplyFemtoSel{"cApplyFemtoSel", false, "Femto qinv selection"}; - Configurable cFemtoCut{"cFemtoCut", 0.02, "Kaon--Lambda Femto qinv cut"}; + Configurable cFemtoCut{"cFemtoCut", 0.1, "Kaon--Lambda Femto qinv cut"}; // Lambda Kaon two-track cuts Configurable cApplyTwoTrackCut{"cApplyTwoTrackCut", false, "Flag for two track cut"}; @@ -1501,6 +1444,7 @@ struct LambdaR2Correlation { // Event histos.add("Event/Reco/h1f_collision_posz", "V_{Z} Distribution", kTH1F, {axisPosZ}); histos.add("Event/Reco/h1f_ft0m_mult_percentile", "FT0M (%)", kTH1F, {axisCent}); + histos.add("Event/Reco/h2f_Mult_vs_Centrality", "N_{ch} vs FT0M(%)", kTProfile, {axisCent}); // Two track cut histos.add("QA/TwoTrackCut/Before/h2d_n2_detadphi", "#rho_{2}", kTH2D, {axisDEta, axisDPhi}); @@ -1734,8 +1678,8 @@ struct LambdaR2Correlation { histos.fill(HIST("Event/Reco/h1f_collision_posz"), collision.posZ()); histos.fill(HIST("Event/Reco/h1f_ft0m_mult_percentile"), collision.cent()); - cent = collision.cent(); posZ = collision.posZ(); + cent = collision.cent(); magField = collision.bField(); auto lambdaTracks = partLambdaTracks->sliceByCached(aod::lambdatrack::lambdaCollisionId, collision.globalIndex(), cache); @@ -1777,6 +1721,7 @@ struct LambdaR2Correlation { histos.fill(HIST("Event/McGen/h1f_collision_posz"), mcgencol.posZ()); histos.fill(HIST("Event/McGen/h1f_ft0m_mult_percentile"), mcgencol.cent()); + posZ = mcgencol.posZ(); cent = mcgencol.cent(); auto lambdaTracks = partMcLambdaTracks->sliceByCached(aod::lambdamcgentrack::lambdaMcGenCollisionId, mcgencol.globalIndex(), cache);