@@ -47,10 +47,13 @@ struct TestMcStdTabsRl {
4747
4848 HistogramRegistry histos{" histos" , {}, OutputObjHandlingPolicy::AnalysisObject};
4949
50+ // declare configurables
51+ Configurable<bool > useMcgenidGetGeneratorID{" useMcgenidGetGeneratorID" , true , {" Use o2::mcgenid::getGeneratorId instead of o2::mccollision::getGeneratorId; default it true." }};
52+
5053 struct : ConfigurableGroup {
51- ConfigurableAxis zzAxisNtracks{" zzAxisNtracks" , {30 , -0.5 , 29 .5 }, " Number of tracks in collision" };
52- ConfigurableAxis zzAxisNparticles{" zzAxisNparticles" , {60 , -0.5 , 59 .5 }, " Number of particles in collision" };
53- ConfigurableAxis zzAxisNprocesses{" zzAxisNprocesses" , {50 , -0.5 , 49 .5 }, " Number of processes" };
54+ ConfigurableAxis zzAxisNtracks{" zzAxisNtracks" , {100 , -0.5 , 99 .5 }, " Number of tracks in collision" };
55+ ConfigurableAxis zzAxisNparticles{" zzAxisNparticles" , {100 , -0.5 , 99 .5 }, " Number of particles in collision" };
56+ ConfigurableAxis zzAxisNprocesses{" zzAxisNprocesses" , {1000 , -0.5 , 999 .5 }, " Number of processes" };
5457 ConfigurableAxis zzAxisInvMassWide{" zzAxisInvMassWide" , {1000 , 0 ., 10 .}, " Invariant mass (GeV/c^{2}), wider range" };
5558 ConfigurableAxis zzAxisPt{" zzAxisPt" , {400 , 0 ., 2 .}, " Transversal momentum (GeV/c)" };
5659 ConfigurableAxis zzAxisRap{" zzAxisRap" , {50 , -1.2 , 1.2 }, " Rapidity (a.u.)" };
@@ -74,24 +77,26 @@ struct TestMcStdTabsRl {
7477 void processMCgen (aod::McCollision const & collision, aod::McParticles const & particles)
7578 {
7679
77- histos.get <TH2>(HIST (" Events/Truth/hGenIDvsCountCollisions" ))->Fill (collision.getGeneratorId (), 1 );
78- histos.get <TH2>(HIST (" Events/Truth/hGenIDvsNparticles" ))->Fill (collision.getGeneratorId (), particles.size ());
80+ const auto genID = useMcgenidGetGeneratorID ? o2::mcgenid::getGeneratorId (collision.getGeneratorId ()) : collision.getGeneratorId ();
81+
82+ histos.get <TH2>(HIST (" Events/Truth/hGenIDvsCountCollisions" ))->Fill (genID, 1 );
83+ histos.get <TH2>(HIST (" Events/Truth/hGenIDvsNparticles" ))->Fill (genID, particles.size ());
7984
8085 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double >> mother;
8186 for (const auto & particle : particles) {
82- histos.get <TH2>(HIST (" Events/Truth/hGenIDvsPDGcodesAll" ))->Fill (collision. getGeneratorId () , particle.pdgCode ());
87+ histos.get <TH2>(HIST (" Events/Truth/hGenIDvsPDGcodesAll" ))->Fill (genID , particle.pdgCode ());
8388 // if (!particle.isPhysicalPrimary()) continue;
8489 if (particle.has_mothers ())
8590 continue ;
8691 mother.SetPxPyPzE (particle.px (), particle.py (), particle.pz (), energy (pdg->Mass (particle.pdgCode ()), particle.px (), particle.py (), particle.pz ()));
87- histos.get <TH2>(HIST (" Events/Truth/hGenIDvsPDGcodesNoMother" ))->Fill (collision. getGeneratorId () , particle.pdgCode ());
88- histos.get <TH2>(HIST (" Events/Truth/hGenIDvsMotherMass" ))->Fill (collision. getGeneratorId () , mother.M ());
89- histos.get <TH2>(HIST (" Events/Truth/hGenIDvsMotherPt" ))->Fill (collision. getGeneratorId () , particle.pt ());
90- histos.get <TH2>(HIST (" Events/Truth/hGenIDvsMotherRap" ))->Fill (collision. getGeneratorId () , particle.y ());
92+ histos.get <TH2>(HIST (" Events/Truth/hGenIDvsPDGcodesNoMother" ))->Fill (genID , particle.pdgCode ());
93+ histos.get <TH2>(HIST (" Events/Truth/hGenIDvsMotherMass" ))->Fill (genID , mother.M ());
94+ histos.get <TH2>(HIST (" Events/Truth/hGenIDvsMotherPt" ))->Fill (genID , particle.pt ());
95+ histos.get <TH2>(HIST (" Events/Truth/hGenIDvsMotherRap" ))->Fill (genID , particle.y ());
9196 const auto & daughters = particle.daughters_as <aod::McParticles>();
92- histos.get <TH2>(HIST (" Events/Truth/hGenIDvsNdaughters" ))->Fill (collision. getGeneratorId () , daughters.size ());
97+ histos.get <TH2>(HIST (" Events/Truth/hGenIDvsNdaughters" ))->Fill (genID , daughters.size ());
9398 for (const auto & daughter : daughters) {
94- histos.get <TH2>(HIST (" Events/Truth/hGenIDvsPDGcodesDaughters" ))->Fill (collision. getGeneratorId () , daughter.pdgCode ());
99+ histos.get <TH2>(HIST (" Events/Truth/hGenIDvsPDGcodesDaughters" ))->Fill (genID , daughter.pdgCode ());
95100 }
96101 }
97102
0 commit comments