1616// / \author Nicolas Strangmann (nicolas.strangmann@cern.ch) - Goethe University Frankfurt
1717// /
1818
19- #include < limits>
20- #include < vector>
21- #include < map>
22- #include < string>
19+ #include " PWGEM/PhotonMeson/DataModel/bcWiseTables.h"
20+ #include " PWGEM/PhotonMeson/Utils/MCUtilities.h"
21+ #include " PWGJE/DataModel/EMCALClusters.h"
2322
24- #include " Framework/runDataProcessing.h"
25- #include " Framework/AnalysisTask.h"
23+ #include " Common/CCDB/ctpRateFetcher.h"
24+ #include " Common/DataModel/Centrality.h"
25+ #include " Common/DataModel/EventSelection.h"
2626
27+ #include " CCDB/BasicCCDBManager.h"
28+ #include " DataFormatsParameters/GRPLHCIFData.h"
2729#include " DetectorsBase/GeometryManager.h"
2830#include " EMCALBase/Geometry.h"
31+ #include " Framework/AnalysisTask.h"
32+ #include " Framework/runDataProcessing.h"
2933
30- #include " Common/DataModel/EventSelection.h"
31- #include " Common/DataModel/Centrality.h"
32- #include " Common/CCDB/ctpRateFetcher.h"
33- #include " CCDB/BasicCCDBManager.h"
34- #include " DataFormatsParameters/GRPLHCIFData.h"
35- #include " PWGJE/DataModel/EMCALClusters.h"
36- #include " PWGEM/PhotonMeson/Utils/MCUtilities.h"
37- #include " PWGEM/PhotonMeson/DataModel/bcWiseTables.h"
34+ #include < limits>
35+ #include < map>
36+ #include < string>
37+ #include < vector>
3838
3939using namespace o2 ;
4040using namespace o2 ::aod::emdownscaling;
@@ -56,6 +56,7 @@ struct bcWiseClusterSkimmer {
5656 Produces<aod::BCWiseClusters> clusterTable;
5757 Produces<aod::BCWiseCollisions> collisionTable;
5858 Produces<aod::BCWiseMCPi0s> mcpi0Table;
59+ Produces<aod::BCWiseMCEtas> mcetaTable;
5960 Produces<aod::BCWiseMCClusters> mcclusterTable;
6061
6162 PresliceUnsorted<MyCollisions> perFoundBC = aod::evsel::foundBCId;
@@ -70,7 +71,7 @@ struct bcWiseClusterSkimmer {
7071 Configurable<float > cfgMinTime{" cfgMinTime" , -25 , " Minimum time of selected clusters (ns)" };
7172 Configurable<float > cfgMaxTime{" cfgMaxTime" , 25 , " Maximum time of selected clusters (ns)" };
7273 Configurable<float > cfgRapidityCut{" cfgRapidityCut" , 0 .8f , " Maximum absolute rapidity of counted generated particles" };
73- Configurable<float > cfgMinPtGenPi0{ " cfgMinPtGenPi0 " , 0 ., " Minimum pT for stored generated pi0s (reduce disk space of derived data)" };
74+ Configurable<float > cfgMinPtGen{ " cfgMinPtGen " , 0 ., " Minimum pT for stored generated mesons (reduce disk space of derived data)" };
7475
7576 Configurable<bool > cfgRequirekTVXinEMC{" cfgRequirekTVXinEMC" , false , " Only store kTVXinEMC triggered BCs" };
7677 Configurable<bool > cfgRequireGoodRCTQuality{" cfgRequireGoodRCTQuality" , false , " Only store BCs with good quality of T0 and EMC in RCT" };
@@ -90,6 +91,7 @@ struct bcWiseClusterSkimmer {
9091 HistogramRegistry mHistManager {" output" , {}, OutputObjHandlingPolicy::AnalysisObject, false , false };
9192
9293 std::map<int32_t , int32_t > fMapPi0Index ; // Map to connect the MC index of the pi0 to the one saved in the derived table
94+ std::map<int32_t , int32_t > fMapEtaIndex ; // Map to connect the MC index of the eta to the one saved in the derived table
9395
9496 void init (o2::framework::InitContext&)
9597 {
@@ -108,7 +110,7 @@ struct bcWiseClusterSkimmer {
108110 LOG (info) << " | Shape cut: " << cfgMinM02 << " < M02 < " << cfgMaxM02;
109111 LOG (info) << " | Energy cut: " << cfgMinClusterEnergy << " < E < " << cfgMaxClusterEnergy;
110112 LOG (info) << " | Rapidity cut: |y| < " << cfgRapidityCut;
111- LOG (info) << " | Min gen pi0 pt: pT > " << cfgMinPtGenPi0 ;
113+ LOG (info) << " | Min gen pt: pT > " << cfgMinPtGen ;
112114
113115 o2::emcal::Geometry::GetInstanceFromRunNumber (300000 );
114116 if (cfgRequireGoodRCTQuality)
@@ -154,31 +156,42 @@ struct bcWiseClusterSkimmer {
154156 {
155157 for (const auto & cluster : clusters) {
156158 float clusterInducerEnergy = 0 .;
157- int32_t pi0MCIndex = -1 ;
159+ int32_t mesonMCIndex = -1 ;
158160 if (cluster.amplitudeA ().size () > 0 ) {
159161 int clusterInducerId = cluster.mcParticleIds ()[0 ];
160162 auto clusterInducer = mcParticles.iteratorAt (clusterInducerId);
161163 clusterInducerEnergy = clusterInducer.e ();
162- int daughterId = aod::pwgem::photonmeson::utils::mcutil::FindMotherInChain (clusterInducer, mcParticles, std::vector<int >{111 });
164+ int daughterId = aod::pwgem::photonmeson::utils::mcutil::FindMotherInChain (clusterInducer, mcParticles, std::vector<int >{111 , 221 });
163165 if (daughterId > 0 ) {
164- pi0MCIndex = mcParticles.iteratorAt (daughterId).mothersIds ()[0 ];
165- if (mcParticles.iteratorAt (pi0MCIndex ).pt () < cfgMinPtGenPi0 )
166- pi0MCIndex = -1 ;
166+ mesonMCIndex = mcParticles.iteratorAt (daughterId).mothersIds ()[0 ];
167+ if (mcParticles.iteratorAt (mesonMCIndex ).pt () < cfgMinPtGen )
168+ mesonMCIndex = -1 ;
167169 }
168170 }
169- if (pi0MCIndex >= 0 ) {
170- if (fMapPi0Index .find (pi0MCIndex) != fMapPi0Index .end ()) // Some pi0s might not be found (not gg decay or too large y)
171- pi0MCIndex = fMapPi0Index [pi0MCIndex]; // If pi0 was stored in table, change index from the MC index to the pi0 index from this task
172- else // If pi0 was not stored, treat photon as if not from pi0
173- pi0MCIndex = -1 ;
171+ bool isEta = false ;
172+ if (mesonMCIndex >= 0 ) {
173+ if (mcParticles.iteratorAt (mesonMCIndex).pdgCode () == 111 ) {
174+ if (fMapPi0Index .find (mesonMCIndex) != fMapPi0Index .end ()) // Some pi0s might not be found (not gg decay or too large y)
175+ mesonMCIndex = fMapPi0Index [mesonMCIndex]; // If pi0 was stored in table, change index from the MC index to the pi0 index from this task
176+ else // If pi0 was not stored, treat photon as if not from pi0
177+ mesonMCIndex = -1 ;
178+ } else if (mcParticles.iteratorAt (mesonMCIndex).pdgCode () == 221 ) {
179+ isEta = true ;
180+ if (fMapEtaIndex .find (mesonMCIndex) != fMapEtaIndex .end ()) // Some etas might not be found (not gg decay or too large y)
181+ mesonMCIndex = fMapEtaIndex [mesonMCIndex]; // If eta was stored in table, change index from the MC index to the eta index from this task
182+ else // If eta was not stored, treat photon as if not from eta
183+ mesonMCIndex = -1 ;
184+ } else {
185+ mesonMCIndex = -1 ; // Not a pi0 or eta
186+ }
174187 }
175- mcclusterTable (bcID, pi0MCIndex , convertForStorage<uint16_t >(clusterInducerEnergy, kEnergy ));
188+ mcclusterTable (bcID, mesonMCIndex, isEta , convertForStorage<uint16_t >(clusterInducerEnergy, kEnergy ));
176189 }
177190 }
178191
179192 bool isBCSelected (const auto & bc)
180193 {
181- if (cfgRequirekTVXinEMC && !bc.selection_bit (aod::evsel:: kIsTriggerTVX ))
194+ if (cfgRequirekTVXinEMC && !bc.alias_bit ( kTVXinEMC ))
182195 return false ;
183196 if (cfgRequireGoodRCTQuality && !isFT0EMCGoodRCTChecker (bc))
184197 return false ;
@@ -319,12 +332,18 @@ struct bcWiseClusterSkimmer {
319332 auto mcParticlesInColl = mcParticles.sliceBy (perMcCollision, mcCollision.globalIndex ());
320333 mHistManager .fill (HIST (" CentralityVsGenMultiplicity" ), bc.centFT0M (), mcParticlesInColl.size ());
321334 for (const auto & mcParticle : mcParticlesInColl) {
322- if (mcParticle. pdgCode () != 111 || std::abs (mcParticle.y ()) > cfgRapidityCut || !isGammaGammaDecay (mcParticle, mcParticles) || mcParticle.pt () < cfgMinPtGenPi0 )
335+ if (std::abs (mcParticle.y ()) > cfgRapidityCut || !isGammaGammaDecay (mcParticle, mcParticles) || mcParticle.pt () < cfgMinPtGen )
323336 continue ;
324337 bool isPrimary = mcParticle.isPhysicalPrimary () || mcParticle.producedByGenerator ();
325338 bool isFromWD = (aod::pwgem::photonmeson::utils::mcutil::IsFromWD (mcCollision, mcParticle, mcParticles)) > 0 ;
326- mcpi0Table (bc.globalIndex (), convertForStorage<uint16_t >(mcParticle.pt (), kpT), isAccepted (mcParticle, mcParticles), isPrimary, isFromWD);
327- fMapPi0Index [mcParticle.globalIndex ()] = static_cast <int32_t >(mcpi0Table.lastIndex ());
339+
340+ if (mcParticle.pdgCode () == 111 ) {
341+ mcpi0Table (bc.globalIndex (), convertForStorage<uint16_t >(mcParticle.pt (), kpT), isAccepted (mcParticle, mcParticles), isPrimary, isFromWD);
342+ fMapPi0Index [mcParticle.globalIndex ()] = static_cast <int32_t >(mcpi0Table.lastIndex ());
343+ } else if (mcParticle.pdgCode () == 221 ) {
344+ mcetaTable (bc.globalIndex (), convertForStorage<uint16_t >(mcParticle.pt (), kpT), isAccepted (mcParticle, mcParticles), isPrimary, isFromWD);
345+ fMapEtaIndex [mcParticle.globalIndex ()] = static_cast <int32_t >(mcetaTable.lastIndex ());
346+ }
328347 }
329348 }
330349
@@ -338,6 +357,7 @@ struct bcWiseClusterSkimmer {
338357 processClusterMCInfo (clustersInBC, bc.globalIndex (), mcParticles);
339358 }
340359 fMapPi0Index .clear ();
360+ fMapEtaIndex .clear ();
341361 }
342362 }
343363 PROCESS_SWITCH (bcWiseClusterSkimmer, processMC, " Run skimming for MC" , false );
0 commit comments