From d1d0e2d293d7488373f76891cdab76051bbf1d15 Mon Sep 17 00:00:00 2001 From: Yash Patley <52608802+yashpatley@users.noreply.github.com> Date: Sat, 24 Oct 2026 19:56:49 +0530 Subject: [PATCH] [PWGCF] lambda r2 correlation MC generator process update Added multiplicity and centrality estimator for MC on-the-fly process --- .../Tasks/lambdaR2Correlation.cxx | 114 +++++++++++++++--- 1 file changed, 100 insertions(+), 14 deletions(-) diff --git a/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx b/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx index 1cddee698c9..cb608859637 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx @@ -266,9 +266,19 @@ struct LambdaTableProducer { Configurable cSelPrimaryParticle{"cSelPrimaryParticle", false, "Select primary particle"}; Configurable cSelTrueParticle{"cSelTrueParticle", false, "Select MC PDG matched particle"}; + // MC Generator + Configurable cFwdMult{"cFwdMult", 500, "Fwd multiplicity axis config"}; + Configurable cFT0AEtaMin{"cFT0AEtaMin", 3.5, "FT0A Eta Min"}; + Configurable cFT0AEtaMax{"cFT0AEtaMax", 4.9, "FT0A Eta Max"}; + Configurable cFT0CEtaMin{"cFT0CEtaMin", -3.3, "FT0C Eta Min"}; + Configurable cFT0CEtaMax{"cFT0CEtaMax", -2.1, "FT0C Eta Max"}; + Configurable cTPCEtaMin{"cTPCEtaMin", -1., "TPC Eta Min"}; + Configurable cTPCEtaMax{"cTPCEtaMax", 1., "TPC Eta Max"}; + // 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 cPathCCDBMcCent{"cPathCCDBMcCent", "Users/y/ypatley/LBF/PP/McCent/MultCent", "Path for ccdb-object for MC Gen multiplicity centrality calibration"}; 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 @@ -290,14 +300,23 @@ struct LambdaTableProducer { // Initialize Global Variables float cent = 0.; TList* ccdbObjRecoEff = nullptr; - TList* ccdbObjMatchEff = nullptr; + TList* ccdbObjMcCent = nullptr; + TH1F* hMcFwdMult = nullptr; static constexpr auto SubDir = std::array{"QA/Lambda/", "QA/AntiLambda/"}; void init(InitContext const&) { - // initialize axis specifications + // CCDB + // Set CCDB url + ccdb->setURL(cUrlCCDB.value); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setCreatedNotAfter(nolaterthan.value); + + // Initialize axis specifications const AxisSpec axisCols(5, 0.5, 5.5, ""); const AxisSpec axisTrks(15, 0.5, 15.5, ""); + const AxisSpec axisFwdMult(cFwdMult, 0, cFwdMult, "N_{ch}^{FWD}"); const AxisSpec axisEffChecks(3, 0, 3, ""); const AxisSpec axisCent(100, 0, 100, "Centrality(%)"); const AxisSpec axisVarCent(cCentBins, "FT0C%"); @@ -363,7 +382,7 @@ struct LambdaTableProducer { histos.add("QA/Lambda/DCA/h3f_Dca_vs_pT_cent", "DCA", kTH3F, {axisCent, axisV0Pt, axisDcaLambda}); // MC Generated Histograms - if (doprocessMCRecoGen || doprocessMCReco || doprocessMCGen) { + if (doprocessMCRecoGen || doprocessMCReco) { // DCA analysis 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}); @@ -400,14 +419,17 @@ struct LambdaTableProducer { histos.get(HIST("Tracks/h1f_lambda_info"))->GetXaxis()->SetBinLabel(LambdaLabels::kPassV0TopoSel, "kPassV0TopoSel"); histos.get(HIST("Tracks/h1f_lambda_info"))->GetXaxis()->SetBinLabel(LambdaLabels::kAllSelPassed, "kAllSelPassed"); + // MC generator histograms + if (doprocessMCGen) { + histos.add("Events/h1f_fwdmult", "Fwd multiplicity", kTH1F, {axisFwdMult}); + + // MC Gen Mult-Cent Calibration + ccdbObjMcCent = ccdb->getForTimeStamp(cPathCCDBMcCent.value, nolaterthan.value); + hMcFwdMult = dynamic_cast(ccdbObjMcCent->FindObject("hFwdMult")); + } + // 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); @@ -659,6 +681,59 @@ struct LambdaTableProducer { return effCorrFact; } + // MC generator multiplicity estimator and MB event selection + template + bool multEstimator(P const& particles, int& fwdMult) + { + int multFT0A = 0, multFT0C = 0, multTPC = 0; + + // Select charged particles + for (auto const& particle : particles) { + // Primary + if (!particle.isPhysicalPrimary()) { + continue; + } + + // FT0C + if (particle.eta() > cFT0CEtaMin && particle.eta() < cFT0CEtaMax) { + ++multFT0C; + } + + // FT0A + if (particle.eta() > cFT0AEtaMin && particle.eta() < cFT0AEtaMax) { + ++multFT0A; + } + + // Central barrel (ITS + TPC) + if (particle.eta() > cTPCEtaMin && particle.eta() < cTPCEtaMax) { + ++multTPC; + } + } + + int multFT0M = multFT0A + multFT0C; + fwdMult = multFT0M; + + // Minimum bias trigger (1 track in A side, 1 track in C side, 1 track in central barrel) + if (multFT0A > 0 && multFT0C > 0 && multTPC > 0) { + return true; + } + + return false; + } + + // MC generator centrality + float getMcCentrality(int mult) + { + float totalArea = hMcFwdMult->Integral(); + float area = 0.; + int nx = hMcFwdMult->GetNbinsX(); + int bin = hMcFwdMult->GetXaxis()->FindBin(mult + 0.5); + for (int i = bin; i <= nx; ++i) { + area += hMcFwdMult->GetBinContent(i); + } + return (area / totalArea) * 100.; + } + // Lambda QA template void fillLambdaQAHistos(C const& col, V const& v0, T const&) @@ -905,11 +980,7 @@ struct LambdaTableProducer { 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)) { - return; - } - fillLambdaRecoTables(collision, bc, V0s, tracks); + fillLambdaRecoTables(collision, bc, V0s, tracks); } PROCESS_SWITCH(LambdaTableProducer, processMCReco, "Process for McReco DATA", false); @@ -926,6 +997,21 @@ struct LambdaTableProducer { void processMCGen(aod::McCollisions::iterator const& mcCollision, aod::McParticles const& mcParticles) { + // Multiplicity estimation + int fwdMult = 0; + bool eventTrig = multEstimator(mcParticles, fwdMult); + + // MB event selection + if (!eventTrig) { + return; + } + + // Fill fwd multiplicity histogram + histos.fill(HIST("Events/h1f_fwdmult"), fwdMult); + + // Get centrality + cent = getMcCentrality(fwdMult); + // Fill McGen Collision Table lambdaMCGenCollisionTable(cent, mcCollision.posX(), mcCollision.posY(), mcCollision.posZ());