Skip to content

Commit 18c3470

Browse files
nstrangmNicolas Strangmannalibuild
authored
[PWGEM/PhotonMeson] Add eta meson functionality to bc wise gammagamma task (#11804)
Co-authored-by: Nicolas Strangmann <nicolas.strangmann@.cern.ch> Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent 81cfc23 commit 18c3470

File tree

3 files changed

+118
-62
lines changed

3 files changed

+118
-62
lines changed

PWGEM/PhotonMeson/DataModel/bcWiseTables.h

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
#ifndef PWGEM_PHOTONMESON_DATAMODEL_BCWISETABLES_H_
2020
#define PWGEM_PHOTONMESON_DATAMODEL_BCWISETABLES_H_
2121

22-
#include <limits>
23-
2422
#include "Framework/AnalysisDataModel.h"
2523

24+
#include <limits>
25+
2626
namespace o2::aod
2727
{
2828

@@ -121,30 +121,34 @@ DECLARE_SOA_TABLE(BCWiseClusters, "AOD", "BCWISECLUSTER", //! table of skimmed E
121121
bcwisecluster::Definition<bcwisecluster::StoredDefinition>, bcwisecluster::E<bcwisecluster::StoredE>, bcwisecluster::Eta<bcwisecluster::StoredEta>, bcwisecluster::Phi<bcwisecluster::StoredPhi>, bcwisecluster::NCells<bcwisecluster::StoredNCells>, bcwisecluster::M02<bcwisecluster::StoredM02>, bcwisecluster::Time<bcwisecluster::StoredTime>, bcwisecluster::IsExotic<bcwisecluster::StoredIsExotic>,
122122
bcwisecluster::Pt<bcwisecluster::StoredE, bcwisecluster::StoredEta>);
123123

124-
namespace bcwisemcpi0s
124+
namespace bcwisemcmesons
125125
{
126126
DECLARE_SOA_COLUMN(StoredPt, storedPt, uint16_t); //! Transverse momentum of generated pi0 (1 MeV -> Maximum pi0 pT of ~65 GeV)
127127
DECLARE_SOA_COLUMN(IsAccepted, isAccepted, bool); //! Both decay photons are within the EMCal acceptance
128128
DECLARE_SOA_COLUMN(IsPrimary, isPrimary, bool); //! mcParticle.isPhysicalPrimary() || mcParticle.producedByGenerator()
129129
DECLARE_SOA_COLUMN(IsFromWD, isFromWD, bool); //! Pi0 from a weak decay according to pwgem::photonmeson::utils::mcutil::IsFromWD
130130

131131
DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, [](uint16_t storedpt) -> float { return std::nextafter(storedpt / emdownscaling::downscalingFactors[emdownscaling::kpT], std::numeric_limits<float>::infinity()); }); //! pT of pi0 (GeV)
132-
} // namespace bcwisemcpi0s
132+
} // namespace bcwisemcmesons
133133

134134
DECLARE_SOA_TABLE(BCWiseMCPi0s, "AOD", "BCWISEMCPI0", //! table of pi0s on MC level
135-
o2::soa::Index<>, BCWiseBCId, bcwisemcpi0s::StoredPt, bcwisemcpi0s::IsAccepted, bcwisemcpi0s::IsPrimary, bcwisemcpi0s::IsFromWD,
136-
bcwisemcpi0s::Pt<bcwisemcpi0s::StoredPt>);
135+
o2::soa::Index<>, BCWiseBCId, bcwisemcmesons::StoredPt, bcwisemcmesons::IsAccepted, bcwisemcmesons::IsPrimary, bcwisemcmesons::IsFromWD,
136+
bcwisemcmesons::Pt<bcwisemcmesons::StoredPt>);
137+
DECLARE_SOA_TABLE(BCWiseMCEtas, "AOD", "BCWISEMCETA", //! table of eta mesons on MC level
138+
o2::soa::Index<>, BCWiseBCId, bcwisemcmesons::StoredPt, bcwisemcmesons::IsAccepted, bcwisemcmesons::IsPrimary, bcwisemcmesons::IsFromWD,
139+
bcwisemcmesons::Pt<bcwisemcmesons::StoredPt>);
137140

138141
namespace bcwisemccluster
139142
{
140-
DECLARE_SOA_COLUMN(Pi0ID, pi0ID, int32_t); //! Index of the mother pi0 (-1 if not from pi0)
143+
DECLARE_SOA_COLUMN(MesonID, mesonID, int32_t); //! Index of the mother mesom (-1 if not from a pi0 or eta)
144+
DECLARE_SOA_COLUMN(IsEta, isEta, bool); //! Boolean flag to indicate if the cluster is from an eta meson, otherwise it is from a pi0
141145
DECLARE_SOA_COLUMN(StoredTrueE, storedTrueE, uint16_t); //! energy of cluster inducing particle (1 MeV -> Maximum cluster energy of ~65 GeV)
142146

143147
DECLARE_SOA_DYNAMIC_COLUMN(TrueE, trueE, [](uint16_t storedTrueE) -> float { return std::nextafter(storedTrueE / emdownscaling::downscalingFactors[emdownscaling::kEnergy], std::numeric_limits<float>::infinity()); }); //! energy of cluster inducing particle (GeV)
144148
} // namespace bcwisemccluster
145149

146150
DECLARE_SOA_TABLE(BCWiseMCClusters, "AOD", "BCWISEMCCLS", //! table of MC information for clusters -> To be joined with the cluster table
147-
o2::soa::Index<>, BCWiseBCId, bcwisemccluster::Pi0ID, bcwisemccluster::StoredTrueE,
151+
o2::soa::Index<>, BCWiseBCId, bcwisemccluster::MesonID, bcwisemccluster::IsEta, bcwisemccluster::StoredTrueE,
148152
bcwisemccluster::TrueE<bcwisemccluster::StoredTrueE>);
149153

150154
} // namespace o2::aod

PWGEM/PhotonMeson/TableProducer/bcWiseClusterSkimmer.cxx

Lines changed: 51 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,25 @@
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

3939
using namespace o2;
4040
using 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

Comments
 (0)