From 9daa451318898f8d3507fe9c65278a96f12edb6b Mon Sep 17 00:00:00 2001 From: Yash Patley <52608802+yashpatley@users.noreply.github.com> Date: Mon, 20 Jul 2026 12:06:09 +0530 Subject: [PATCH 1/5] [PWGCF] Update lambda R2 correlation 1. Added CCDB histogram loader 2. Removed matching efficiency methods 3. Update DCA histograms --- .../Tasks/lambdaR2Correlation.cxx | 321 +++++++----------- 1 file changed, 127 insertions(+), 194 deletions(-) diff --git a/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx b/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx index 98f3a1aa513..8df6bd13a22 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx @@ -220,23 +220,19 @@ using KaonMcGenTrack = KaonMcGenTracks::iterator; } // namespace o2::aod enum CollisionLabels { - kTotColBeforeHasMcCollision = 1, + kTotColBeforeHasMcCollision = 0, kTotCol, kPassSelCol }; -enum TrackLabels { - kTracksBeforeHasMcParticle = 1, +enum LambdaLabels { + kLambdaBeforeHasMcParticle = 1, kAllV0Tracks, kPassV0KinCuts, kPassV0TopoSel, kPassK0ShortMassRej, kPassV0DauTrackSel, kAllSelPassed, - kEffCorrPtCent, - kEffCorrPtRapCent, - kMatchEffCorr, - kNoEffCorr, kGenTotAccLambda, kGenLambdaNoDau, }; @@ -250,6 +246,11 @@ enum KaonLabels { kKaonPassAllSel }; +enum EffCorrType { + kEffCorrPtCent = 0, + kEffCorrPtRapCent +}; + enum CentEstType { kCentFT0M = 0, kCentFT0C @@ -287,12 +288,6 @@ enum DMCType { kMC }; -enum CorrHistDim { - OneDimCorr = 1, - TwoDimCorr, - ThreeDimCorr -}; - struct LambdaTableProducer { // Table Producers Produces lambdaCollisionTable; @@ -325,17 +320,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 @@ -354,15 +349,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 @@ -372,7 +366,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 @@ -382,9 +375,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., mult = 0.; @@ -394,19 +392,9 @@ 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 axisCols(5, 0., 5., ""); + const AxisSpec axisTrks(15, 0., 15., ""); const AxisSpec axisCent(100, 0, 100, "Centrality(%)"); const AxisSpec axisVarCent(cCentBins, "FT0C%"); const AxisSpec axisPVMults(1000, 0, 1000, "N_{PV}"); @@ -444,16 +432,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/h2f_pvmult_vs_cent", "PVMult Vs Cent", kTH2F, {axisCent, axisPVMults}); + 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, {axisTrks}); 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}); @@ -475,8 +461,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}); @@ -487,12 +473,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}); @@ -506,9 +492,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 @@ -518,26 +504,61 @@ 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(); + } + } + + // Load reco efficiency histograms + void LoadRecoEfficiencyHistograms() + { + auto 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()); + } + } + }; + + if (cCorrFactHist == kEffCorrPtCent) { + GetCorrFactHists(corrHist.vPtCentCorrHists, vCorrFactStrings[kEffCorrPtCent]); + } else if (cCorrFactHist == kEffCorrPtRapCent) { + GetCorrFactHists(corrHist.vPtRapCentCorrHists, vCorrFactStrings[kEffCorrPtRapCent]); + } } // Get magnetic field @@ -620,7 +641,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) { @@ -673,7 +694,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; @@ -683,14 +704,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; @@ -711,7 +732,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)) { @@ -742,28 +763,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()) { @@ -776,72 +797,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 @@ -885,47 +867,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); } } } @@ -948,7 +905,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/h2f_pvmult_vs_cent"), cent, collision.multNTracksPV()); + histos.fill(HIST("Events/h1f_collision_cent"), cent); // Fill Collision Table float magField = getMagneticField(collision.template foundBC_as().timestamp()); @@ -966,13 +923,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 @@ -981,7 +938,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 @@ -999,7 +956,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 @@ -1032,7 +989,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()}; @@ -1068,7 +1025,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 @@ -1109,11 +1066,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(); @@ -1198,18 +1155,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&) { @@ -1222,18 +1167,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, From 2e397018edeea31fed9c7699c07cb55a2cd9ca39 Mon Sep 17 00:00:00 2001 From: Yash Patley <52608802+yashpatley@users.noreply.github.com> Date: Mon, 20 Jul 2026 12:54:14 +0530 Subject: [PATCH 2/5] Update lambdaR2Correlation.cxx --- .../Tasks/lambdaR2Correlation.cxx | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx b/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx index 8df6bd13a22..8d0917e07cf 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx @@ -220,7 +220,7 @@ using KaonMcGenTrack = KaonMcGenTracks::iterator; } // namespace o2::aod enum CollisionLabels { - kTotColBeforeHasMcCollision = 0, + kTotColBeforeHasMcCollision = 1, kTotCol, kPassSelCol }; @@ -536,24 +536,26 @@ struct LambdaTableProducer { } } - // Load reco efficiency histograms - void LoadRecoEfficiencyHistograms() + template + void GetCorrFactHists(T& vhists, std::vector const& strings) { - auto 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()); - } + 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) { From 5f9159dd3552f4301725ebbba0f3368194d69d3f Mon Sep 17 00:00:00 2001 From: Yash Patley <52608802+yashpatley@users.noreply.github.com> Date: Mon, 20 Jul 2026 13:04:43 +0530 Subject: [PATCH 3/5] Update lambdaR2Correlation.cxx --- .../TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx b/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx index 8d0917e07cf..238119f6b8a 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx @@ -393,8 +393,9 @@ struct LambdaTableProducer { void init(InitContext const&) { // initialize axis specifications - const AxisSpec axisCols(5, 0., 5., ""); - const AxisSpec axisTrks(15, 0., 15., ""); + const AxisSpec axisCols(5, 0.5, 5.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 axisPVMults(1000, 0, 1000, "N_{PV}"); @@ -437,7 +438,7 @@ struct LambdaTableProducer { // QA 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, {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}); From d9bafa47ac4f5fcbcfc2f921ae4703d471a089bf Mon Sep 17 00:00:00 2001 From: Yash Patley <52608802+yashpatley@users.noreply.github.com> Date: Mon, 20 Jul 2026 15:22:32 +0530 Subject: [PATCH 4/5] Update lambdaR2Correlation.cxx --- PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx b/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx index 238119f6b8a..5bd5fe85f11 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx @@ -42,14 +42,16 @@ #include #include +#include +#include #include #include #include -#include #include #include #include +#include #include #include #include From ddfbdccee9f923b03e4224b3c3f4bdf0f01255ba Mon Sep 17 00:00:00 2001 From: Yash Patley <52608802+yashpatley@users.noreply.github.com> Date: Mon, 20 Jul 2026 15:31:25 +0530 Subject: [PATCH 5/5] Update lambdaR2Correlation.cxx --- PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx b/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx index 5bd5fe85f11..b64c0507bed 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx @@ -50,8 +50,8 @@ #include #include -#include #include +#include #include #include #include