From 80285103cfbb8cffd20105027f6e26149095cfc1 Mon Sep 17 00:00:00 2001 From: Yash Patley <52608802+yashpatley@users.noreply.github.com> Date: Wed, 22 Apr 2026 22:50:23 +0200 Subject: [PATCH 1/2] [PWGCF]: Update lambdaR2Correlation.cxx 1. Removed the Matching Efficiency Correction 2. Added lambda mass selection --- .../Tasks/lambdaR2Correlation.cxx | 335 +++++++----------- 1 file changed, 124 insertions(+), 211 deletions(-) diff --git a/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx b/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx index 5643f73d107..814899e0261 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx @@ -15,42 +15,22 @@ #include "PWGLF/DataModel/LFStrangenessTables.h" -#include "Common/CCDB/EventSelectionParams.h" -#include "Common/CCDB/TriggerAliases.h" #include "Common/Core/RecoDecay.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/CollisionAssociationTables.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/PIDResponseTPC.h" -#include "Common/DataModel/TrackSelectionTables.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include +#include "Common/DataModel/PIDResponse.h" + +#include "CCDB/BasicCCDBManager.h" +#include "CommonConstants/PhysicsConstants.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + +#include "TPDGCode.h" + #include -#include #include using namespace o2; @@ -158,6 +138,7 @@ DECLARE_SOA_TABLE(LambdaMcGenTracks, "AOD", "LMCGENTRACKS", o2::soa::Index<>, lambdatrack::V0PrmScd, lambdatrack::CorrFact); using LambdaMcGenTrack = LambdaMcGenTracks::iterator; + } // namespace o2::aod enum CollisionLabels { @@ -197,7 +178,7 @@ enum TrackLabels { enum CentEstType { kCentFT0M = 0, - kCentFT0C + kCentFV0A }; enum RunType { @@ -250,21 +231,18 @@ enum PrmScdPairType { }; struct LambdaTableProducer { - // Table Producers + Produces lambdaCollisionTable; Produces lambdaTrackTable; Produces lambdaMCGenCollisionTable; Produces lambdaMCGenTrackTable; - // Centrality Axis - ConfigurableAxis cCentBins{"cCentBins", {VARIABLE_WIDTH, 0.0f, 10.0f, 20.0f, 50.f, 80.0f, 100.f}, "Variable Centrality Bins"}; - // Collisions - Configurable cCentEstimator{"cCentEstimator", 1, "Centrality Estimator : 0-FT0M, 1-FT0C"}; - Configurable cMinZVtx{"cMinZVtx", -7.0, "Min VtxZ cut"}; - Configurable cMaxZVtx{"cMaxZVtx", 7.0, "Max VtxZ cut"}; - Configurable cMinCent{"cMinCent", 0., "Minumum Centrality"}; - Configurable cMaxCent{"cMaxCent", 100.0, "Maximum Centrality"}; + Configurable cCentEstimator{"cCentEstimator", 0, "Centrality Estimator : 0-FT0M, 1-FV0A"}; + Configurable cMinZVtx{"cMinZVtx", -10.0, "Min VtxZ cut"}; + Configurable cMaxZVtx{"cMaxZVtx", 10.0, "Max VtxZ cut"}; + Configurable cMinMult{"cMinMult", 0., "Minumum Multiplicity"}; + Configurable cMaxMult{"cMaxMult", 100.0, "Maximum Multiplicity"}; Configurable cSel8Trig{"cSel8Trig", true, "Sel8 (T0A + T0C) Selection Run3"}; Configurable cInt7Trig{"cInt7Trig", false, "kINT7 MB Trigger"}; Configurable cSel7Trig{"cSel7Trig", false, "Sel7 (V0A + V0C) Selection Run2"}; @@ -277,10 +255,13 @@ struct LambdaTableProducer { Configurable cIsGoodITSLayers{"cIsGoodITSLayers", false, "Good ITS Layers All"}; // Tracks - Configurable cTrackMinPt{"cTrackMinPt", 0.1, "p_{T} minimum"}; + Configurable cTrackMinPt{"cTrackMinPt", 0.15, "p_{T} minimum"}; Configurable cTrackMaxPt{"cTrackMaxPt", 999.0, "p_{T} maximum"}; Configurable cTrackEtaCut{"cTrackEtaCut", 0.8, "Pseudorapidity cut"}; Configurable cMinTpcCrossedRows{"cMinTpcCrossedRows", 70, "TPC Min Crossed Rows"}; + Configurable cMinTpcCROverCls{"cMinTpcCROverCls", 0.8, "Tpc Min Crossed Rows Over Findable Clusters"}; + Configurable cMaxTpcSharedClusters{"cMaxTpcSharedClusters", 0.4, "Tpc Max Shared Clusters"}; + Configurable cMaxChi2Tpc{"cMaxChi2Tpc", 4, "Max Chi2 Tpc"}; Configurable cTpcNsigmaCut{"cTpcNsigmaCut", 3.0, "TPC NSigma Selection Cut"}; Configurable cRemoveAmbiguousTracks{"cRemoveAmbiguousTracks", false, "Remove Ambiguous Tracks"}; @@ -300,33 +281,35 @@ struct LambdaTableProducer { Configurable cKshortRejFlag{"cKshortRejFlag", true, "K0short Mass Rej Flag"}; // V0s kinmatic acceptance - Configurable cV0MassWindow{"cV0MassWindow", 0.007, "V0 Mass Window"}; - Configurable cMinV0Pt{"cMinV0Pt", 0.6, "Minimum V0 pT"}; - Configurable cMaxV0Pt{"cMaxV0Pt", 3.6, "Minimum V0 pT"}; + Configurable cMinV0Mass{"cMinV0Mass", 1.10, "V0 Mass Min"}; + Configurable cMaxV0Mass{"cMaxV0Mass", 1.12, "V0 Mass Min"}; + Configurable cMinV0Pt{"cMinV0Pt", 0.8, "Minimum V0 pT"}; + Configurable cMaxV0Pt{"cMaxV0Pt", 4.2, "Minimum V0 pT"}; Configurable cMaxV0Rap{"cMaxV0Rap", 0.5, "|rap| cut"}; Configurable cDoEtaAnalysis{"cDoEtaAnalysis", false, "Do Eta Analysis"}; - Configurable cV0TypeSelFlag{"cV0TypeSelFlag", true, "V0 Type Selection Flag"}; + Configurable cV0TypeSelFlag{"cV0TypeSelFlag", false, "V0 Type Selection Flag"}; Configurable cV0TypeSelection{"cV0TypeSelection", 1, "V0 Type Selection"}; // V0s MC Configurable cHasMcFlag{"cHasMcFlag", true, "Has Mc Tag"}; - Configurable cSelectTrueLambda{"cSelectTrueLambda", false, "Select True Lambda"}; - Configurable cSelMCPSV0{"cSelMCPSV0", false, "Select Primary/Secondary V0"}; + Configurable cSelectTrueLambda{"cSelectTrueLambda", true, "Select True Lambda"}; + Configurable cSelMCPSV0{"cSelMCPSV0", true, "Select Primary/Secondary V0"}; Configurable cCheckRecoDauFlag{"cCheckRecoDauFlag", true, "Check for reco daughter PID"}; + Configurable cGenPrimaryLambda{"cGenPrimaryLambda", true, "Primary Generated Lambda"}; + Configurable cGenSecondaryLambda{"cGenSecondaryLambda", false, "Secondary Generated Lambda"}; Configurable cGenDecayChannel{"cGenDecayChannel", true, "Gen Level Decay Channel Flag"}; + Configurable cRecoMomResoFlag{"cRecoMomResoFlag", false, "Check effect of momentum space smearing on balance function"}; // Efficiency Correction Configurable cCorrectionFlag{"cCorrectionFlag", false, "Correction Flag"}; Configurable cGetEffFact{"cGetEffFact", false, "Get Efficiency Factor Flag"}; Configurable cGetPrimFrac{"cGetPrimFrac", false, "Get Primary Fraction Flag"}; - Configurable cGetMatchEff{"cGetMatchEff", false, "Get Matching Efficiency Flag"}; Configurable cCorrFactHist{"cCorrFactHist", 0, "Efficiency Factor Histogram"}; Configurable cPrimFracHist{"cPrimFracHist", 0, "Primary Fraction Histogram"}; // CCDB - Configurable cUrlCCDB{"cUrlCCDB", "http://alice-ccdb.cern.ch", "ALICE CCDB URL"}; - Configurable cPathCCDB{"cPathCCDB", "Users/y/ypatley/LHC22oPass7/LambdaCorrectionFactor", "Path for ccdb-object"}; - Configurable cPathCCDBMatchEff{"cPathCCDBMatchEff", "Users/y/ypatley/LHC22oPass7/ITSTPCMatchEff", "Path for ccdb-object for matching efficiency"}; + Configurable cUrlCCDB{"cUrlCCDB", "http://ccdb-test.cern.ch:8080", "url of ccdb"}; + Configurable cPathCCDB{"cPathCCDB", "Users/y/ypatley/lambda_corr_fact", "Path for ccdb-object"}; // Initialize CCDB Service Service ccdb; @@ -346,6 +329,7 @@ struct LambdaTableProducer { // Initialize Global Variables float cent = 0., mult = 0.; + float pt = 0., eta = 0., rap = 0., phi = 0.; void init(InitContext const&) { @@ -356,9 +340,7 @@ struct LambdaTableProducer { // initialize axis specifications const AxisSpec axisCols(5, 0.5, 5.5, ""); const AxisSpec axisTrks(30, 0.5, 30.5, ""); - const AxisSpec axisCent(100, 0, 100, "Centrality(%)"); - const AxisSpec axisVarCent(cCentBins, "FT0C%"); - const AxisSpec axisPVMults(1000, 0, 1000, "N_{PV}"); + const AxisSpec axisCent(100, 0, 100, "FT0M (%)"); const AxisSpec axisMult(10, 0, 10, "N_{#Lambda}"); const AxisSpec axisVz(220, -11, 11, "V_{z} (cm)"); const AxisSpec axisPID(8000, -4000, 4000, "PdgCode"); @@ -379,7 +361,6 @@ struct LambdaTableProducer { const AxisSpec axisAlpha(40, -1, 1, "#alpha"); const AxisSpec axisQtarm(40, 0, 0.4, "q_{T}"); - const AxisSpec axisITSTPCTrackPt(100, 0, 10, "p_{T} (GeV/#it{c})"); const AxisSpec axisTrackPt(40, 0, 4, "p_{T} (GeV/#it{c})"); const AxisSpec axisTrackDCA(200, -1, 1, "dca_{XY} (cm)"); const AxisSpec axisMomPID(80, 0, 4, "p (GeV/#it{c})"); @@ -390,7 +371,6 @@ 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}); // QA histos.add("Tracks/h1f_tracks_info", "# of tracks", kTH1F, {axisTrks}); @@ -398,8 +378,6 @@ struct LambdaTableProducer { histos.add("Tracks/h2f_armpod_after_sel", "Armentros-Podolanski Plot", kTH2F, {axisAlpha, axisQtarm}); histos.add("Tracks/h1f_lambda_pt_vs_invm", "p_{T} vs M_{#Lambda}", kTH2F, {axisV0Mass, axisV0Pt}); histos.add("Tracks/h1f_antilambda_pt_vs_invm", "p_{T} vs M_{#bar{#Lambda}}", kTH2F, {axisV0Mass, axisV0Pt}); - histos.add("Tracks/h2f_itstrack_centpt", "h2f_itstrack_centpt", kTH2F, {axisVarCent, axisITSTPCTrackPt}); - histos.add("Tracks/h2f_itstpctrack_centpt", "h2f_itstpctrack_centpt", kTH2F, {axisVarCent, axisITSTPCTrackPt}); // QA Lambda histos.add("QA/Lambda/h2f_qt_vs_alpha", "Armentros-Podolanski Plot", kTH2F, {axisAlpha, axisQtarm}); @@ -418,10 +396,6 @@ struct LambdaTableProducer { histos.add("QA/Lambda/h1f_neg_prong_eta", "Neg-Prong #eta-distribution", kTH1F, {axisV0Eta}); histos.add("QA/Lambda/h1f_pos_prong_phi", "Pos-Prong #phi-distribution", kTH1F, {axisV0Phi}); histos.add("QA/Lambda/h1f_neg_prong_phi", "Neg-Prong #phi-distribution", kTH1F, {axisV0Phi}); - histos.add("QA/Lambda/h2f_pos_prong_xisqperclustertpc", "#chi^{2}/cluster TPC", kTH2F, {axisTrackPt, {200, 0, 50}}); - histos.add("QA/Lambda/h2f_pos_prong_xisqperclusterits", "#chi^{2}/cluster ITS", kTH2F, {axisTrackPt, {200, 0, 50}}); - histos.add("QA/Lambda/h2f_neg_prong_xisqperclustertpc", "#chi^{2}/cluster TPC", kTH2F, {axisTrackPt, {200, 0, 50}}); - histos.add("QA/Lambda/h2f_neg_prong_xisqperclusterits", "#chi^{2}/cluster ITS", kTH2F, {axisTrackPt, {200, 0, 50}}); histos.add("QA/Lambda/h2f_pos_prong_dcaXY_vs_pt", "DCA vs p_{T}", kTH2F, {axisTrackPt, axisTrackDCA}); histos.add("QA/Lambda/h2f_neg_prong_dcaXY_vs_pt", "DCA vs p_{T}", kTH2F, {axisTrackPt, axisTrackDCA}); @@ -447,8 +421,7 @@ struct LambdaTableProducer { // McReco Histos histos.add("Tracks/h2f_tracks_pid_before_sel", "PIDs", kTH2F, {axisPID, axisV0Pt}); histos.add("Tracks/h2f_tracks_pid_after_sel", "PIDs", kTH2F, {axisPID, axisV0Pt}); - histos.add("Tracks/h2f_primary_lambda_mothers_pdg", "PIDs", kTH2F, {axisPID, axisV0Pt}); - histos.add("Tracks/h2f_secondary_lambda_mothers_pdg", "PIDs", kTH2F, {axisPID, axisV0Pt}); + histos.add("Tracks/h2f_lambda_mothers_pdg", "PIDs", kTH2F, {axisPID, axisV0Pt}); // McGen Histos histos.add("McGen/h1f_collision_recgen", "# of Reco Collision Associated to One Mc Generator Collision", kTH1F, {axisMult}); @@ -518,8 +491,8 @@ struct LambdaTableProducer { // select centrality estimator if (cCentEstimator == kCentFT0M) { cent = col.centFT0M(); - } else if (cCentEstimator == kCentFT0C) { - cent = col.centFT0C(); + } else if (cCentEstimator == kCentFV0A) { + cent = col.centFV0A(); } if (cSel8Trig && !col.sel8()) { return false; @@ -534,7 +507,7 @@ struct LambdaTableProducer { } } - if (cent <= cMinCent || cent >= cMaxCent) { // select centrality percentile class + if (cent <= cMinMult || cent >= cMaxMult) { // select centrality percentile class return false; } @@ -567,7 +540,7 @@ struct LambdaTableProducer { } // Set Multiplicity - mult = col.multTPC(); + mult = col.multNTracksPV(); return true; } @@ -594,6 +567,18 @@ struct LambdaTableProducer { return false; } + if (track.tpcCrossedRowsOverFindableCls() < cMinTpcCROverCls) { + return false; + } + + if (track.tpcNClsShared() > cMaxTpcSharedClusters) { + return false; + } + + if (track.tpcChi2NCl() > cMaxChi2Tpc) { + return false; + } + return true; } @@ -700,13 +685,13 @@ struct LambdaTableProducer { bool lambdaFlag = false, antiLambdaFlag = false; // get v0 track as lambda - if ((std::abs(v0.mLambda() - MassLambda0) <= cV0MassWindow) && (selLambdaDauWithTpcPid(postrack, negtrack))) { + if ((v0.mLambda() > cMinV0Mass && v0.mLambda() < cMaxV0Mass) && (selLambdaDauWithTpcPid(postrack, negtrack))) { lambdaFlag = true; v0type = kLambda; } // get v0 track as anti-lambda - if (((std::abs(v0.mAntiLambda() - MassLambda0) <= cV0MassWindow)) && (selLambdaDauWithTpcPid(postrack, negtrack))) { + if ((v0.mAntiLambda() > cMinV0Mass && v0.mAntiLambda() < cMaxV0Mass) && (selLambdaDauWithTpcPid(postrack, negtrack))) { antiLambdaFlag = true; v0type = kAntiLambda; } @@ -849,8 +834,8 @@ struct LambdaTableProducer { return true; } - template - float getCorrectionFactors(V const& v0, T const&) + template + float getCorrectionFactors(V const& v0) { // Check for efficiency correction flag if (!cCorrectionFlag) { @@ -867,7 +852,7 @@ struct LambdaTableProducer { } // initialize efficiency factor and primary fraction values - float effCorrFact = 1., primFrac = 1., matchEffFact = 1.; + float effCorrFact = 1., primFrac = 1.; float rap = (cDoEtaAnalysis) ? v0.eta() : v0.yLambda(); // Get Efficiency Factor @@ -907,32 +892,15 @@ struct LambdaTableProducer { delete histPrm; } - // Get Matching Efficiency Correction - if (cGetMatchEff) { - auto posTrack = v0.template posTrack_as(); - auto negTrack = v0.template negTrack_as(); - auto ccdbObjMatchEff = ccdb->getForTimeStamp(cPathCCDBMatchEff.value, -1); - TObject* objMatchEff = reinterpret_cast(ccdbObjMatchEff->FindObject("hITSTPCMatchingEfficiency")); - TH1F* histMatchEff = reinterpret_cast(objMatchEff->Clone()); - float posTrackMatchEff = histMatchEff->GetBinContent(histMatchEff->FindBin(cent, posTrack.pt())); - float negTrackMatchEff = histMatchEff->GetBinContent(histMatchEff->FindBin(cent, negTrack.pt())); - matchEffFact = posTrackMatchEff * negTrackMatchEff; - delete histMatchEff; - } - - return primFrac * effCorrFact * matchEffFact; + return primFrac * effCorrFact; } template - void fillLambdaMothers(V const& v0, T const&, PrmScdType const& ps) + void fillLambdaMothers(V const& v0, T const&) { auto mcpart = v0.template mcParticle_as(); auto lambdaMothers = mcpart.template mothers_as(); - if (ps == kPrimary) { - histos.fill(HIST("Tracks/h2f_primary_lambda_mothers_pdg"), lambdaMothers[0].pdgCode(), v0.pt()); - } else { - histos.fill(HIST("Tracks/h2f_secondary_lambda_mothers_pdg"), lambdaMothers[0].pdgCode(), v0.pt()); - } + histos.fill(HIST("Tracks/h2f_lambda_mothers_pdg"), lambdaMothers[0].pdgCode(), v0.pt()); } template @@ -970,13 +938,9 @@ struct LambdaTableProducer { histos.fill(HIST(SubDir[part]) + HIST("h1f_pos_prong_pt"), postrack.pt()); histos.fill(HIST(SubDir[part]) + HIST("h1f_pos_prong_eta"), postrack.eta()); histos.fill(HIST(SubDir[part]) + HIST("h1f_pos_prong_phi"), postrack.phi()); - histos.fill(HIST(SubDir[part]) + HIST("h2f_pos_prong_xisqperclusterits"), postrack.pt(), postrack.itsChi2NCl()); - histos.fill(HIST(SubDir[part]) + HIST("h2f_pos_prong_xisqperclustertpc"), postrack.pt(), postrack.tpcChi2NCl()); histos.fill(HIST(SubDir[part]) + HIST("h1f_neg_prong_pt"), negtrack.pt()); histos.fill(HIST(SubDir[part]) + HIST("h1f_neg_prong_eta"), negtrack.eta()); histos.fill(HIST(SubDir[part]) + HIST("h1f_neg_prong_phi"), negtrack.phi()); - histos.fill(HIST(SubDir[part]) + HIST("h2f_neg_prong_xisqperclusterits"), negtrack.pt(), negtrack.itsChi2NCl()); - histos.fill(HIST(SubDir[part]) + HIST("h2f_neg_prong_xisqperclustertpc"), negtrack.pt(), negtrack.tpcChi2NCl()); histos.fill(HIST(SubDir[part]) + HIST("h2f_pos_prong_dcaXY_vs_pt"), postrack.pt(), postrack.dcaXY()); histos.fill(HIST(SubDir[part]) + HIST("h2f_neg_prong_dcaXY_vs_pt"), negtrack.pt(), negtrack.dcaXY()); @@ -1001,26 +965,6 @@ struct LambdaTableProducer { histos.fill(HIST(SubDirRG[rg]) + HIST(SubDirPart[part]) + HIST("hPhi"), phi); } - 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()); - } - } - } - // Reconstructed Level Tables template void fillLambdaRecoTables(C const& collision, V const& v0tracks, T const& tracks) @@ -1035,10 +979,8 @@ 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()); // Fill Collision Table lambdaCollisionTable(cent, mult, collision.posX(), collision.posY(), collision.posZ()); @@ -1048,16 +990,11 @@ struct LambdaTableProducer { PrmScdType v0PrmScdType = kPrimary; float mass = 0., corr_fact = 1.; - // Loop over V0s for (auto const& v0 : v0tracks) { - // daugthers - auto postrack = v0.template posTrack_as(); - auto negtrack = v0.template negTrack_as(); - // check for corresponding MCGen Particle if constexpr (dmc == kMC) { histos.fill(HIST("Tracks/h1f_tracks_info"), kTracksBeforeHasMcParticle); - if (!v0.has_mcParticle() || !postrack.has_mcParticle() || !negtrack.has_mcParticle()) { // check corresponding MC particle + if (!v0.has_mcParticle()) { continue; } } @@ -1075,7 +1012,7 @@ struct LambdaTableProducer { continue; } - // We have v0 as lambda + // we have v0 as lambda histos.fill(HIST("Tracks/h1f_tracks_info"), kAllSelPassed); // Remove lambda with ambiguous daughters (Only for run3) @@ -1087,6 +1024,10 @@ struct LambdaTableProducer { // Get Lambda mass and kinematic variables mass = (v0Type == kLambda) ? v0.mLambda() : v0.mAntiLambda(); + pt = v0.pt(); + eta = v0.eta(); + rap = v0.yLambda(); + phi = v0.phi(); // do MC analysis if constexpr (dmc == kMC) { @@ -1103,16 +1044,31 @@ struct LambdaTableProducer { } // get mothers information - fillLambdaMothers(v0, tracks, v0PrmScdType); + if (v0PrmScdType == kSecondary) { + fillLambdaMothers(v0, tracks); + } histos.fill(HIST("Tracks/h1f_tracks_info"), kPassTrueLambdaSel); histos.fill(HIST("Tracks/h2f_tracks_pid_after_sel"), v0.mcParticle().pdgCode(), v0.pt()); + + if (cRecoMomResoFlag) { + auto mc = v0.template mcParticle_as(); + pt = mc.pt(); + eta = mc.eta(); + rap = mc.y(); + phi = mc.phi(); + float y = (cDoEtaAnalysis) ? eta : rap; + // apply kinematic selection (On Truth) + if (!kinCutSelection(pt, std::abs(y), cMinV0Pt, cMaxV0Pt, cMaxV0Rap)) { + continue; + } + } } histos.fill(HIST("Tracks/h2f_armpod_after_sel"), v0.alpha(), v0.qtarm()); // get correction factors - corr_fact = (v0Type == kLambda) ? getCorrectionFactors(v0, tracks) : getCorrectionFactors(v0, tracks); + corr_fact = (v0Type == kLambda) ? getCorrectionFactors(v0) : getCorrectionFactors(v0); // fill lambda qa if (v0Type == kLambda) { @@ -1127,8 +1083,7 @@ struct LambdaTableProducer { // Fill Lambda/AntiLambda Table lambdaTrackTable(lambdaCollisionTable.lastIndex(), v0.px(), v0.py(), v0.pz(), - v0.pt(), v0.eta(), v0.phi(), v0.yLambda(), mass, - v0.template posTrack_as().index(), v0.template negTrack_as().index(), + pt, eta, phi, rap, mass, v0.template posTrack_as().index(), v0.template negTrack_as().index(), v0.v0cosPA(), v0.dcaV0daughters(), (int8_t)v0Type, v0PrmScdType, corr_fact); } } @@ -1145,7 +1100,6 @@ struct LambdaTableProducer { PrmScdType v0PrmScdType = kPrimary; float rap = 0.; - // Loop over MC particles for (auto const& mcpart : mcParticles) { // check for Lambda first if (mcpart.pdgCode() == kLambda0) { @@ -1266,28 +1220,23 @@ struct LambdaTableProducer { fillLambdaMcGenTables(mcCollision, mcParticles); } - // Collision, tracks and V0s - using CollisionsRun3 = soa::Join; - using CollisionsRun2 = soa::Join; - using Tracks = soa::Join; - using TracksRun2 = soa::Join; - using TracksMC = soa::Join; - using TracksMCRun2 = soa::Join; - using McV0Tracks = soa::Join; - SliceCache cache; Preslice> perCollision = aod::v0data::collisionId; - void processDummy(CollisionsRun3::iterator const&) {} - - PROCESS_SWITCH(LambdaTableProducer, processDummy, "Dummy Process", true); + using CollisionsRun3 = soa::Join; + using CollisionsRun2 = soa::Join; + using Tracks = soa::Join; + using TracksRun2 = soa::Join; + using TracksMC = soa::Join; + using TracksMCRun2 = soa::Join; + using McV0Tracks = soa::Join; void processDataRun3(CollisionsRun3::iterator const& collision, aod::V0Datas const& V0s, Tracks const& tracks) { fillLambdaRecoTables(collision, V0s, tracks); } - PROCESS_SWITCH(LambdaTableProducer, processDataRun3, "Process for Run3 DATA", false); + PROCESS_SWITCH(LambdaTableProducer, processDataRun3, "Process for Run3 DATA", true); void processDataRun2(CollisionsRun2::iterator const& collision, aod::V0Datas const& V0s, TracksRun2 const& tracks) { @@ -1296,18 +1245,6 @@ struct LambdaTableProducer { PROCESS_SWITCH(LambdaTableProducer, processDataRun2, "Process for Run2 DATA", false); - void processMatchEffData(CollisionsRun3::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 processMCRecoRun3(soa::Join::iterator const& collision, aod::McCollisions const&, McV0Tracks const& V0s, TracksMC const& tracks, aod::McParticles const&) { @@ -1332,18 +1269,6 @@ struct LambdaTableProducer { PROCESS_SWITCH(LambdaTableProducer, processMCRecoRun2, "Process for Run2 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 processMCRun3(aod::McCollisions::iterator const& mcCollision, soa::SmallGroups> const& collisions, McV0Tracks const& V0s, TracksMC const& tracks, @@ -1427,12 +1352,9 @@ struct LambdaTracksExtProducer { } } - void processDummy(aod::LambdaCollisions::iterator const&) {} - - PROCESS_SWITCH(LambdaTracksExtProducer, processDummy, "Dummy Process", true); - - void processLambdaTrackExt(aod::LambdaCollisions::iterator const&, aod::LambdaTracks const& tracks) + void process(aod::LambdaCollisions::iterator const&, aod::LambdaTracks const& tracks) { + int nTotLambda = 0, nTotAntiLambda = 0, nSelLambda = 0, nSelAntiLambda = 0; for (auto const& lambda : tracks) { @@ -1529,8 +1451,6 @@ struct LambdaTracksExtProducer { histos.fill(HIST("h1i_antilambda_mult"), nSelAntiLambda); } } - - PROCESS_SWITCH(LambdaTracksExtProducer, processLambdaTrackExt, "Process for lambda track extension", false); }; struct LambdaR2Correlation { @@ -1550,7 +1470,7 @@ struct LambdaR2Correlation { Configurable cDoEtaAnalysis{"cDoEtaAnalysis", false, "Eta/Rap Analysis Flag"}; // Centrality Axis - ConfigurableAxis cCentBins{"cCentBins", {VARIABLE_WIDTH, 0.0f, 10.0f, 20.0f, 50.f, 80.0f, 100.f}, "Variable Mult-Bins"}; + ConfigurableAxis cMultBins{"cMultBins", {VARIABLE_WIDTH, 0.0f, 10.0f, 30.0f, 50.f, 80.0f, 100.f}, "Variable Mult-Bins"}; // Histogram Registry. HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -1584,7 +1504,7 @@ struct LambdaR2Correlation { const AxisSpec axisCheck(1, 0, 1, ""); const AxisSpec axisPosZ(220, -11, 11, "V_{z} (cm)"); - const AxisSpec axisCent(cCentBins, "FT0C (%)"); + const AxisSpec axisCent(cMultBins, "FT0M (%)"); const AxisSpec axisChMult(200, 0, 200, "N_{ch}"); const AxisSpec axisMult(10, 0, 10, "N_{#Lambda}"); const AxisSpec axisMass(100, 1.06, 1.16, "M_{#Lambda} (GeV/#it{c}^{2})"); @@ -1599,14 +1519,16 @@ 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}); - histos.add("Event/Reco/h2f_lambda_mult", "#Lambda - Multiplicity", kTProfile, {axisCent}); - histos.add("Event/Reco/h2f_antilambda_mult", "#bar{#Lambda} - Multiplicity", kTProfile, {axisCent}); + histos.add("Event/Reco/h2f_Mult_vs_Centrality", "N_{ch} vs FT0M(%)", kTH2F, {axisCent, axisChMult}); + histos.add("Event/Reco/h2f_lambda_mult", "#Lambda - Multiplicity", kTH2F, {axisCent, axisMult}); + histos.add("Event/Reco/h2f_antilambda_mult", "#bar{#Lambda} - Multiplicity", kTH2F, {axisCent, axisMult}); // Efficiency Histograms // Single Particle Efficiencies histos.add("Reco/Primary/Efficiency/h2f_n1_centpt_LaP", "#rho_{1}^{#Lambda}", kTH2F, {axisCent, axisPt}); histos.add("Reco/Primary/Efficiency/h2f_n1_centpt_LaM", "#rho_{1}^{#bar{#Lambda}}", kTH2F, {axisCent, axisPt}); + histos.add("Reco/Primary/Efficiency/h3f_n1_centpteta_LaP", "#rho_{1}^{#Lambda}", kTH3F, {axisCent, axisPt, axisEta}); + histos.add("Reco/Primary/Efficiency/h3f_n1_centpteta_LaM", "#rho_{1}^{#bar{#Lambda}}", kTH3F, {axisCent, axisPt, axisEta}); histos.add("Reco/Primary/Efficiency/h3f_n1_centptrap_LaP", "#rho_{1}^{#Lambda}", kTH3F, {axisCent, axisPt, axisRap}); histos.add("Reco/Primary/Efficiency/h3f_n1_centptrap_LaM", "#rho_{1}^{#bar{#Lambda}}", kTH3F, {axisCent, axisPt, axisRap}); @@ -1614,16 +1536,22 @@ struct LambdaR2Correlation { // 1D Histograms histos.add("Reco/Primary/h3f_n1_centmasspt_LaP", "#rho_{1}^{#Lambda}", kTH3F, {axisCent, axisMass, axisPt}); histos.add("Reco/Primary/h3f_n1_centmasspt_LaM", "#rho_{1}^{#bar{#Lambda}}", kTH3F, {axisCent, axisMass, axisPt}); - histos.add("Reco/Primary/h4f_n1_ptrapphi_LaP", "#rho_{1}^{#Lambda}", kTHnSparseF, {axisCent, axisPt, axisRap, axisPhi}); - histos.add("Reco/Primary/h4f_n1_ptrapphi_LaM", "#rho_{1}^{#bar{#Lambda}}", kTHnSparseF, {axisCent, axisPt, axisRap, axisPhi}); + histos.add("Reco/Primary/h2f_n1_pt_LaP", "#rho_{1}^{#Lambda}", kTH2F, {axisCent, axisPt}); + histos.add("Reco/Primary/h2f_n1_pt_LaM", "#rho_{1}^{#bar{#Lambda}}", kTH2F, {axisCent, axisPt}); + histos.add("Reco/Primary/h2f_n1_eta_LaP", "#rho_{1}^{#Lambda}", kTH2F, {axisCent, axisEta}); + histos.add("Reco/Primary/h2f_n1_eta_LaM", "#rho_{1}^{#bar{#Lambda}}", kTH2F, {axisCent, axisEta}); + histos.add("Reco/Primary/h2f_n1_rap_LaP", "#rho_{1}^{#Lambda}", kTH2F, {axisCent, axisRap}); + histos.add("Reco/Primary/h2f_n1_rap_LaM", "#rho_{1}^{#bar{#Lambda}}", kTH2F, {axisCent, axisRap}); + histos.add("Reco/Primary/h2f_n1_phi_LaP", "#rho_{1}^{#Lambda}", kTH2F, {axisCent, axisPhi}); + histos.add("Reco/Primary/h2f_n1_phi_LaM", "#rho_{1}^{#bar{#Lambda}}", kTH2F, {axisCent, axisPhi}); // rho1 for R2 RapPhi histos.add("Reco/Primary/h3f_n1_rapphi_LaP", "#rho_{1}^{#Lambda}", kTH3F, {axisCent, axisRap, axisPhi}); histos.add("Reco/Primary/h3f_n1_rapphi_LaM", "#rho_{1}^{#bar{#Lambda}}", kTH3F, {axisCent, axisRap, axisPhi}); // rho1 for Q_{inv} - histos.add("Reco/Primary/h3f_n1_ptrapphi_LaP", "#rho_{1}^{#Lambda}", kTH3F, {axisCent, axisPt, axisRapPhi}); - histos.add("Reco/Primary/h3f_n1_ptrapphi_LaM", "#rho_{1}^{#bar{#Lambda}}", kTH3F, {axisCent, axisPt, axisRapPhi}); + histos.add("Reco/Primary/h3f_n1_pteta_LaP", "#rho_{1}^{#Lambda}", kTH3F, {axisCent, axisPt, axisEta}); + histos.add("Reco/Primary/h3f_n1_pteta_LaM", "#rho_{1}^{#bar{#Lambda}}", kTH3F, {axisCent, axisPt, axisEta}); // Clone Singles Primary/Secondary Histogram if (cAnaSecondaries) { @@ -1645,9 +1573,9 @@ struct LambdaR2Correlation { histos.add("Reco/PP/h3f_n2_rapphi_LaM_LaM", "#rho_{2}^{#bar{#Lambda}#bar{#Lambda}}", kTH3F, {axisCent, axisRapPhi, axisRapPhi}); // rho2 for R2 Qinv - histos.add("Reco/PP/h3f_n2_qinv_LaP_LaM", "#rho_{2}^{#Lambda#bar{#Lambda}}", kTHnSparseF, {axisCent, axisPt, axisRapPhi, axisQinv}); - histos.add("Reco/PP/h3f_n2_qinv_LaP_LaP", "#rho_{2}^{#Lambda#Lambda}", kTHnSparseF, {axisCent, axisPt, axisRapPhi, axisQinv}); - histos.add("Reco/PP/h3f_n2_qinv_LaM_LaM", "#rho_{2}^{#bar{#Lambda}#bar{#Lambda}}", kTHnSparseF, {axisCent, axisPt, axisRapPhi, axisQinv}); + histos.add("Reco/PP/h2f_n2_qinv_LaP_LaM", "#rho_{2}^{#Lambda#bar{#Lambda}}", kTH2F, {axisCent, axisQinv}); + histos.add("Reco/PP/h2f_n2_qinv_LaP_LaP", "#rho_{2}^{#Lambda#Lambda}", kTH2F, {axisCent, axisQinv}); + histos.add("Reco/PP/h2f_n2_qinv_LaM_LaM", "#rho_{2}^{#bar{#Lambda}#bar{#Lambda}}", kTH2F, {axisCent, axisQinv}); // Clone Pairs Histograms if (cAnaSecondaryPairs) { @@ -1664,21 +1592,6 @@ struct LambdaR2Correlation { } } - // Rap-Phi Bin Index - int getRapPhiBin(float const& rap, float const& phi) - { - int rapbin = static_cast((rap - kminrap) / rapbinwidth); - int phibin = static_cast(phi / phibinwidth); - - int rapphibin = -99; - if (rapbin >= 0 && phibin >= 0 && rapbin < nrapbins && phibin < nphibins) { - rapphibin = rapbin * nphibins + phibin; - return rapphibin; - } - - return rapphibin; - } - template void fillPairHistos(U& p1, U& p2) { @@ -1713,7 +1626,7 @@ struct LambdaR2Correlation { q = RecoDecay::p((p1.px() - p2.px()), (p1.py() - p2.py()), (p1.pz() - p2.pz())); e = RecoDecay::e(p1.px(), p1.py(), p1.pz(), MassLambda0) - RecoDecay::e(p2.px(), p2.py(), p2.pz(), MassLambda0); qinv = std::sqrt(-RecoDecay::m2(q, e)); - histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST(SubDirPrmScd[psp]) + HIST("h3f_n2_qinv_") + HIST(SubDirHist[part_pair]), cent, p1.pt(), getRapPhiBin(p1.rap(), p1.phi()), qinv, corfac); + histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST(SubDirPrmScd[psp]) + HIST("h2f_n2_qinv_") + HIST(SubDirHist[part_pair]), cent, qinv, corfac); } template @@ -1731,17 +1644,21 @@ struct LambdaR2Correlation { // Efficiency Plots histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST(SubDirPrmScd[pst]) + HIST("Efficiency/h2f_n1_centpt_") + HIST(SubDirHist[part]), cent, track.pt()); + histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST(SubDirPrmScd[pst]) + HIST("Efficiency/h3f_n1_centpteta_") + HIST(SubDirHist[part]), cent, track.pt(), track.eta()); histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST(SubDirPrmScd[pst]) + HIST("Efficiency/h3f_n1_centptrap_") + HIST(SubDirHist[part]), cent, track.pt(), track.rap()); // QA Plots histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST(SubDirPrmScd[pst]) + HIST("h3f_n1_centmasspt_") + HIST(SubDirHist[part]), cent, track.mass(), track.pt()); - histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST(SubDirPrmScd[pst]) + HIST("h4f_n1_ptrapphi_") + HIST(SubDirHist[part]), cent, track.pt(), track.rap(), track.phi(), track.corrFact()); + histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST(SubDirPrmScd[pst]) + HIST("h2f_n1_pt_") + HIST(SubDirHist[part]), cent, track.pt(), track.corrFact()); + histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST(SubDirPrmScd[pst]) + HIST("h2f_n1_eta_") + HIST(SubDirHist[part]), cent, track.eta(), track.corrFact()); + histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST(SubDirPrmScd[pst]) + HIST("h2f_n1_phi_") + HIST(SubDirHist[part]), cent, track.phi(), track.corrFact()); + histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST(SubDirPrmScd[pst]) + HIST("h2f_n1_rap_") + HIST(SubDirHist[part]), cent, track.rap(), track.corrFact()); // Rho1 for N1RapPhi histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST(SubDirPrmScd[pst]) + HIST("h3f_n1_rapphi_") + HIST(SubDirHist[part]), cent, track.rap(), track.phi(), track.corrFact()); - // Rho1 for Q_{inv} - histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST(SubDirPrmScd[pst]) + HIST("h3f_n1_ptrapphi_") + HIST(SubDirHist[part]), cent, track.pt(), getRapPhiBin(track.rap(), track.phi()), track.corrFact()); + // Rho1 for Q_{inv} Bkg Estimation + histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST(SubDirPrmScd[pst]) + HIST("h3f_n1_pteta_") + HIST(SubDirHist[part]), cent, track.pt(), track.eta(), track.corrFact()); } // fill multiplicity histograms @@ -1777,10 +1694,6 @@ struct LambdaR2Correlation { Partition partSecdLambdaTracks = (aod::lambdatrack::v0Type == (int8_t)kLambda) && (aod::lambdatrackext::trueLambdaFlag == true) && (aod::lambdatrack::v0PrmScd == (int8_t)kSecondary); Partition partSecdAntiLambdaTracks = (aod::lambdatrack::v0Type == (int8_t)kAntiLambda) && (aod::lambdatrackext::trueLambdaFlag == true) && (aod::lambdatrack::v0PrmScd == (int8_t)kSecondary); - void processDummy(aod::LambdaCollisions::iterator const&) {} - - PROCESS_SWITCH(LambdaR2Correlation, processDummy, "Dummy Process", true); - void processDataReco(LambdaCollisions::iterator const& collision, LambdaTracks const&) { histos.fill(HIST("Event/Reco/h1f_collision_posz"), collision.posZ()); @@ -1823,7 +1736,7 @@ struct LambdaR2Correlation { } } - PROCESS_SWITCH(LambdaR2Correlation, processDataReco, "Process for Data and MCReco", false); + PROCESS_SWITCH(LambdaR2Correlation, processDataReco, "Process for Data and MCReco", true); using LambdaMcGenCollisions = aod::LambdaMcGenCollisions; using LambdaMcGenTracks = aod::LambdaMcGenTracks; From ff80ec5dde391195c101321029f4209d8fc69ecf Mon Sep 17 00:00:00 2001 From: Yash Patley <52608802+yashpatley@users.noreply.github.com> Date: Fri, 24 Apr 2026 18:31:59 +0200 Subject: [PATCH 2/2] Update lambdaR2Correlation.cxx --- .../Tasks/lambdaR2Correlation.cxx | 417 +++++++++--------- 1 file changed, 212 insertions(+), 205 deletions(-) diff --git a/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx b/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx index 814899e0261..38a3a686991 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx @@ -20,7 +20,7 @@ #include "Common/DataModel/CollisionAssociationTables.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/PIDResponseTPC.h" #include "CCDB/BasicCCDBManager.h" #include "CommonConstants/PhysicsConstants.h" @@ -28,8 +28,7 @@ #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" -#include "TPDGCode.h" - +#include #include #include @@ -138,7 +137,6 @@ DECLARE_SOA_TABLE(LambdaMcGenTracks, "AOD", "LMCGENTRACKS", o2::soa::Index<>, lambdatrack::V0PrmScd, lambdatrack::CorrFact); using LambdaMcGenTrack = LambdaMcGenTracks::iterator; - } // namespace o2::aod enum CollisionLabels { @@ -178,12 +176,7 @@ enum TrackLabels { enum CentEstType { kCentFT0M = 0, - kCentFV0A -}; - -enum RunType { - kRun3 = 0, - kRun2 + kCentFT0C }; enum ParticleType { @@ -231,21 +224,22 @@ enum PrmScdPairType { }; struct LambdaTableProducer { - + // Table Producers Produces lambdaCollisionTable; Produces lambdaTrackTable; Produces lambdaMCGenCollisionTable; Produces lambdaMCGenTrackTable; + // Centrality Axis + ConfigurableAxis cCentBins{"cCentBins", {VARIABLE_WIDTH, 0.0f, 10.0f, 20.0f, 50.f, 80.0f, 100.f}, "Variable Centrality Bins"}; + // Collisions - Configurable cCentEstimator{"cCentEstimator", 0, "Centrality Estimator : 0-FT0M, 1-FV0A"}; - Configurable cMinZVtx{"cMinZVtx", -10.0, "Min VtxZ cut"}; - Configurable cMaxZVtx{"cMaxZVtx", 10.0, "Max VtxZ cut"}; - Configurable cMinMult{"cMinMult", 0., "Minumum Multiplicity"}; - Configurable cMaxMult{"cMaxMult", 100.0, "Maximum Multiplicity"}; + Configurable cCentEstimator{"cCentEstimator", 1, "Centrality Estimator : 0-FT0M, 1-FT0C"}; + Configurable cMinZVtx{"cMinZVtx", -7.0, "Min VtxZ cut"}; + Configurable cMaxZVtx{"cMaxZVtx", 7.0, "Max VtxZ cut"}; + Configurable cMinCent{"cMinCent", 0., "Minumum Centrality"}; + Configurable cMaxCent{"cMaxCent", 100.0, "Maximum Centrality"}; Configurable cSel8Trig{"cSel8Trig", true, "Sel8 (T0A + T0C) Selection Run3"}; - Configurable cInt7Trig{"cInt7Trig", false, "kINT7 MB Trigger"}; - Configurable cSel7Trig{"cSel7Trig", false, "Sel7 (V0A + V0C) Selection Run2"}; Configurable cTriggerTvxSel{"cTriggerTvxSel", false, "Trigger Time and Vertex Selection"}; Configurable cTFBorder{"cTFBorder", false, "Timeframe Border Selection"}; Configurable cNoItsROBorder{"cNoItsROBorder", false, "No ITSRO Border Cut"}; @@ -255,13 +249,10 @@ struct LambdaTableProducer { Configurable cIsGoodITSLayers{"cIsGoodITSLayers", false, "Good ITS Layers All"}; // Tracks - Configurable cTrackMinPt{"cTrackMinPt", 0.15, "p_{T} minimum"}; + Configurable cTrackMinPt{"cTrackMinPt", 0.1, "p_{T} minimum"}; Configurable cTrackMaxPt{"cTrackMaxPt", 999.0, "p_{T} maximum"}; Configurable cTrackEtaCut{"cTrackEtaCut", 0.8, "Pseudorapidity cut"}; Configurable cMinTpcCrossedRows{"cMinTpcCrossedRows", 70, "TPC Min Crossed Rows"}; - Configurable cMinTpcCROverCls{"cMinTpcCROverCls", 0.8, "Tpc Min Crossed Rows Over Findable Clusters"}; - Configurable cMaxTpcSharedClusters{"cMaxTpcSharedClusters", 0.4, "Tpc Max Shared Clusters"}; - Configurable cMaxChi2Tpc{"cMaxChi2Tpc", 4, "Max Chi2 Tpc"}; Configurable cTpcNsigmaCut{"cTpcNsigmaCut", 3.0, "TPC NSigma Selection Cut"}; Configurable cRemoveAmbiguousTracks{"cRemoveAmbiguousTracks", false, "Remove Ambiguous Tracks"}; @@ -281,35 +272,32 @@ struct LambdaTableProducer { Configurable cKshortRejFlag{"cKshortRejFlag", true, "K0short Mass Rej Flag"}; // V0s kinmatic acceptance - Configurable cMinV0Mass{"cMinV0Mass", 1.10, "V0 Mass Min"}; - Configurable cMaxV0Mass{"cMaxV0Mass", 1.12, "V0 Mass Min"}; - Configurable cMinV0Pt{"cMinV0Pt", 0.8, "Minimum V0 pT"}; - Configurable cMaxV0Pt{"cMaxV0Pt", 4.2, "Minimum V0 pT"}; + Configurable cV0MassWindow{"cV0MassWindow", 0.007, "V0 Mass Window"}; + Configurable cMinV0Pt{"cMinV0Pt", 0.6, "Minimum V0 pT"}; + Configurable cMaxV0Pt{"cMaxV0Pt", 3.6, "Minimum V0 pT"}; Configurable cMaxV0Rap{"cMaxV0Rap", 0.5, "|rap| cut"}; Configurable cDoEtaAnalysis{"cDoEtaAnalysis", false, "Do Eta Analysis"}; - Configurable cV0TypeSelFlag{"cV0TypeSelFlag", false, "V0 Type Selection Flag"}; + Configurable cV0TypeSelFlag{"cV0TypeSelFlag", true, "V0 Type Selection Flag"}; Configurable cV0TypeSelection{"cV0TypeSelection", 1, "V0 Type Selection"}; // V0s MC - Configurable cHasMcFlag{"cHasMcFlag", true, "Has Mc Tag"}; - Configurable cSelectTrueLambda{"cSelectTrueLambda", true, "Select True Lambda"}; - Configurable cSelMCPSV0{"cSelMCPSV0", true, "Select Primary/Secondary V0"}; + Configurable cSelectTrueLambda{"cSelectTrueLambda", false, "Select True Lambda"}; + Configurable cSelMCPSV0{"cSelMCPSV0", false, "Select Primary/Secondary V0"}; Configurable cCheckRecoDauFlag{"cCheckRecoDauFlag", true, "Check for reco daughter PID"}; - Configurable cGenPrimaryLambda{"cGenPrimaryLambda", true, "Primary Generated Lambda"}; - Configurable cGenSecondaryLambda{"cGenSecondaryLambda", false, "Secondary Generated Lambda"}; Configurable cGenDecayChannel{"cGenDecayChannel", true, "Gen Level Decay Channel Flag"}; - Configurable cRecoMomResoFlag{"cRecoMomResoFlag", false, "Check effect of momentum space smearing on balance function"}; // Efficiency Correction Configurable cCorrectionFlag{"cCorrectionFlag", false, "Correction Flag"}; Configurable cGetEffFact{"cGetEffFact", false, "Get Efficiency Factor Flag"}; Configurable cGetPrimFrac{"cGetPrimFrac", false, "Get Primary Fraction Flag"}; + Configurable cGetMatchEff{"cGetMatchEff", false, "Get Matching Efficiency Flag"}; Configurable cCorrFactHist{"cCorrFactHist", 0, "Efficiency Factor Histogram"}; Configurable cPrimFracHist{"cPrimFracHist", 0, "Primary Fraction Histogram"}; // CCDB - Configurable cUrlCCDB{"cUrlCCDB", "http://ccdb-test.cern.ch:8080", "url of ccdb"}; - Configurable cPathCCDB{"cPathCCDB", "Users/y/ypatley/lambda_corr_fact", "Path for ccdb-object"}; + Configurable cUrlCCDB{"cUrlCCDB", "http://alice-ccdb.cern.ch", "ALICE CCDB URL"}; + Configurable cPathCCDB{"cPathCCDB", "Users/y/ypatley/LHC22oPass7/LambdaCorrectionFactor", "Path for ccdb-object"}; + Configurable cPathCCDBMatchEff{"cPathCCDBMatchEff", "Users/y/ypatley/LHC22oPass7/ITSTPCMatchEff", "Path for ccdb-object for matching efficiency"}; // Initialize CCDB Service Service ccdb; @@ -329,7 +317,7 @@ struct LambdaTableProducer { // Initialize Global Variables float cent = 0., mult = 0.; - float pt = 0., eta = 0., rap = 0., phi = 0.; + TList *ccdbObjRecoEff, *ccdbObjMatchEff; void init(InitContext const&) { @@ -340,7 +328,9 @@ struct LambdaTableProducer { // initialize axis specifications const AxisSpec axisCols(5, 0.5, 5.5, ""); const AxisSpec axisTrks(30, 0.5, 30.5, ""); - const AxisSpec axisCent(100, 0, 100, "FT0M (%)"); + const AxisSpec axisCent(100, 0, 100, "Centrality(%)"); + const AxisSpec axisVarCent(cCentBins, "FT0C%"); + const AxisSpec axisPVMults(1000, 0, 1000, "N_{PV}"); const AxisSpec axisMult(10, 0, 10, "N_{#Lambda}"); const AxisSpec axisVz(220, -11, 11, "V_{z} (cm)"); const AxisSpec axisPID(8000, -4000, 4000, "PdgCode"); @@ -361,6 +351,7 @@ struct LambdaTableProducer { const AxisSpec axisAlpha(40, -1, 1, "#alpha"); const AxisSpec axisQtarm(40, 0, 0.4, "q_{T}"); + const AxisSpec axisITSTPCTrackPt(100, 0, 10, "p_{T} (GeV/#it{c})"); const AxisSpec axisTrackPt(40, 0, 4, "p_{T} (GeV/#it{c})"); const AxisSpec axisTrackDCA(200, -1, 1, "dca_{XY} (cm)"); const AxisSpec axisMomPID(80, 0, 4, "p (GeV/#it{c})"); @@ -371,6 +362,7 @@ 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}); // QA histos.add("Tracks/h1f_tracks_info", "# of tracks", kTH1F, {axisTrks}); @@ -378,6 +370,8 @@ struct LambdaTableProducer { histos.add("Tracks/h2f_armpod_after_sel", "Armentros-Podolanski Plot", kTH2F, {axisAlpha, axisQtarm}); histos.add("Tracks/h1f_lambda_pt_vs_invm", "p_{T} vs M_{#Lambda}", kTH2F, {axisV0Mass, axisV0Pt}); histos.add("Tracks/h1f_antilambda_pt_vs_invm", "p_{T} vs M_{#bar{#Lambda}}", kTH2F, {axisV0Mass, axisV0Pt}); + histos.add("Tracks/h2f_itstrack_centpt", "h2f_itstrack_centpt", kTH2F, {axisVarCent, axisITSTPCTrackPt}); + histos.add("Tracks/h2f_itstpctrack_centpt", "h2f_itstpctrack_centpt", kTH2F, {axisVarCent, axisITSTPCTrackPt}); // QA Lambda histos.add("QA/Lambda/h2f_qt_vs_alpha", "Armentros-Podolanski Plot", kTH2F, {axisAlpha, axisQtarm}); @@ -396,6 +390,10 @@ struct LambdaTableProducer { histos.add("QA/Lambda/h1f_neg_prong_eta", "Neg-Prong #eta-distribution", kTH1F, {axisV0Eta}); histos.add("QA/Lambda/h1f_pos_prong_phi", "Pos-Prong #phi-distribution", kTH1F, {axisV0Phi}); histos.add("QA/Lambda/h1f_neg_prong_phi", "Neg-Prong #phi-distribution", kTH1F, {axisV0Phi}); + histos.add("QA/Lambda/h2f_pos_prong_xisqperclustertpc", "#chi^{2}/cluster TPC", kTH2F, {axisTrackPt, {200, 0, 50}}); + histos.add("QA/Lambda/h2f_pos_prong_xisqperclusterits", "#chi^{2}/cluster ITS", kTH2F, {axisTrackPt, {200, 0, 50}}); + histos.add("QA/Lambda/h2f_neg_prong_xisqperclustertpc", "#chi^{2}/cluster TPC", kTH2F, {axisTrackPt, {200, 0, 50}}); + histos.add("QA/Lambda/h2f_neg_prong_xisqperclusterits", "#chi^{2}/cluster ITS", kTH2F, {axisTrackPt, {200, 0, 50}}); histos.add("QA/Lambda/h2f_pos_prong_dcaXY_vs_pt", "DCA vs p_{T}", kTH2F, {axisTrackPt, axisTrackDCA}); histos.add("QA/Lambda/h2f_neg_prong_dcaXY_vs_pt", "DCA vs p_{T}", kTH2F, {axisTrackPt, axisTrackDCA}); @@ -417,11 +415,12 @@ struct LambdaTableProducer { histos.addClone("McRec/Lambda/", "McRec/AntiLambda/"); // MC Generated Histograms - if (doprocessMCRun3 || doprocessMCRun2 || doprocessMCRecoRun3 || doprocessMCRecoRun2) { + if (doprocessMCRecoGen || doprocessMCReco) { // McReco Histos histos.add("Tracks/h2f_tracks_pid_before_sel", "PIDs", kTH2F, {axisPID, axisV0Pt}); histos.add("Tracks/h2f_tracks_pid_after_sel", "PIDs", kTH2F, {axisPID, axisV0Pt}); - histos.add("Tracks/h2f_lambda_mothers_pdg", "PIDs", kTH2F, {axisPID, axisV0Pt}); + histos.add("Tracks/h2f_primary_lambda_mothers_pdg", "PIDs", kTH2F, {axisPID, axisV0Pt}); + histos.add("Tracks/h2f_secondary_lambda_mothers_pdg", "PIDs", kTH2F, {axisPID, axisV0Pt}); // McGen Histos histos.add("McGen/h1f_collision_recgen", "# of Reco Collision Associated to One Mc Generator Collision", kTH1F, {axisMult}); @@ -479,35 +478,25 @@ struct LambdaTableProducer { histos.get(HIST("Tracks/h1f_tracks_info"))->GetXaxis()->SetBinLabel(TrackLabels::kNoPFCorr, "kNoPFCorr"); } - template + template bool selCollision(C const& col) { - // VtxZ Selection + // Vz Selection if (col.posZ() <= cMinZVtx || col.posZ() >= cMaxZVtx) { return false; } - if constexpr (run == kRun3) { // Run3 Min-Bias Trigger - // select centrality estimator - if (cCentEstimator == kCentFT0M) { - cent = col.centFT0M(); - } else if (cCentEstimator == kCentFV0A) { - cent = col.centFV0A(); - } - if (cSel8Trig && !col.sel8()) { - return false; - } - } else { // Run2 Min-Bias Trigger - cent = col.centRun2V0M(); - if (cInt7Trig && !col.alias_bit(kINT7)) { - return false; - } - if (cSel7Trig && !col.sel7()) { - return false; - } + // Run 3 Min-Bias Trigger + if (cSel8Trig && !col.sel8()) { + return false; + } + if (cCentEstimator == kCentFT0M) { + cent = col.centFT0M(); + } else if (cCentEstimator == kCentFT0C) { + cent = col.centFT0C(); } - if (cent <= cMinMult || cent >= cMaxMult) { // select centrality percentile class + if (cent <= cMinCent || cent >= cMaxCent) { // select centrality percentile class return false; } @@ -540,7 +529,7 @@ struct LambdaTableProducer { } // Set Multiplicity - mult = col.multNTracksPV(); + mult = col.multTPC(); return true; } @@ -567,18 +556,6 @@ struct LambdaTableProducer { return false; } - if (track.tpcCrossedRowsOverFindableCls() < cMinTpcCROverCls) { - return false; - } - - if (track.tpcNClsShared() > cMaxTpcSharedClusters) { - return false; - } - - if (track.tpcChi2NCl() > cMaxChi2Tpc) { - return false; - } - return true; } @@ -685,13 +662,13 @@ struct LambdaTableProducer { bool lambdaFlag = false, antiLambdaFlag = false; // get v0 track as lambda - if ((v0.mLambda() > cMinV0Mass && v0.mLambda() < cMaxV0Mass) && (selLambdaDauWithTpcPid(postrack, negtrack))) { + if ((std::abs(v0.mLambda() - MassLambda0) <= cV0MassWindow) && (selLambdaDauWithTpcPid(postrack, negtrack))) { lambdaFlag = true; v0type = kLambda; } // get v0 track as anti-lambda - if ((v0.mAntiLambda() > cMinV0Mass && v0.mAntiLambda() < cMaxV0Mass) && (selLambdaDauWithTpcPid(postrack, negtrack))) { + if (((std::abs(v0.mAntiLambda() - MassLambda0) <= cV0MassWindow)) && (selLambdaDauWithTpcPid(postrack, negtrack))) { antiLambdaFlag = true; v0type = kAntiLambda; } @@ -834,30 +811,16 @@ struct LambdaTableProducer { return true; } - template - float getCorrectionFactors(V const& v0) + template + float getCorrectionFactors(V const& v0, T const&) { - // Check for efficiency correction flag - if (!cCorrectionFlag) { - return 1.; - } - - // Get from CCDB - auto ccdbObj = ccdb->getForTimeStamp(cPathCCDB.value, -1); - - // Check CCDB Object - if (!ccdbObj) { - LOGF(warning, "CCDB OBJECT NOT FOUND"); - return 1.; - } - // initialize efficiency factor and primary fraction values - float effCorrFact = 1., primFrac = 1.; + float effCorrFact = 1., primFrac = 1., matchEffFact = 1.; float rap = (cDoEtaAnalysis) ? v0.eta() : v0.yLambda(); // Get Efficiency Factor if (cGetEffFact) { - TObject* objEff = reinterpret_cast(ccdbObj->FindObject(Form("%s", vCorrFactStrings[cCorrFactHist][part].c_str()))); + TObject* objEff = reinterpret_cast(ccdbObjRecoEff->FindObject(Form("%s", vCorrFactStrings[cCorrFactHist][part].c_str()))); TH1F* histEff = reinterpret_cast(objEff->Clone()); if (histEff->GetDimension() == TwoDimCorr) { histos.fill(HIST("Tracks/h1f_tracks_info"), kEffCorrPtCent); @@ -874,9 +837,8 @@ struct LambdaTableProducer { } // Get Primary Fraction - // (The dimension of this could be different than efficiency because of large errors !!!) if (cGetPrimFrac) { - TObject* objPrm = reinterpret_cast(ccdbObj->FindObject(Form("%s", vPrimFracStrings[cPrimFracHist][part].c_str()))); + TObject* objPrm = reinterpret_cast(ccdbObjRecoEff->FindObject(Form("%s", vPrimFracStrings[cPrimFracHist][part].c_str()))); TH1F* histPrm = reinterpret_cast(objPrm->Clone()); if (histPrm->GetDimension() == TwoDimCorr) { histos.fill(HIST("Tracks/h1f_tracks_info"), kPFCorrPtCent); @@ -892,15 +854,31 @@ struct LambdaTableProducer { delete histPrm; } - return primFrac * effCorrFact; + // Get Matching Efficiency Correction + if (cGetMatchEff) { + auto posTrack = v0.template posTrack_as(); + auto negTrack = v0.template negTrack_as(); + TObject* objMatchEff = reinterpret_cast(ccdbObjMatchEff->FindObject("hITSTPCMatchingEfficiency")); + TH1F* histMatchEff = reinterpret_cast(objMatchEff->Clone()); + float posTrackMatchEff = histMatchEff->GetBinContent(histMatchEff->FindBin(cent, posTrack.pt())); + float negTrackMatchEff = histMatchEff->GetBinContent(histMatchEff->FindBin(cent, negTrack.pt())); + matchEffFact = posTrackMatchEff * negTrackMatchEff; + delete histMatchEff; + } + + return primFrac * effCorrFact * matchEffFact; } template - void fillLambdaMothers(V const& v0, T const&) + void fillLambdaMothers(V const& v0, T const&, PrmScdType const& ps) { auto mcpart = v0.template mcParticle_as(); auto lambdaMothers = mcpart.template mothers_as(); - histos.fill(HIST("Tracks/h2f_lambda_mothers_pdg"), lambdaMothers[0].pdgCode(), v0.pt()); + if (ps == kPrimary) { + histos.fill(HIST("Tracks/h2f_primary_lambda_mothers_pdg"), lambdaMothers[0].pdgCode(), v0.pt()); + } else { + histos.fill(HIST("Tracks/h2f_secondary_lambda_mothers_pdg"), lambdaMothers[0].pdgCode(), v0.pt()); + } } template @@ -938,9 +916,13 @@ struct LambdaTableProducer { histos.fill(HIST(SubDir[part]) + HIST("h1f_pos_prong_pt"), postrack.pt()); histos.fill(HIST(SubDir[part]) + HIST("h1f_pos_prong_eta"), postrack.eta()); histos.fill(HIST(SubDir[part]) + HIST("h1f_pos_prong_phi"), postrack.phi()); + histos.fill(HIST(SubDir[part]) + HIST("h2f_pos_prong_xisqperclusterits"), postrack.pt(), postrack.itsChi2NCl()); + histos.fill(HIST(SubDir[part]) + HIST("h2f_pos_prong_xisqperclustertpc"), postrack.pt(), postrack.tpcChi2NCl()); histos.fill(HIST(SubDir[part]) + HIST("h1f_neg_prong_pt"), negtrack.pt()); histos.fill(HIST(SubDir[part]) + HIST("h1f_neg_prong_eta"), negtrack.eta()); histos.fill(HIST(SubDir[part]) + HIST("h1f_neg_prong_phi"), negtrack.phi()); + histos.fill(HIST(SubDir[part]) + HIST("h2f_neg_prong_xisqperclusterits"), negtrack.pt(), negtrack.itsChi2NCl()); + histos.fill(HIST(SubDir[part]) + HIST("h2f_neg_prong_xisqperclustertpc"), negtrack.pt(), negtrack.tpcChi2NCl()); histos.fill(HIST(SubDir[part]) + HIST("h2f_pos_prong_dcaXY_vs_pt"), postrack.pt(), postrack.dcaXY()); histos.fill(HIST(SubDir[part]) + HIST("h2f_neg_prong_dcaXY_vs_pt"), negtrack.pt(), negtrack.dcaXY()); @@ -965,22 +947,51 @@ struct LambdaTableProducer { histos.fill(HIST(SubDirRG[rg]) + HIST(SubDirPart[part]) + HIST("hPhi"), phi); } + 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()); + } + } + } + // Reconstructed Level Tables - template - void fillLambdaRecoTables(C const& collision, V const& v0tracks, T const& tracks) + template + void fillLambdaRecoTables(C const& collision, B const&, V const& v0tracks, T const& tracks) { // Total Collisions histos.fill(HIST("Events/h1f_collisions_info"), kTotCol); // Select Collision (Only for Data... McRec has been selected already !!!) if constexpr (dmc == kData) { - if (!selCollision(collision)) { + if (!selCollision(collision)) { return; } } + // 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()); + + // Get correction object from CCDB + if (cCorrectionFlag) { + auto bc = collision.template foundBC_as(); + ccdbObjRecoEff = ccdb->getForTimeStamp(cPathCCDB.value, bc.timestamp()); + ccdbObjMatchEff = ccdb->getForTimeStamp(cPathCCDBMatchEff.value, bc.timestamp()); + } // Fill Collision Table lambdaCollisionTable(cent, mult, collision.posX(), collision.posY(), collision.posZ()); @@ -990,11 +1001,16 @@ struct LambdaTableProducer { PrmScdType v0PrmScdType = kPrimary; float mass = 0., corr_fact = 1.; + // Loop over V0s for (auto const& v0 : v0tracks) { + // daugthers + auto postrack = v0.template posTrack_as(); + auto negtrack = v0.template negTrack_as(); + // check for corresponding MCGen Particle if constexpr (dmc == kMC) { histos.fill(HIST("Tracks/h1f_tracks_info"), kTracksBeforeHasMcParticle); - if (!v0.has_mcParticle()) { + if (!v0.has_mcParticle() || !postrack.has_mcParticle() || !negtrack.has_mcParticle()) { // check corresponding MC particle continue; } } @@ -1012,22 +1028,16 @@ struct LambdaTableProducer { continue; } - // we have v0 as lambda + // We have v0 as lambda histos.fill(HIST("Tracks/h1f_tracks_info"), kAllSelPassed); - // Remove lambda with ambiguous daughters (Only for run3) - if constexpr (run == kRun3) { - if (cRemoveAmbiguousTracks && hasAmbiguousDaughters(v0, tracks)) { - continue; - } + // Remove lambda with ambiguous daughters + if (cRemoveAmbiguousTracks && hasAmbiguousDaughters(v0, tracks)) { + continue; } // Get Lambda mass and kinematic variables mass = (v0Type == kLambda) ? v0.mLambda() : v0.mAntiLambda(); - pt = v0.pt(); - eta = v0.eta(); - rap = v0.yLambda(); - phi = v0.phi(); // do MC analysis if constexpr (dmc == kMC) { @@ -1044,31 +1054,16 @@ struct LambdaTableProducer { } // get mothers information - if (v0PrmScdType == kSecondary) { - fillLambdaMothers(v0, tracks); - } + fillLambdaMothers(v0, tracks, v0PrmScdType); histos.fill(HIST("Tracks/h1f_tracks_info"), kPassTrueLambdaSel); histos.fill(HIST("Tracks/h2f_tracks_pid_after_sel"), v0.mcParticle().pdgCode(), v0.pt()); - - if (cRecoMomResoFlag) { - auto mc = v0.template mcParticle_as(); - pt = mc.pt(); - eta = mc.eta(); - rap = mc.y(); - phi = mc.phi(); - float y = (cDoEtaAnalysis) ? eta : rap; - // apply kinematic selection (On Truth) - if (!kinCutSelection(pt, std::abs(y), cMinV0Pt, cMaxV0Pt, cMaxV0Rap)) { - continue; - } - } } histos.fill(HIST("Tracks/h2f_armpod_after_sel"), v0.alpha(), v0.qtarm()); // get correction factors - corr_fact = (v0Type == kLambda) ? getCorrectionFactors(v0) : getCorrectionFactors(v0); + corr_fact = (v0Type == kLambda) ? getCorrectionFactors(v0, tracks) : getCorrectionFactors(v0, tracks); // fill lambda qa if (v0Type == kLambda) { @@ -1083,13 +1078,14 @@ struct LambdaTableProducer { // Fill Lambda/AntiLambda Table lambdaTrackTable(lambdaCollisionTable.lastIndex(), v0.px(), v0.py(), v0.pz(), - pt, eta, phi, rap, mass, v0.template posTrack_as().index(), v0.template negTrack_as().index(), + v0.pt(), v0.eta(), v0.phi(), v0.yLambda(), mass, + v0.template posTrack_as().index(), v0.template negTrack_as().index(), v0.v0cosPA(), v0.dcaV0daughters(), (int8_t)v0Type, v0PrmScdType, corr_fact); } } // MC Generater Level Tables - template + template void fillLambdaMcGenTables(C const& mcCollision, M const& mcParticles) { // Fill McGen Collision Table @@ -1100,6 +1096,7 @@ struct LambdaTableProducer { PrmScdType v0PrmScdType = kPrimary; float rap = 0.; + // Loop over MC particles for (auto const& mcpart : mcParticles) { // check for Lambda first if (mcpart.pdgCode() == kLambda0) { @@ -1196,8 +1193,8 @@ struct LambdaTableProducer { } } - template - void analyzeMcRecoGen(M const& mcCollision, C const& collisions, V const& V0s, T const& tracks, P const& mcParticles) + template + void analyzeMcRecoGen(M const& mcCollision, C const& collisions, B const& bc, V const& V0s, T const& tracks, P const& mcParticles) { // Number of Rec Collisions Associated to the McGen Collision int nRecCols = collisions.size(); @@ -1210,84 +1207,82 @@ struct LambdaTableProducer { } histos.fill(HIST("McGen/h1f_collisions_info"), kTotCol); // Check the reco collision - if (!collisions.begin().has_mcCollision() || !selCollision(collisions.begin()) || collisions.begin().mcCollisionId() != mcCollision.globalIndex()) { + if (!collisions.begin().has_mcCollision() || !selCollision(collisions.begin()) || collisions.begin().mcCollisionId() != mcCollision.globalIndex()) { return; } histos.fill(HIST("McGen/h1f_collisions_info"), kPassSelCol); histos.fill(HIST("McGen/h2f_collision_posZ"), mcCollision.posZ(), collisions.begin().posZ()); auto v0Tracks = V0s.sliceBy(perCollision, collisions.begin().globalIndex()); - fillLambdaRecoTables(collisions.begin(), v0Tracks, tracks); - fillLambdaMcGenTables(mcCollision, mcParticles); + fillLambdaRecoTables(collisions.begin(), bc, v0Tracks, tracks); + fillLambdaMcGenTables(mcCollision, mcParticles); } - SliceCache cache; - Preslice> perCollision = aod::v0data::collisionId; - - using CollisionsRun3 = soa::Join; - using CollisionsRun2 = soa::Join; - using Tracks = soa::Join; - using TracksRun2 = soa::Join; + // BC, Collision, tracks and V0s + using BCsRun3 = soa::Join; + using Collisions = soa::Join; + using Tracks = soa::Join; using TracksMC = soa::Join; - using TracksMCRun2 = soa::Join; using McV0Tracks = soa::Join; - void processDataRun3(CollisionsRun3::iterator const& collision, aod::V0Datas const& V0s, Tracks const& tracks) - { - fillLambdaRecoTables(collision, V0s, tracks); - } + SliceCache cache; + Preslice> perCollision = aod::v0data::collisionId; + + void processDummy(Collisions::iterator const&) {} - PROCESS_SWITCH(LambdaTableProducer, processDataRun3, "Process for Run3 DATA", true); + PROCESS_SWITCH(LambdaTableProducer, processDummy, "Dummy Process", true); - void processDataRun2(CollisionsRun2::iterator const& collision, aod::V0Datas const& V0s, TracksRun2 const& tracks) + void processData(Collisions::iterator const& collision, BCsRun3 const& bc, aod::V0Datas const& V0s, Tracks const& tracks) { - fillLambdaRecoTables(collision, V0s, tracks); + fillLambdaRecoTables(collision, bc, V0s, tracks); } - PROCESS_SWITCH(LambdaTableProducer, processDataRun2, "Process for Run2 DATA", false); + PROCESS_SWITCH(LambdaTableProducer, processData, "Process for DATA", false); - void processMCRecoRun3(soa::Join::iterator const& collision, aod::McCollisions const&, - McV0Tracks const& V0s, TracksMC const& tracks, aod::McParticles const&) + void processMatchEffData(Collisions::iterator const& collision, Tracks const& tracks) { // check collision - if (!selCollision(collision)) { + if (!selCollision(collision)) { return; } - fillLambdaRecoTables(collision, V0s, tracks); + // Get Matching Efficiency + getMatchEffHist(tracks); } - PROCESS_SWITCH(LambdaTableProducer, processMCRecoRun3, "Process for Run3 McReco DATA", false); + PROCESS_SWITCH(LambdaTableProducer, processMatchEffData, "Process for Matching Efficieny Calculation", false); - void processMCRecoRun2(soa::Join::iterator const& collision, aod::McCollisions const&, - McV0Tracks const& V0s, TracksMCRun2 const& tracks, aod::McParticles const&) + void processMCReco(soa::Join::iterator const& collision, aod::McCollisions const&, BCsRun3 const& bc, + McV0Tracks const& V0s, TracksMC const& tracks, aod::McParticles const&) { // check collision - if (!selCollision(collision)) { + if (!selCollision(collision)) { return; } - fillLambdaRecoTables(collision, V0s, tracks); + fillLambdaRecoTables(collision, bc, V0s, tracks); } - PROCESS_SWITCH(LambdaTableProducer, processMCRecoRun2, "Process for Run2 McReco DATA", false); + PROCESS_SWITCH(LambdaTableProducer, processMCReco, "Process for McReco DATA", false); - void processMCRun3(aod::McCollisions::iterator const& mcCollision, - soa::SmallGroups> const& collisions, - McV0Tracks const& V0s, TracksMC const& tracks, - aod::McParticles const& mcParticles) + void processMatchEffMCReco(soa::Join::iterator const& collision, aod::McCollisions const&, TracksMC const& tracks, aod::McParticles const&) { - analyzeMcRecoGen(mcCollision, collisions, V0s, tracks, mcParticles); + // check collision + if (!selCollision(collision)) { + return; + } + // Get Matching Efficiency + getMatchEffHist(tracks); } - PROCESS_SWITCH(LambdaTableProducer, processMCRun3, "Process for Run3 MC RecoGen", false); + PROCESS_SWITCH(LambdaTableProducer, processMatchEffMCReco, "Process for Matching Efficieny Calculation at MC Reconstructed Level", false); - void processMCRun2(aod::McCollisions::iterator const& mcCollision, - soa::SmallGroups> const& collisions, - McV0Tracks const& V0s, TracksMCRun2 const& tracks, - aod::McParticles const& mcParticles) + void processMCRecoGen(aod::McCollisions::iterator const& mcCollision, + soa::SmallGroups> const& collisions, BCsRun3 const& bc, + McV0Tracks const& V0s, TracksMC const& tracks, + aod::McParticles const& mcParticles) { - analyzeMcRecoGen(mcCollision, collisions, V0s, tracks, mcParticles); + analyzeMcRecoGen(mcCollision, collisions, bc, V0s, tracks, mcParticles); } - PROCESS_SWITCH(LambdaTableProducer, processMCRun2, "Process for Run2 MC RecoGen", false); + PROCESS_SWITCH(LambdaTableProducer, processMCRecoGen, "Process for MC RecoGen", false); }; struct LambdaTracksExtProducer { @@ -1352,9 +1347,12 @@ struct LambdaTracksExtProducer { } } - void process(aod::LambdaCollisions::iterator const&, aod::LambdaTracks const& tracks) - { + void processDummy(aod::LambdaCollisions::iterator const&) {} + + PROCESS_SWITCH(LambdaTracksExtProducer, processDummy, "Dummy Process", true); + void processLambdaTrackExt(aod::LambdaCollisions::iterator const&, aod::LambdaTracks const& tracks) + { int nTotLambda = 0, nTotAntiLambda = 0, nSelLambda = 0, nSelAntiLambda = 0; for (auto const& lambda : tracks) { @@ -1451,6 +1449,8 @@ struct LambdaTracksExtProducer { histos.fill(HIST("h1i_antilambda_mult"), nSelAntiLambda); } } + + PROCESS_SWITCH(LambdaTracksExtProducer, processLambdaTrackExt, "Process for lambda track extension", false); }; struct LambdaR2Correlation { @@ -1470,7 +1470,7 @@ struct LambdaR2Correlation { Configurable cDoEtaAnalysis{"cDoEtaAnalysis", false, "Eta/Rap Analysis Flag"}; // Centrality Axis - ConfigurableAxis cMultBins{"cMultBins", {VARIABLE_WIDTH, 0.0f, 10.0f, 30.0f, 50.f, 80.0f, 100.f}, "Variable Mult-Bins"}; + ConfigurableAxis cCentBins{"cCentBins", {VARIABLE_WIDTH, 0.0f, 10.0f, 20.0f, 50.f, 80.0f, 100.f}, "Variable Mult-Bins"}; // Histogram Registry. HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -1504,7 +1504,7 @@ struct LambdaR2Correlation { const AxisSpec axisCheck(1, 0, 1, ""); const AxisSpec axisPosZ(220, -11, 11, "V_{z} (cm)"); - const AxisSpec axisCent(cMultBins, "FT0M (%)"); + const AxisSpec axisCent(cCentBins, "FT0C (%)"); const AxisSpec axisChMult(200, 0, 200, "N_{ch}"); const AxisSpec axisMult(10, 0, 10, "N_{#Lambda}"); const AxisSpec axisMass(100, 1.06, 1.16, "M_{#Lambda} (GeV/#it{c}^{2})"); @@ -1519,16 +1519,14 @@ 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(%)", kTH2F, {axisCent, axisChMult}); - histos.add("Event/Reco/h2f_lambda_mult", "#Lambda - Multiplicity", kTH2F, {axisCent, axisMult}); - histos.add("Event/Reco/h2f_antilambda_mult", "#bar{#Lambda} - Multiplicity", kTH2F, {axisCent, axisMult}); + histos.add("Event/Reco/h2f_Mult_vs_Centrality", "N_{ch} vs FT0M(%)", kTProfile, {axisCent}); + histos.add("Event/Reco/h2f_lambda_mult", "#Lambda - Multiplicity", kTProfile, {axisCent}); + histos.add("Event/Reco/h2f_antilambda_mult", "#bar{#Lambda} - Multiplicity", kTProfile, {axisCent}); // Efficiency Histograms // Single Particle Efficiencies histos.add("Reco/Primary/Efficiency/h2f_n1_centpt_LaP", "#rho_{1}^{#Lambda}", kTH2F, {axisCent, axisPt}); histos.add("Reco/Primary/Efficiency/h2f_n1_centpt_LaM", "#rho_{1}^{#bar{#Lambda}}", kTH2F, {axisCent, axisPt}); - histos.add("Reco/Primary/Efficiency/h3f_n1_centpteta_LaP", "#rho_{1}^{#Lambda}", kTH3F, {axisCent, axisPt, axisEta}); - histos.add("Reco/Primary/Efficiency/h3f_n1_centpteta_LaM", "#rho_{1}^{#bar{#Lambda}}", kTH3F, {axisCent, axisPt, axisEta}); histos.add("Reco/Primary/Efficiency/h3f_n1_centptrap_LaP", "#rho_{1}^{#Lambda}", kTH3F, {axisCent, axisPt, axisRap}); histos.add("Reco/Primary/Efficiency/h3f_n1_centptrap_LaM", "#rho_{1}^{#bar{#Lambda}}", kTH3F, {axisCent, axisPt, axisRap}); @@ -1536,22 +1534,16 @@ struct LambdaR2Correlation { // 1D Histograms histos.add("Reco/Primary/h3f_n1_centmasspt_LaP", "#rho_{1}^{#Lambda}", kTH3F, {axisCent, axisMass, axisPt}); histos.add("Reco/Primary/h3f_n1_centmasspt_LaM", "#rho_{1}^{#bar{#Lambda}}", kTH3F, {axisCent, axisMass, axisPt}); - histos.add("Reco/Primary/h2f_n1_pt_LaP", "#rho_{1}^{#Lambda}", kTH2F, {axisCent, axisPt}); - histos.add("Reco/Primary/h2f_n1_pt_LaM", "#rho_{1}^{#bar{#Lambda}}", kTH2F, {axisCent, axisPt}); - histos.add("Reco/Primary/h2f_n1_eta_LaP", "#rho_{1}^{#Lambda}", kTH2F, {axisCent, axisEta}); - histos.add("Reco/Primary/h2f_n1_eta_LaM", "#rho_{1}^{#bar{#Lambda}}", kTH2F, {axisCent, axisEta}); - histos.add("Reco/Primary/h2f_n1_rap_LaP", "#rho_{1}^{#Lambda}", kTH2F, {axisCent, axisRap}); - histos.add("Reco/Primary/h2f_n1_rap_LaM", "#rho_{1}^{#bar{#Lambda}}", kTH2F, {axisCent, axisRap}); - histos.add("Reco/Primary/h2f_n1_phi_LaP", "#rho_{1}^{#Lambda}", kTH2F, {axisCent, axisPhi}); - histos.add("Reco/Primary/h2f_n1_phi_LaM", "#rho_{1}^{#bar{#Lambda}}", kTH2F, {axisCent, axisPhi}); + histos.add("Reco/Primary/h4f_n1_ptrapphi_LaP", "#rho_{1}^{#Lambda}", kTHnSparseF, {axisCent, axisPt, axisRap, axisPhi}); + histos.add("Reco/Primary/h4f_n1_ptrapphi_LaM", "#rho_{1}^{#bar{#Lambda}}", kTHnSparseF, {axisCent, axisPt, axisRap, axisPhi}); // rho1 for R2 RapPhi histos.add("Reco/Primary/h3f_n1_rapphi_LaP", "#rho_{1}^{#Lambda}", kTH3F, {axisCent, axisRap, axisPhi}); histos.add("Reco/Primary/h3f_n1_rapphi_LaM", "#rho_{1}^{#bar{#Lambda}}", kTH3F, {axisCent, axisRap, axisPhi}); // rho1 for Q_{inv} - histos.add("Reco/Primary/h3f_n1_pteta_LaP", "#rho_{1}^{#Lambda}", kTH3F, {axisCent, axisPt, axisEta}); - histos.add("Reco/Primary/h3f_n1_pteta_LaM", "#rho_{1}^{#bar{#Lambda}}", kTH3F, {axisCent, axisPt, axisEta}); + histos.add("Reco/Primary/h3f_n1_ptrapphi_LaP", "#rho_{1}^{#Lambda}", kTH3F, {axisCent, axisPt, axisRapPhi}); + histos.add("Reco/Primary/h3f_n1_ptrapphi_LaM", "#rho_{1}^{#bar{#Lambda}}", kTH3F, {axisCent, axisPt, axisRapPhi}); // Clone Singles Primary/Secondary Histogram if (cAnaSecondaries) { @@ -1573,9 +1565,9 @@ struct LambdaR2Correlation { histos.add("Reco/PP/h3f_n2_rapphi_LaM_LaM", "#rho_{2}^{#bar{#Lambda}#bar{#Lambda}}", kTH3F, {axisCent, axisRapPhi, axisRapPhi}); // rho2 for R2 Qinv - histos.add("Reco/PP/h2f_n2_qinv_LaP_LaM", "#rho_{2}^{#Lambda#bar{#Lambda}}", kTH2F, {axisCent, axisQinv}); - histos.add("Reco/PP/h2f_n2_qinv_LaP_LaP", "#rho_{2}^{#Lambda#Lambda}", kTH2F, {axisCent, axisQinv}); - histos.add("Reco/PP/h2f_n2_qinv_LaM_LaM", "#rho_{2}^{#bar{#Lambda}#bar{#Lambda}}", kTH2F, {axisCent, axisQinv}); + histos.add("Reco/PP/h3f_n2_qinv_LaP_LaM", "#rho_{2}^{#Lambda#bar{#Lambda}}", kTHnSparseF, {axisCent, axisPt, axisRapPhi, axisQinv}); + histos.add("Reco/PP/h3f_n2_qinv_LaP_LaP", "#rho_{2}^{#Lambda#Lambda}", kTHnSparseF, {axisCent, axisPt, axisRapPhi, axisQinv}); + histos.add("Reco/PP/h3f_n2_qinv_LaM_LaM", "#rho_{2}^{#bar{#Lambda}#bar{#Lambda}}", kTHnSparseF, {axisCent, axisPt, axisRapPhi, axisQinv}); // Clone Pairs Histograms if (cAnaSecondaryPairs) { @@ -1592,6 +1584,21 @@ struct LambdaR2Correlation { } } + // Rap-Phi Bin Index + int getRapPhiBin(float const& rap, float const& phi) + { + int rapbin = static_cast((rap - kminrap) / rapbinwidth); + int phibin = static_cast(phi / phibinwidth); + + int rapphibin = -99; + if (rapbin >= 0 && phibin >= 0 && rapbin < nrapbins && phibin < nphibins) { + rapphibin = rapbin * nphibins + phibin; + return rapphibin; + } + + return rapphibin; + } + template void fillPairHistos(U& p1, U& p2) { @@ -1626,7 +1633,7 @@ struct LambdaR2Correlation { q = RecoDecay::p((p1.px() - p2.px()), (p1.py() - p2.py()), (p1.pz() - p2.pz())); e = RecoDecay::e(p1.px(), p1.py(), p1.pz(), MassLambda0) - RecoDecay::e(p2.px(), p2.py(), p2.pz(), MassLambda0); qinv = std::sqrt(-RecoDecay::m2(q, e)); - histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST(SubDirPrmScd[psp]) + HIST("h2f_n2_qinv_") + HIST(SubDirHist[part_pair]), cent, qinv, corfac); + histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST(SubDirPrmScd[psp]) + HIST("h3f_n2_qinv_") + HIST(SubDirHist[part_pair]), cent, p1.pt(), getRapPhiBin(p1.rap(), p1.phi()), qinv, corfac); } template @@ -1644,21 +1651,17 @@ struct LambdaR2Correlation { // Efficiency Plots histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST(SubDirPrmScd[pst]) + HIST("Efficiency/h2f_n1_centpt_") + HIST(SubDirHist[part]), cent, track.pt()); - histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST(SubDirPrmScd[pst]) + HIST("Efficiency/h3f_n1_centpteta_") + HIST(SubDirHist[part]), cent, track.pt(), track.eta()); histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST(SubDirPrmScd[pst]) + HIST("Efficiency/h3f_n1_centptrap_") + HIST(SubDirHist[part]), cent, track.pt(), track.rap()); // QA Plots histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST(SubDirPrmScd[pst]) + HIST("h3f_n1_centmasspt_") + HIST(SubDirHist[part]), cent, track.mass(), track.pt()); - histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST(SubDirPrmScd[pst]) + HIST("h2f_n1_pt_") + HIST(SubDirHist[part]), cent, track.pt(), track.corrFact()); - histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST(SubDirPrmScd[pst]) + HIST("h2f_n1_eta_") + HIST(SubDirHist[part]), cent, track.eta(), track.corrFact()); - histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST(SubDirPrmScd[pst]) + HIST("h2f_n1_phi_") + HIST(SubDirHist[part]), cent, track.phi(), track.corrFact()); - histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST(SubDirPrmScd[pst]) + HIST("h2f_n1_rap_") + HIST(SubDirHist[part]), cent, track.rap(), track.corrFact()); + histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST(SubDirPrmScd[pst]) + HIST("h4f_n1_ptrapphi_") + HIST(SubDirHist[part]), cent, track.pt(), track.rap(), track.phi(), track.corrFact()); // Rho1 for N1RapPhi histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST(SubDirPrmScd[pst]) + HIST("h3f_n1_rapphi_") + HIST(SubDirHist[part]), cent, track.rap(), track.phi(), track.corrFact()); - // Rho1 for Q_{inv} Bkg Estimation - histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST(SubDirPrmScd[pst]) + HIST("h3f_n1_pteta_") + HIST(SubDirHist[part]), cent, track.pt(), track.eta(), track.corrFact()); + // Rho1 for Q_{inv} + histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST(SubDirPrmScd[pst]) + HIST("h3f_n1_ptrapphi_") + HIST(SubDirHist[part]), cent, track.pt(), getRapPhiBin(track.rap(), track.phi()), track.corrFact()); } // fill multiplicity histograms @@ -1694,6 +1697,10 @@ struct LambdaR2Correlation { Partition partSecdLambdaTracks = (aod::lambdatrack::v0Type == (int8_t)kLambda) && (aod::lambdatrackext::trueLambdaFlag == true) && (aod::lambdatrack::v0PrmScd == (int8_t)kSecondary); Partition partSecdAntiLambdaTracks = (aod::lambdatrack::v0Type == (int8_t)kAntiLambda) && (aod::lambdatrackext::trueLambdaFlag == true) && (aod::lambdatrack::v0PrmScd == (int8_t)kSecondary); + void processDummy(aod::LambdaCollisions::iterator const&) {} + + PROCESS_SWITCH(LambdaR2Correlation, processDummy, "Dummy Process", true); + void processDataReco(LambdaCollisions::iterator const& collision, LambdaTracks const&) { histos.fill(HIST("Event/Reco/h1f_collision_posz"), collision.posZ()); @@ -1736,7 +1743,7 @@ struct LambdaR2Correlation { } } - PROCESS_SWITCH(LambdaR2Correlation, processDataReco, "Process for Data and MCReco", true); + PROCESS_SWITCH(LambdaR2Correlation, processDataReco, "Process for Data and MCReco", false); using LambdaMcGenCollisions = aod::LambdaMcGenCollisions; using LambdaMcGenTracks = aod::LambdaMcGenTracks;