4343#include < TPDGCode.h>
4444#include < TProfile.h>
4545
46+ #include < string>
47+ #include < vector>
48+
4649using namespace o2 ;
4750using namespace o2 ::framework;
4851using namespace o2 ::framework::expressions;
@@ -96,6 +99,9 @@ struct CascadeAnalysisLightIonsDerivedData {
9699 Configurable<bool > requireIsVertexTOFmatched{" requireIsVertexTOFmatched" , false , " require events with at least one of vertex contributors matched to TOF" };
97100 Configurable<bool > requireIsVertexTRDmatched{" requireIsVertexTRDmatched" , false , " require events with at least one of vertex contributors matched to TRD" };
98101 Configurable<bool > rejectSameBunchPileup{" rejectSameBunchPileup" , true , " reject collisions in case of pileup with another collision in the same foundBC" };
102+ Configurable<bool > applyZVtxSelOnMCPV{" applyZVtxSelOnMCPV" , false , " Apply Z-vtx cut on the PV of the generated collision?" };
103+ Configurable<bool > requireInel0{" requireInel0" , false , " Enable INEL > 0 selection" };
104+ Configurable<bool > requireInel0OnMC{" requireInel0OnMC" , false , " Enable INEL > 0 selection for MC gen events" };
99105
100106 // Track analysis Parameters
101107 Configurable<float > minITSnCls{" minITSnCls" , 4 .0f , " min number of ITS clusters" };
@@ -129,6 +135,7 @@ struct CascadeAnalysisLightIonsDerivedData {
129135 Configurable<float > minimumCascRadius{" minimumCascRadius" , 1 .1f , " Minimum Cascade Radius" };
130136 Configurable<float > v0masswindow{" v0masswindow" , 0.005 , " v0 mass window" };
131137 Configurable<float > competingmassrej{" competingmassrej" , 0.008 , " Competing mass rejection" };
138+
132139 // Axes parameters
133140 ConfigurableAxis centEstimatorHistBin{" centEstimatorHistBin" , {101 , 0 .0f , 101 .0f }, " " };
134141 ConfigurableAxis centralityBinning{" centralityBinning" , {VARIABLE_WIDTH, 0 .0f , 5 .0f , 10 .0f , 20 .0f , 30 .0f , 40 .0f , 50 .0f , 60 .0f , 70 .0f , 80 .0f , 90 .0f }, " " };
@@ -145,7 +152,7 @@ struct CascadeAnalysisLightIonsDerivedData {
145152 kNGlobal };
146153
147154 // For manual sliceBy
148- PresliceUnsorted<soa::Join<aod::StraCollisions, aod::StraCents, aod::StraEvSels, aod::StraCollLabels>> perMcCollision = aod::v0data ::straMCCollisionId;
155+ PresliceUnsorted<soa::Join<aod::StraCollisions, aod::StraCents, aod::StraEvSels, aod::StraCollLabels>> perMcCollision = aod::cascdata ::straMCCollisionId;
149156
150157 void init (InitContext const &)
151158 {
@@ -183,6 +190,7 @@ struct CascadeAnalysisLightIonsDerivedData {
183190 registryData.get <TH1>(HIST (" number_of_events_data" ))->GetXaxis ()->SetBinLabel (8 , " kIsVertexTOFmatched" );
184191 registryData.get <TH1>(HIST (" number_of_events_data" ))->GetXaxis ()->SetBinLabel (9 , " kIsVertexTRDmatched" );
185192 registryData.get <TH1>(HIST (" number_of_events_data" ))->GetXaxis ()->SetBinLabel (10 , " kNoSameBunchPileup" );
193+ registryData.get <TH1>(HIST (" number_of_events_data" ))->GetXaxis ()->SetBinLabel (11 , " kINELgr0" );
186194
187195 registryData.add (" number_of_events_data_vs_centrality" , " number of events in data vs centrality" , HistType::kTH2D , {{20 , -0 .5f , +19 .5f }, {101 , 0 .0f , 101 .0f }});
188196 registryData.get <TH2>(HIST (" number_of_events_data_vs_centrality" ))->GetXaxis ()->SetBinLabel (1 , " All collisions" );
@@ -195,6 +203,7 @@ struct CascadeAnalysisLightIonsDerivedData {
195203 registryData.get <TH2>(HIST (" number_of_events_data_vs_centrality" ))->GetXaxis ()->SetBinLabel (8 , " kIsVertexTOFmatched" );
196204 registryData.get <TH2>(HIST (" number_of_events_data_vs_centrality" ))->GetXaxis ()->SetBinLabel (9 , " kIsVertexTRDmatched" );
197205 registryData.get <TH2>(HIST (" number_of_events_data_vs_centrality" ))->GetXaxis ()->SetBinLabel (10 , " kNoSameBunchPileup" );
206+ registryData.get <TH2>(HIST (" number_of_events_data_vs_centrality" ))->GetXaxis ()->SetBinLabel (11 , " kINELgr0" );
198207 registryData.get <TH2>(HIST (" number_of_events_data_vs_centrality" ))->GetYaxis ()->SetTitle (" Centrality (%)" );
199208
200209 // QC Histograms
@@ -244,6 +253,7 @@ struct CascadeAnalysisLightIonsDerivedData {
244253 registryMC.get <TH1>(HIST (" number_of_events_mc_rec" ))->GetXaxis ()->SetBinLabel (8 , " kIsVertexTOFmatched" );
245254 registryMC.get <TH1>(HIST (" number_of_events_mc_rec" ))->GetXaxis ()->SetBinLabel (9 , " kIsVertexTRDmatched" );
246255 registryMC.get <TH1>(HIST (" number_of_events_mc_rec" ))->GetXaxis ()->SetBinLabel (10 , " kNoSameBunchPileup" );
256+ registryMC.get <TH1>(HIST (" number_of_events_mc_rec" ))->GetXaxis ()->SetBinLabel (11 , " kINELgr0" );
247257
248258 registryMC.add (" number_of_events_mc_rec_vs_centrality" , " number of events in mc_rec vs centrality" , HistType::kTH2D , {{20 , -0 .5f , +19 .5f }, {101 , 0 .0f , 101 .0f }});
249259 registryMC.get <TH2>(HIST (" number_of_events_mc_rec_vs_centrality" ))->GetXaxis ()->SetBinLabel (1 , " All collisions" );
@@ -256,6 +266,7 @@ struct CascadeAnalysisLightIonsDerivedData {
256266 registryMC.get <TH2>(HIST (" number_of_events_mc_rec_vs_centrality" ))->GetXaxis ()->SetBinLabel (8 , " kIsVertexTOFmatched" );
257267 registryMC.get <TH2>(HIST (" number_of_events_mc_rec_vs_centrality" ))->GetXaxis ()->SetBinLabel (9 , " kIsVertexTRDmatched" );
258268 registryMC.get <TH2>(HIST (" number_of_events_mc_rec_vs_centrality" ))->GetXaxis ()->SetBinLabel (10 , " kNoSameBunchPileup" );
269+ registryMC.get <TH2>(HIST (" number_of_events_mc_rec_vs_centrality" ))->GetXaxis ()->SetBinLabel (11 , " kINELgr0" );
259270 registryMC.get <TH2>(HIST (" number_of_events_mc_rec_vs_centrality" ))->GetYaxis ()->SetTitle (" Centrality (%)" );
260271
261272 // QC Histograms
@@ -313,9 +324,11 @@ struct CascadeAnalysisLightIonsDerivedData {
313324 registryMC.add (" h2dGenOmegaPlus" , " h2dGenOmegaPlus" , HistType::kTH2D , {centAxis, ptAxis});
314325
315326 // Histograms for event loss/splitting
316- registryMC.add (" hGenEvents" , " hGenEvents" , HistType::kTH2D , {{axisNch}, {2 , -0 .5f , +1 .5f }});
327+ registryMC.add (" hGenEvents" , " hGenEvents" , HistType::kTH2D , {{axisNch}, {4 , -0 .5f , +3 .5f }});
317328 registryMC.get <TH2>(HIST (" hGenEvents" ))->GetYaxis ()->SetBinLabel (1 , " All gen. events" );
318- registryMC.get <TH2>(HIST (" hGenEvents" ))->GetYaxis ()->SetBinLabel (2 , " Gen. with at least 1 rec. events" );
329+ registryMC.get <TH2>(HIST (" hGenEvents" ))->GetYaxis ()->SetBinLabel (2 , " All gen. events in INEL > 0" );
330+ registryMC.get <TH2>(HIST (" hGenEvents" ))->GetYaxis ()->SetBinLabel (3 , " Gen. with at least 1 rec. events" );
331+ registryMC.get <TH2>(HIST (" hGenEvents" ))->GetYaxis ()->SetBinLabel (4 , " Gen. with at least 1 rec. events in INEL > 0" );
319332 registryMC.add (" hGenEventCentrality" , " hGenEventCentrality" , kTH1D , {{101 , 0 .0f , 101 .0f }});
320333
321334 registryMC.add (" hCentralityVsNcoll_beforeEvSel" , " hCentralityVsNcoll_beforeEvSel" , HistType::kTH2D , {centAxis, {50 , -0 .5f , 49 .5f }});
@@ -631,6 +644,10 @@ struct CascadeAnalysisLightIonsDerivedData {
631644 continue ;
632645 }
633646
647+ if (requireInel0 && collision.multNTracksPVeta1 () < 1 ) {
648+ continue ;
649+ }
650+
634651 // Find the collision with the biggest nbr of PV contributors
635652 // Follows what was done here: https://github.com/AliceO2Group/O2Physics/blob/master/Common/TableProducer/mcCollsExtra.cxx#L93
636653 if (biggestNContribs < collision.multPVTotalContributors ()) {
@@ -650,11 +667,16 @@ struct CascadeAnalysisLightIonsDerivedData {
650667 std::vector<int > listBestCollisionIdx (mcCollisions.size ());
651668 for (auto const & mcCollision : mcCollisions) {
652669 // event selections
653- if (applyVtxZ && std::fabs (mcCollision.posZ ()) > zVtx)
670+ if (applyZVtxSelOnMCPV && std::fabs (mcCollision.posZ ()) > zVtx)
654671 continue ;
655672
656673 registryMC.fill (HIST (" hGenEvents" ), mcCollision.multMCNParticlesEta05 (), 0 /* all gen. events*/ );
657674
675+ if (requireInel0OnMC && mcCollision.multMCNParticlesEta10 () < 1 ) {
676+ continue ;
677+ }
678+ registryMC.fill (HIST (" hGenEvents" ), mcCollision.multMCNParticlesEta05 (), 1 /* all gen. events in INEL > 0*/ );
679+
658680 auto groupedCollisions = getGroupedCollisions (collisions, mcCollision.globalIndex ());
659681 // Check if there is at least one of the reconstructed collisions associated to this MC collision
660682 // If so, we consider it
@@ -698,6 +720,10 @@ struct CascadeAnalysisLightIonsDerivedData {
698720 continue ;
699721 }
700722
723+ if (requireInel0 && collision.multNTracksPVeta1 () < 1 ) {
724+ continue ;
725+ }
726+
701727 if (biggestNContribs < collision.multPVTotalContributors ()) {
702728 biggestNContribs = collision.multPVTotalContributors ();
703729 if (centralityEstimator == Option::kFT0C )
@@ -721,8 +747,8 @@ struct CascadeAnalysisLightIonsDerivedData {
721747 registryQC.fill (HIST (" hVertexZGen" ), mcCollision.posZ ());
722748
723749 if (atLeastOne) {
724- registryMC.fill (HIST (" hGenEvents" ), mcCollision.multMCNParticlesEta05 (), 1 /* at least 1 rec. event*/ );
725-
750+ registryMC.fill (HIST (" hGenEvents" ), mcCollision.multMCNParticlesEta05 (), 2 /* at least 1 rec. event*/ );
751+ registryMC. fill ( HIST ( " hGenEvents " ), mcCollision. multMCNParticlesEta05 (), 3 /* at least 1 rec. event in INEL > 0 */ );
726752 registryMC.fill (HIST (" hGenEventCentrality" ), centralitydata);
727753 }
728754 }
@@ -815,6 +841,12 @@ struct CascadeAnalysisLightIonsDerivedData {
815841 registryData.fill (HIST (" number_of_events_data" ), 9 /* Not at same bunch pile-up */ );
816842 registryData.fill (HIST (" number_of_events_data_vs_centrality" ), 9 , centrality);
817843
844+ if (requireInel0 && collision.multNTracksPVeta1 () < 1 ) {
845+ return ;
846+ }
847+ registryData.fill (HIST (" number_of_events_data" ), 10 /* INEL > 0 */ );
848+ registryData.fill (HIST (" number_of_events_data_vs_centrality" ), 10 , centrality);
849+
818850 // Store the Zvtx
819851 registryQC.fill (HIST (" hVertexZdata" ), collision.posZ ());
820852
@@ -959,6 +991,12 @@ struct CascadeAnalysisLightIonsDerivedData {
959991 registryMC.fill (HIST (" number_of_events_mc_rec" ), 9 /* Not at same bunch pile-up */ );
960992 registryMC.fill (HIST (" number_of_events_mc_rec_vs_centrality" ), 9 , centralityMcRec);
961993
994+ if (requireInel0 && RecCol.multNTracksPVeta1 () < 1 ) {
995+ continue ;
996+ }
997+ registryMC.fill (HIST (" number_of_events_mc_rec" ), 10 /* INEL > 0 */ );
998+ registryMC.fill (HIST (" number_of_events_mc_rec_vs_centrality" ), 10 , centralityMcRec);
999+
9621000 // Store the Zvtx
9631001 registryQC.fill (HIST (" hVertexZRec" ), RecCol.posZ ());
9641002
@@ -1055,17 +1093,20 @@ struct CascadeAnalysisLightIonsDerivedData {
10551093 if (!isPhysPrim)
10561094 continue ;
10571095
1058- float ptmc = RecoDecay::sqrtSumOfSquares ( cascMC.pxMC (), cascMC. pyMC () );
1096+ float ptmc = cascMC.ptMC ( );
10591097
10601098 auto mcCollision = cascMC.template straMCCollision_as <CollisionMCTrueTable>();
10611099
10621100 // event selections
1063- if (applyVtxZ && std::abs (mcCollision.posZ ()) > zVtx)
1101+ if (applyZVtxSelOnMCPV && std::abs (mcCollision.posZ ()) > zVtx)
10641102 continue ;
1065-
10661103 // Store the Zvtx
10671104 registryQC.fill (HIST (" hVertexZGen" ), mcCollision.posZ ());
10681105
1106+ if (requireInel0OnMC && mcCollision.multMCNParticlesEta10 () < 1 ) {
1107+ continue ;
1108+ }
1109+
10691110 float centralityMC = 100 .5f ;
10701111
10711112 if (listBestCollisionIdx[mcCollision.globalIndex ()] > -1 ) {
0 commit comments