1616// /
1717// / Based on PWGLF/Tasks/Strangeness/strangenessInJets.cxx
1818// / \since 11/2025
19+ // /
20+ // / \note
21+ // / - Minimum Bias (MB) events are events without the requirement of a jet in the event.
1922
2023#include " PWGJE/Core/JetBkgSubUtils.h"
2124#include " PWGJE/Core/JetDerivedDataUtilities.h"
@@ -156,12 +159,13 @@ struct StrangenessInJetsIons {
156159 // V0 analysis parameters
157160 struct : ConfigurableGroup {
158161 // std::string prefix = "configV0"; // name in JSON
162+ Configurable<double > rapidityMax{" rapidityMax" , -1 .0f , " Rapidity cut for V0s in minimum bias events. = -1.0 to disable it." };
159163 Configurable<double > minimumV0Radius{" minimumV0Radius" , 1 .2f , " Minimum V0 Radius (cm)" };
160164 // Configurable<double> maximumV0Radius{"maximumV0Radius", 40.0f, "Maximum V0 Radius (cm)"};
161165 Configurable<double > v0cospaMin{" v0cospaMin" , 0 .995f , " Minimum V0 cosine of pointing angle" };
162166 Configurable<double > dcaV0DaughtersMax{" dcaV0DaughtersMax" , 1 .0f , " Maximum DCA between V0 daughters" };
163- Configurable<bool > requireV0type{" requireV0type" , true , " Require V0 type Cut" };
164- Configurable<int > v0type{" v0type" , 1 , " 0: solely for cascades (does not pass standard V0 cuts), 1: standard 2, 3: photon-like with TPC-only use. Regular analysis should always use type 1" };
167+ // Configurable<bool> requireV0type{"requireV0type", true, "Require V0 type Cut"};
168+ // Configurable<int> v0type{"v0type", 1, "0: solely for cascades (does not pass standard V0 cuts), 1: standard 2, 3: photon-like with TPC-only use. Regular analysis should always use type 1"};
165169 // K0S parameters
166170 Configurable<double > dcaNegToPVminK0s{" dcaNegToPVminK0s" , 0 .1f , " Minimum DCA of negative track to primary vertex in K0S decays (cm)" };
167171 Configurable<double > dcaPosToPVminK0s{" dcaPosToPVminK0s" , 0 .1f , " Minimum DCA of positive track to primary vertex in K0S decays (cm)" };
@@ -274,7 +278,10 @@ struct StrangenessInJetsIons {
274278
275279 // Event counters
276280 registryData.add (" number_of_events_data" , " number of events in data" , HistType::kTH1D , {{20 , 0 , 20 , " Event Cuts" }});
277- registryData.add (" number_of_events_vsmultiplicity" , " number of events in data vs multiplicity" , HistType::kTH1D , {{101 , -0.5 , 100.5 , " Multiplicity percentile" }});
281+ registryData.add (" number_of_events_vsmultiplicity" , " number of events in data vs multiplicity" , HistType::kTH1D , {{101 , 0 , 101 , " Multiplicity percentile" }});
282+
283+ // For MB
284+ registryData.add (" number_of_events_vsmultiplicity_MB" , " number of events in data vs multiplicity (MB)" , HistType::kTH1D , {{101 , 0 , 101 , " Multiplicity percentile" }});
278285
279286 registryData.get <TH1>(HIST (" number_of_events_data" ))->GetXaxis ()->SetBinLabel (1 , " All collisions" );
280287 registryData.get <TH1>(HIST (" number_of_events_data" ))->GetXaxis ()->SetBinLabel (2 , " Zorro selection" );
@@ -337,7 +344,10 @@ struct StrangenessInJetsIons {
337344 registryMC.get <TH1>(HIST (" number_of_events_mc_gen" ))->GetXaxis ()->SetBinLabel (4 , " jet pT cut" );
338345
339346 // Add histogram to store multiplicity of the event
340- registryMC.add (" number_of_events_vsmultiplicity_gen" , " number of events vs multiplicity" , HistType::kTH1D , {{101 , -0.5 , 100.5 , " Multiplicity percentile" }});
347+ registryMC.add (" number_of_events_vsmultiplicity_gen" , " number of events vs multiplicity" , HistType::kTH1D , {{101 , 0 , 101 , " Multiplicity percentile" }});
348+
349+ // For MB
350+ registryMC.add (" number_of_events_vsmultiplicity_gen_MB" , " number of events vs multiplicity (MB)" , HistType::kTH1D , {{101 , 0 , 101 , " Multiplicity percentile" }});
341351
342352 // Jet counters
343353 registryMC.add (" n_jets_vs_mult_pT_mc_gen" , " n_jets_vs_mult_pT_mc_gen" , HistType::kTH2F , {multAxis, ptJetAxis});
@@ -352,10 +362,16 @@ struct StrangenessInJetsIons {
352362 registryMC.add (" AntiLambda_generated_jet" , " AntiLambda_generated_jet" , HistType::kTH2F , {multAxis, ptAxis});
353363 registryMC.add (" AntiLambda_generated_ue" , " AntiLambda_generated_ue" , HistType::kTH2F , {multAxis, ptAxis});
354364
355- // Histograms for the full event (without jets)
365+ // --- Histograms for the full event (without jets)
356366 registryMC.add (" K0s_generated_MB" , " K0s_generated_MB" , HistType::kTH2F , {multAxis, ptAxis});
357367 registryMC.add (" Lambda_generated_MB" , " Lambda_generated_MB" , HistType::kTH2F , {multAxis, ptAxis});
358368 registryMC.add (" AntiLambda_generated_MB" , " AntiLambda_generated_MB" , HistType::kTH2F , {multAxis, ptAxis});
369+
370+ // In generated events with at least one reco collision
371+ registryMC.add (" K0s_generated_w_reco_MB" , " K0s_generated_w_reco_MB" , HistType::kTH2F , {multAxis, ptAxis});
372+ registryMC.add (" Lambda_generated_w_reco_MB" , " Lambda_generated_w_reco_MB" , HistType::kTH2F , {multAxis, ptAxis});
373+ registryMC.add (" AntiLambda_generated_w_reco_MB" , " AntiLambda_generated_w_reco_MB" , HistType::kTH2F , {multAxis, ptAxis});
374+ // -----
359375 }
360376 if (particleOfInterestDict[ParticleOfInterest::kCascades ]) {
361377 registryMC.add (" XiPos_generated_jet" , " XiPos_generated_jet" , HistType::kTH2F , {multAxis, ptAxis});
@@ -420,7 +436,10 @@ struct StrangenessInJetsIons {
420436 registryMC.get <TH1>(HIST (" number_of_events_mc_rec" ))->GetXaxis ()->SetBinLabel (7 , " At least one jet" );
421437
422438 // Add histogram to store multiplicity of the event
423- registryMC.add (" number_of_events_vsmultiplicity_rec" , " number of events vs multiplicity" , HistType::kTH1D , {{101 , -0.5 , 100.5 , " Multiplicity percentile" }});
439+ registryMC.add (" number_of_events_vsmultiplicity_rec" , " number of events vs multiplicity" , HistType::kTH1D , {{101 , 0 , 101 , " Multiplicity percentile" }});
440+
441+ // For MB events
442+ registryMC.add (" number_of_events_vsmultiplicity_rec_MB" , " number of events vs multiplicity (MB)" , HistType::kTH1D , {{101 , 0 , 101 , " Multiplicity percentile" }});
424443
425444 // Jet counters
426445 registryMC.add (" n_jets_vs_mult_pT_mc_rec" , " n_jets_vs_mult_pT_mc_rec" , HistType::kTH2F , {multAxis, ptJetAxis});
@@ -454,14 +473,19 @@ struct StrangenessInJetsIons {
454473 registryMC.add (" AntiLambda_gen_recoEvent_jet" , " AntiLambda_gen_recoEvent_jet" , HistType::kTH2F , {multAxis, ptAxis});
455474 registryMC.add (" AntiLambda_gen_recoEvent_ue" , " AntiLambda_gen_recoEvent_ue" , HistType::kTH2F , {multAxis, ptAxis});
456475
457- // Histograms for the full event (without jets)
476+ // --- Histograms for the full event (without jets)
458477 registryMC.add (" K0s_reconstructed_MB" , " K0s_reconstructed_MB" , HistType::kTH2F , {multAxis, ptAxis});
459478 registryMC.add (" Lambda_reconstructed_MB" , " Lambda_reconstructed_MB" , HistType::kTH2F , {multAxis, ptAxis});
460479 registryMC.add (" AntiLambda_reconstructed_MB" , " AntiLambda_reconstructed_MB" , HistType::kTH2F , {multAxis, ptAxis});
461480
462481 registryMC.add (" K0s_reconstructed_MB_incl" , " K0s_reconstructed_MB_incl" , HistType::kTH2F , {multAxis, ptAxis});
463482 registryMC.add (" Lambda_reconstructed_MB_incl" , " Lambda_reconstructed_MB_incl" , HistType::kTH2F , {multAxis, ptAxis});
464483 registryMC.add (" AntiLambda_reconstructed_MB_incl" , " AntiLambda_reconstructed_MB_incl" , HistType::kTH2F , {multAxis, ptAxis});
484+
485+ registryMC.add (" K0s_gen_recoEvent_MB" , " K0s_gen_recoEvent__MB" , HistType::kTH2F , {multAxis, ptAxis});
486+ registryMC.add (" Lambda_gen_recoEvent_MB" , " Lambda_gen_recoEvent_MB" , HistType::kTH2F , {multAxis, ptAxis});
487+ registryMC.add (" AntiLambda_gen_recoEvent_MB" , " AntiLambda_gen_recoEvent_MB" , HistType::kTH2F , {multAxis, ptAxis});
488+ // ---
465489 }
466490 if (particleOfInterestDict[ParticleOfInterest::kCascades ]) {
467491 registryMC.add (" XiPos_reconstructed_jet" , " XiPos_reconstructed_jet" , HistType::kTH2F , {multAxis, ptAxis});
@@ -1117,24 +1141,68 @@ struct StrangenessInJetsIons {
11171141 return true ;
11181142 }
11191143
1144+ // Return true if McCollisions has at least 1 RECO collisions that passed event selections
1145+ template <typename RecoColls>
1146+ bool HasRecoEvent (int mcCollIndex, RecoColls recoCollisions)
1147+ {
1148+ for (const auto & recoColl : recoCollisions) {
1149+ if (mcCollIndex == recoColl.mcCollisionId ()) {
1150+ if (!recoColl.has_mcCollision ()) {
1151+ continue ;
1152+ }
1153+
1154+ if (!selectRecoEvent (recoColl))
1155+ continue ;
1156+
1157+ // LOGF(info, " MC GEN index: %d", mcCollIndex);
1158+ // LOGF(info, " MC RECO index: %d", recoColl.mcCollisionId());
1159+ return true ;
1160+ }
1161+ }
1162+ return false ;
1163+ }
1164+
1165+ bool passedRapidityCut (double yParticle, double rapidityCut)
1166+ {
1167+ // true if:
1168+ // - rapidityMax < 0 [rapidity cut not required]
1169+ // - rapidityMax > 0 && abs(yParticle) < rapidityMax
1170+ if (rapidityCut < 0 ) {
1171+ return true ;
1172+ }
1173+
1174+ // Otherwise, check if the rapidity of the particle is within the limit
1175+ return std::abs (yParticle) < rapidityCut;
1176+ }
1177+
11201178 void FillFullEventHistoMCGEN (aod::McParticle const & particle,
1121- const double & genMultiplicity)
1179+ const double & genMultiplicity,
1180+ bool hasReco = false )
11221181 {
1123- if (particle.isPhysicalPrimary ()) {
1182+ if (particle.isPhysicalPrimary () && passedRapidityCut (particle. y (), configV0. rapidityMax ) ) {
11241183 switch (particle.pdgCode ()) {
11251184 case kK0Short :
11261185 if (particleOfInterestDict[ParticleOfInterest::kV0Particles ]) {
11271186 registryMC.fill (HIST (" K0s_generated_MB" ), genMultiplicity, particle.pt ());
1187+ if (hasReco) {
1188+ registryMC.fill (HIST (" K0s_generated_w_reco_MB" ), genMultiplicity, particle.pt ());
1189+ }
11281190 }
11291191 break ;
11301192 case kLambda0 :
11311193 if (particleOfInterestDict[ParticleOfInterest::kV0Particles ]) {
11321194 registryMC.fill (HIST (" Lambda_generated_MB" ), genMultiplicity, particle.pt ());
1195+ if (hasReco) {
1196+ registryMC.fill (HIST (" Lambda_generated_w_reco_MB" ), genMultiplicity, particle.pt ());
1197+ }
11331198 }
11341199 break ;
11351200 case kLambda0Bar :
11361201 if (particleOfInterestDict[ParticleOfInterest::kV0Particles ]) {
11371202 registryMC.fill (HIST (" AntiLambda_generated_MB" ), genMultiplicity, particle.pt ());
1203+ if (hasReco) {
1204+ registryMC.fill (HIST (" AntiLambda_generated_w_reco_MB" ), genMultiplicity, particle.pt ());
1205+ }
11381206 }
11391207 break ;
11401208 case kXiMinus :
@@ -1193,6 +1261,7 @@ struct StrangenessInJetsIons {
11931261 }
11941262 }
11951263
1264+ // Fill Minimum Bias histograms
11961265 template <typename MCRecoCollision, typename V0PerColl, typename CascPerColl, typename TracksPerColl>
11971266 void FillFullEventHistoMCREC (MCRecoCollision collision,
11981267 aod::McParticles const & mcParticles,
@@ -1229,33 +1298,57 @@ struct StrangenessInJetsIons {
12291298 TVector3 vtxPos (collision.posX (), collision.posY (), collision.posZ ());
12301299
12311300 // K0s
1232- if (passedK0ShortSelection (v0, pos, neg, vtxPos) && motherPos.pdgCode () == kK0Short ) {
1301+ if (passedK0ShortSelection (v0, pos, neg, vtxPos) &&
1302+ motherPos.pdgCode () == kK0Short &&
1303+ passedRapidityCut (v0.yK0Short (), configV0.rapidityMax )) {
12331304 registryMC.fill (HIST (" K0s_reconstructed_MB_incl" ), multiplicity, v0.pt ());
12341305 }
12351306 // Lambda
1236- if (passedLambdaSelection (v0, pos, neg, vtxPos) && motherPos.pdgCode () == kLambda0 ) {
1307+ if (passedLambdaSelection (v0, pos, neg, vtxPos) &&
1308+ motherPos.pdgCode () == kLambda0 &&
1309+ passedRapidityCut (v0.yLambda (), configV0.rapidityMax )) {
12371310 registryMC.fill (HIST (" Lambda_reconstructed_MB_incl" ), multiplicity, v0.pt ());
12381311 }
12391312 // AntiLambda
1240- if (passedAntiLambdaSelection (v0, pos, neg, vtxPos) && motherPos.pdgCode () == kLambda0Bar ) {
1313+ if (passedAntiLambdaSelection (v0, pos, neg, vtxPos) &&
1314+ motherPos.pdgCode () == kLambda0Bar &&
1315+ passedRapidityCut (v0.yLambda (), configV0.rapidityMax )) {
12411316 registryMC.fill (HIST (" AntiLambda_reconstructed_MB_incl" ), multiplicity, v0.pt ());
12421317 }
12431318
12441319 if (!motherPos.isPhysicalPrimary ())
12451320 continue ;
12461321
1322+ // Rapidity generated particle
1323+ double yGen = motherPos.y ();
1324+
12471325 // Histograms below are filled only for PhysicalPrimary particles
12481326 // K0s (primary)
1249- if (passedK0ShortSelection (v0, pos, neg, vtxPos) && motherPos.pdgCode () == kK0Short ) {
1250- registryMC.fill (HIST (" K0s_reconstructed_MB" ), multiplicity, v0.pt ());
1327+ if (motherPos.pdgCode () == kK0Short ) {
1328+ if (passedRapidityCut (yGen, configV0.rapidityMax )) {
1329+ registryMC.fill (HIST (" K0s_gen_recoEvent_MB" ), multiplicity, v0.pt ());
1330+ }
1331+ if (passedK0ShortSelection (v0, pos, neg, vtxPos) && passedRapidityCut (v0.yK0Short (), configV0.rapidityMax )) {
1332+ registryMC.fill (HIST (" K0s_reconstructed_MB" ), multiplicity, v0.pt ());
1333+ }
12511334 }
12521335 // Lambda (primary)
1253- if (passedLambdaSelection (v0, pos, neg, vtxPos) && motherPos.pdgCode () == kLambda0 ) {
1254- registryMC.fill (HIST (" Lambda_reconstructed_MB" ), multiplicity, v0.pt ());
1336+ if (motherPos.pdgCode () == kLambda0 ) {
1337+ if (passedRapidityCut (yGen, configV0.rapidityMax )) {
1338+ registryMC.fill (HIST (" Lambda_gen_recoEvent_MB" ), multiplicity, v0.pt ());
1339+ }
1340+ if (passedLambdaSelection (v0, pos, neg, vtxPos) && passedRapidityCut (v0.yLambda (), configV0.rapidityMax )) {
1341+ registryMC.fill (HIST (" Lambda_reconstructed_MB" ), multiplicity, v0.pt ());
1342+ }
12551343 }
12561344 // AntiLambda (primary)
1257- if (passedAntiLambdaSelection (v0, pos, neg, vtxPos) && motherPos.pdgCode () == kLambda0Bar ) {
1258- registryMC.fill (HIST (" AntiLambda_reconstructed_MB" ), multiplicity, v0.pt ());
1345+ if (motherPos.pdgCode () == kLambda0Bar ) {
1346+ if (passedRapidityCut (yGen, configV0.rapidityMax )) {
1347+ registryMC.fill (HIST (" AntiLambda_gen_recoEvent_MB" ), multiplicity, v0.pt ());
1348+ }
1349+ if (passedAntiLambdaSelection (v0, pos, neg, vtxPos) && passedRapidityCut (v0.yLambda (), configV0.rapidityMax )) {
1350+ registryMC.fill (HIST (" AntiLambda_reconstructed_MB" ), multiplicity, v0.pt ());
1351+ }
12591352 }
12601353 }
12611354 }
@@ -1417,6 +1510,15 @@ struct StrangenessInJetsIons {
14171510 // Fill event counter after selection kIsGoodZvtxFT0vsPV
14181511 registryData.fill (HIST (" number_of_events_data" ), 5.5 );
14191512
1513+ // Event multiplicity
1514+ float centrality;
1515+ if (centrEstimator == 0 ) {
1516+ centrality = collision.centFT0C ();
1517+ } else {
1518+ centrality = collision.centFT0M ();
1519+ }
1520+ registryData.fill (HIST (" number_of_events_vsmultiplicity_MB" ), centrality);
1521+
14201522 // Loop over reconstructed tracks
14211523 std::vector<fastjet::PseudoJet> fjParticles;
14221524 for (auto const & track : tracks) {
@@ -1677,6 +1779,7 @@ struct StrangenessInJetsIons {
16771779 Preslice<DaughterTracksMC> perCollisionTrk = o2::aod::track::collisionId;
16781780
16791781 void processMCgenerated (soa::Join<aod::McCollisions, aod::McCentFT0Ms, aod::McCentFT0Cs> const & collisions,
1782+ SimCollisions const & recoCollisions,
16801783 aod::McParticles const & mcParticles)
16811784 {
16821785 // Define per-event particle containers
@@ -1690,6 +1793,7 @@ struct StrangenessInJetsIons {
16901793
16911794 // Loop over MC collisions
16921795 for (const auto & collision : collisions) {
1796+ bool hasReco = HasRecoEvent (collision.globalIndex (), recoCollisions);
16931797 /* // Get multiplicity from RECO MC
16941798 // Select RECO collisions for which "mcCollisionsID" = collision.globalIndex()
16951799 float multiplicity = -999;
@@ -1744,6 +1848,7 @@ struct StrangenessInJetsIons {
17441848 } else {
17451849 genMultiplicity = collision.centFT0M ();
17461850 }
1851+ registryMC.fill (HIST (" number_of_events_vsmultiplicity_gen_MB" ), genMultiplicity);
17471852
17481853 // MC particles per collision
17491854 auto mcParticlesPerColl = mcParticles.sliceBy (perMCCollision, collision.globalIndex ());
@@ -1761,7 +1866,7 @@ struct StrangenessInJetsIons {
17611866 if (particle.eta () < configTracks.etaMin || particle.eta () > configTracks.etaMax || particle.pt () < minPtParticle)
17621867 continue ;
17631868
1764- FillFullEventHistoMCGEN (particle, genMultiplicity);
1869+ FillFullEventHistoMCGEN (particle, genMultiplicity, hasReco );
17651870
17661871 // Select physical primary particles or HF decay products
17671872 if (!isPhysicalPrimaryOrFromHF (particle, mcParticles))
@@ -2052,6 +2157,7 @@ struct StrangenessInJetsIons {
20522157 } else {
20532158 multiplicity = mcCollision.centFT0M ();
20542159 }
2160+ registryMC.fill (HIST (" number_of_events_vsmultiplicity_rec_MB" ), multiplicity);
20552161
20562162 // Number of V0 and cascades per collision
20572163 auto v0sPerColl = fullV0s.sliceBy (perCollisionV0, collision.globalIndex ());
@@ -2130,7 +2236,7 @@ struct StrangenessInJetsIons {
21302236
21312237 // ------------------------------------------------
21322238 // --- Generated hadrons in reconstructed jets ----
2133- for (auto & particle : mcParticlesPerColl) {
2239+ for (const auto & particle : mcParticlesPerColl) {
21342240 if (!particle.isPhysicalPrimary () || std::abs (particle.eta ()) > 0.8 )
21352241 continue ;
21362242
0 commit comments