Skip to content

Commit b0236c3

Browse files
nstrangmNicolas Strangmann
andauthored
[PWGEM/PhotonMeson,PWGJE] Add clusterizer selection to EM tasks (AliceO2Group#8820)
Co-authored-by: Nicolas Strangmann <[email protected]>
1 parent dfeace6 commit b0236c3

File tree

8 files changed

+41
-10
lines changed

8 files changed

+41
-10
lines changed

PWGEM/PhotonMeson/Core/EMCPhotonCut.cxx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,20 @@
1313
// Class for EMCal cluster selection
1414
//
1515

16+
#include <string>
1617
#include "Framework/Logger.h"
1718
#include "PWGEM/PhotonMeson/Core/EMCPhotonCut.h"
19+
#include "PWGJE/DataModel/EMCALClusters.h"
1820

1921
ClassImp(EMCPhotonCut);
2022

21-
const char* EMCPhotonCut::mCutNames[static_cast<int>(EMCPhotonCut::EMCPhotonCuts::kNCuts)] = {"Energy", "NCell", "M02", "Timing", "TrackMatching", "Exotic"};
23+
const char* EMCPhotonCut::mCutNames[static_cast<int>(EMCPhotonCut::EMCPhotonCuts::kNCuts)] = {"Definition", "Energy", "NCell", "M02", "Timing", "TrackMatching", "Exotic"};
2224

25+
void EMCPhotonCut::SetClusterizer(std::string clusterDefinitionString)
26+
{
27+
mDefinition = static_cast<int>(o2::aod::emcalcluster::getClusterDefinitionFromString(clusterDefinitionString));
28+
LOG(info) << "EMCal Photon Cut, set cluster definition to: " << mDefinition << " (" << clusterDefinitionString << ")";
29+
}
2330
void EMCPhotonCut::SetMinE(float min)
2431
{
2532
mMinE = min;
@@ -72,6 +79,9 @@ void EMCPhotonCut::print() const
7279
LOG(info) << "EMCal Photon Cut:";
7380
for (int i = 0; i < static_cast<int>(EMCPhotonCuts::kNCuts); i++) {
7481
switch (static_cast<EMCPhotonCuts>(i)) {
82+
case EMCPhotonCuts::kDefinition:
83+
LOG(info) << mCutNames[i] << " > " << mDefinition;
84+
break;
7585
case EMCPhotonCuts::kEnergy:
7686
LOG(info) << mCutNames[i] << " > " << mMinE;
7787
break;

PWGEM/PhotonMeson/Core/EMCPhotonCut.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ class EMCPhotonCut : public TNamed
3434

3535
enum class EMCPhotonCuts : int {
3636
// cluster cut
37-
kEnergy = 0,
37+
kDefinition = 0,
38+
kEnergy,
3839
kNCell,
3940
kM02,
4041
kTiming,
@@ -49,6 +50,9 @@ class EMCPhotonCut : public TNamed
4950
template <typename T, typename Cluster>
5051
bool IsSelected(Cluster const& cluster) const
5152
{
53+
if (!IsSelectedEMCal(EMCPhotonCuts::kDefinition, cluster)) {
54+
return false;
55+
}
5256
if (!IsSelectedEMCal(EMCPhotonCuts::kEnergy, cluster)) {
5357
return false;
5458
}
@@ -75,6 +79,9 @@ class EMCPhotonCut : public TNamed
7579
bool IsSelectedEMCal(const EMCPhotonCuts& cut, Cluster const& cluster) const
7680
{
7781
switch (cut) {
82+
case EMCPhotonCuts::kDefinition:
83+
return cluster.definition() == mDefinition;
84+
7885
case EMCPhotonCuts::kEnergy:
7986
return cluster.e() > mMinE;
8087

@@ -113,6 +120,7 @@ class EMCPhotonCut : public TNamed
113120
}
114121

115122
// Setters
123+
void SetClusterizer(std::string clusterDefinitionString = "kV3Default");
116124
void SetMinE(float min = 0.7f);
117125
void SetMinNCell(int min = 1);
118126
void SetM02Range(float min = 0.1f, float max = 0.7f);
@@ -128,6 +136,7 @@ class EMCPhotonCut : public TNamed
128136

129137
private:
130138
// EMCal cluster cuts
139+
int mDefinition{10}; ///< clusterizer definition
131140
float mMinE{0.7f}; ///< minimum energy
132141
int mMinNCell{1}; ///< minimum number of cells per cluster
133142
float mMinM02{0.1f}; ///< minimum M02 for a cluster

PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ struct Pi0EtaToGammaGamma {
180180
EMCPhotonCut fEMCCut;
181181
struct : ConfigurableGroup {
182182
std::string prefix = "emccut_group";
183+
Configurable<std::string> clusterDefinition{"clusterDefinition", "kV3Default", "Clusterizer to be selected, e.g. V3Default"};
183184
Configurable<float> minOpenAngle{"minOpenAngle", 0.0202, "apply min opening angle"};
184185
Configurable<float> EMC_minTime{"EMC_minTime", -20., "Minimum cluster time for EMCal time cut"};
185186
Configurable<float> EMC_maxTime{"EMC_maxTime", +25., "Maximum cluster time for EMCal time cut"};
@@ -422,6 +423,7 @@ struct Pi0EtaToGammaGamma {
422423

423424
fEMCCut = EMCPhotonCut("fEMCCut", "fEMCCut");
424425

426+
fEMCCut.SetClusterizer(emccuts.clusterDefinition);
425427
fEMCCut.SetMinE(emccuts.EMC_minE);
426428
fEMCCut.SetMinNCell(emccuts.EMC_minNCell);
427429
fEMCCut.SetM02Range(emccuts.EMC_minM02, emccuts.EMC_maxM02);

PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ struct Pi0EtaToGammaGammaMC {
168168
EMCPhotonCut fEMCCut;
169169
struct : ConfigurableGroup {
170170
std::string prefix = "emccut_group";
171+
Configurable<std::string> clusterDefinition{"clusterDefinition", "kV3Default", "Clusterizer to be selected, e.g. V3Default"};
171172
Configurable<float> minOpenAngle{"minOpenAngle", 0.0202, "apply min opening angle"};
172173
Configurable<float> EMC_minTime{"EMC_minTime", -20., "Minimum cluster time for EMCal time cut"};
173174
Configurable<float> EMC_maxTime{"EMC_maxTime", +25., "Maximum cluster time for EMCal time cut"};
@@ -385,6 +386,7 @@ struct Pi0EtaToGammaGammaMC {
385386

386387
fEMCCut = EMCPhotonCut("fEMCCut", "fEMCCut");
387388

389+
fEMCCut.SetClusterizer(emccuts.clusterDefinition);
388390
fEMCCut.SetMinE(emccuts.EMC_minE);
389391
fEMCCut.SetMinNCell(emccuts.EMC_minNCell);
390392
fEMCCut.SetM02Range(emccuts.EMC_minM02, emccuts.EMC_maxM02);

PWGEM/PhotonMeson/DataModel/gammaTables.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ DECLARE_SOA_COLUMN(TrackPt, trackpt, std::vector<float>);
459459
DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, [](float e, float eta, float m = 0) -> float { return sqrt(e * e - m * m) / cosh(eta); }); //! cluster pt, mass to be given as argument when getter is called!
460460
} // namespace emccluster
461461
DECLARE_SOA_TABLE(SkimEMCClusters, "AOD", "SKIMEMCCLUSTERS", //! table of skimmed EMCal clusters
462-
o2::soa::Index<>, skimmedcluster::CollisionId, skimmedcluster::E, skimmedcluster::Eta, skimmedcluster::Phi,
462+
o2::soa::Index<>, skimmedcluster::CollisionId, emccluster::Definition, skimmedcluster::E, skimmedcluster::Eta, skimmedcluster::Phi,
463463
skimmedcluster::M02, skimmedcluster::NCells, skimmedcluster::Time, emccluster::IsExotic, emccluster::TrackEta,
464464
emccluster::TrackPhi, emccluster::TrackP, emccluster::TrackPt, emccluster::Pt<skimmedcluster::E, skimmedcluster::Eta>);
465465
using SkimEMCCluster = SkimEMCClusters::iterator;

PWGEM/PhotonMeson/TableProducer/skimmerGammaCalo.cxx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
/// \author [email protected]
1515

1616
#include <algorithm>
17+
#include <vector>
1718

1819
#include "Framework/runDataProcessing.h"
1920
#include "Framework/AnalysisTask.h"
@@ -137,7 +138,7 @@ struct skimmerGammaCalo {
137138
historeg.fill(HIST("hCaloClusterEOut"), emccluster.energy());
138139
historeg.fill(HIST("hCaloClusterFilter"), 4);
139140

140-
tableGammaEMCReco(emccluster.collisionId(), emccluster.energy(), emccluster.eta(), emccluster.phi(), emccluster.m02(),
141+
tableGammaEMCReco(emccluster.collisionId(), emccluster.definition(), emccluster.energy(), emccluster.eta(), emccluster.phi(), emccluster.m02(),
141142
emccluster.nCells(), emccluster.time(), emccluster.isExotic(), vEta, vPhi, vP, vPt);
142143
}
143144
}

PWGEM/PhotonMeson/Tasks/emcalQC.cxx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ struct emcalQC {
7676
EMCPhotonCut fEMCCut;
7777
struct : ConfigurableGroup {
7878
std::string prefix = "emccut_group";
79+
Configurable<std::string> clusterDefinition{"clusterDefinition", "kV3Default", "Clusterizer to be selected, e.g. V3Default"};
7980
Configurable<float> minOpenAngle{"minOpenAngle", 0.0202, "apply min opening angle"};
8081
Configurable<float> EMC_minTime{"EMC_minTime", -20., "Minimum cluster time for EMCal time cut"};
8182
Configurable<float> EMC_maxTime{"EMC_maxTime", +25., "Maximum cluster time for EMCal time cut"};
@@ -115,6 +116,7 @@ struct emcalQC {
115116
const float f = emccuts.EMC_TM_Phi->at(2);
116117
LOGF(info, "EMCal track matching parameters : a = %f, b = %f, c = %f, d = %f, e = %f, f = %f", a, b, c, d, e, f);
117118

119+
fEMCCut.SetClusterizer(emccuts.clusterDefinition);
118120
fEMCCut.SetMinE(emccuts.EMC_minE);
119121
fEMCCut.SetMinNCell(emccuts.EMC_minNCell);
120122
fEMCCut.SetM02Range(emccuts.EMC_minM02, emccuts.EMC_maxM02);
@@ -193,9 +195,13 @@ struct emcalQC {
193195

194196
auto clusters_per_coll = clusters.sliceBy(perCollision, collision.collisionId());
195197
fRegistry.fill(HIST("Cluster/before/hNgamma"), clusters_per_coll.size(), collision.weight());
196-
int ng = 0;
198+
int ngBefore = 0;
199+
int ngAfter = 0;
197200
for (auto& cluster : clusters_per_coll) {
198201
// Fill the cluster properties before applying any cuts
202+
if (!fEMCCut.IsSelectedEMCal(EMCPhotonCut::EMCPhotonCuts::kDefinition, cluster))
203+
continue;
204+
ngBefore++;
199205
o2::aod::pwgem::photonmeson::utils::clusterhistogram::fillClusterHistograms<0>(&fRegistry, cluster, cfgDo2DQA, collision.weight());
200206

201207
// Apply cuts one by one and fill in hClusterQualityCuts histogram
@@ -205,10 +211,10 @@ struct emcalQC {
205211
bool survivesIsSelectedEMCalCuts = true; // Survives "manual" cuts listed in this task
206212
bool survivesIsSelectedCuts = fEMCCut.IsSelected<int>(cluster); // Survives the cutlist defines in EMCPhotonCut.h, which is also used in the Pi0Eta task
207213

208-
for (int icut = 0; icut < static_cast<int>(EMCPhotonCut::EMCPhotonCuts::kNCuts); icut++) { // Loop through different cut observables
214+
for (int icut = 1; icut < static_cast<int>(EMCPhotonCut::EMCPhotonCuts::kNCuts); icut++) { // Loop through different cut observables, start at 1 to ignore ClusterDefinition
209215
EMCPhotonCut::EMCPhotonCuts specificcut = static_cast<EMCPhotonCut::EMCPhotonCuts>(icut);
210216
if (!fEMCCut.IsSelectedEMCal(specificcut, cluster)) { // Check whether cluster passes this cluster requirement, if not, fill why in the next row
211-
fRegistry.fill(HIST("Cluster/hClusterQualityCuts"), icut + 1, cluster.e(), collision.weight());
217+
fRegistry.fill(HIST("Cluster/hClusterQualityCuts"), icut, cluster.e(), collision.weight());
212218
survivesIsSelectedEMCalCuts = false;
213219
}
214220
}
@@ -220,10 +226,11 @@ struct emcalQC {
220226
if (survivesIsSelectedCuts) {
221227
o2::aod::pwgem::photonmeson::utils::clusterhistogram::fillClusterHistograms<1>(&fRegistry, cluster, cfgDo2DQA, collision.weight());
222228
fRegistry.fill(HIST("Cluster/hClusterQualityCuts"), 7., cluster.e(), collision.weight());
223-
ng++;
229+
ngAfter++;
224230
}
225231
}
226-
fRegistry.fill(HIST("Cluster/after/hNgamma"), ng, collision.weight());
232+
fRegistry.fill(HIST("Cluster/before/hNgamma"), ngBefore, collision.weight());
233+
fRegistry.fill(HIST("Cluster/after/hNgamma"), ngAfter, collision.weight());
227234
} // end of collision loop
228235
} // end of process
229236

PWGJE/TableProducer/emcalCorrectionTask.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -861,8 +861,8 @@ struct EmcalCorrectionTask {
861861
timeshift = 1.9; // Parameters extracted from LHC24aj (pp), but also usable for other periods
862862
}
863863
LOG(debug) << "Shift the cell time by " << timeshift << " + " << timesmear << " ns";
864-
return timeshift + timesmear;
865864
}
865+
return timeshift + timesmear;
866866
};
867867
};
868868

0 commit comments

Comments
 (0)