Skip to content

Commit 5713f91

Browse files
authored
Merge pull request #13 from alibuild/alibot-cleanup-9084
[PWGJE] Please consider the following formatting changes to AliceO2Group#9084
2 parents 8adc211 + c9adb00 commit 5713f91

2 files changed

Lines changed: 71 additions & 70 deletions

File tree

PWGJE/DataModel/emcalClusterHadronicCorrectionTask.h

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,24 +31,23 @@ namespace emcalhadroniccorrection
3131
// DECLARE_SOA_COLUMN(HadCorrEnergy, hadcorrEnergy, float); //! cluster energy (GeV) after hadronic correction
3232

3333
// hadronic corrected energy values
34-
DECLARE_SOA_COLUMN(HadCorrOneTrack1, hadCorrOneTrack1, float); //! with hadronic correction fraction (100%) for one matched track
35-
DECLARE_SOA_COLUMN(HadCorrOneTrack2, hadCorrOneTrack2, float); //! with hadronic correction fraction (70%) for one matched track - systematic studies
36-
DECLARE_SOA_COLUMN(HadCorrAllTracks1, hadCorrAllTracks1, float); //! with hadronic correction fraction (100%) for all matched tracks
37-
DECLARE_SOA_COLUMN(HadCorrAllTracks2, hadCorrAllTracks2, float); //! with hadronic correction fraction (70%) for all matched tracks - for systematic studies
38-
34+
DECLARE_SOA_COLUMN(HadCorrOneTrack1, hadCorrOneTrack1, float); //! with hadronic correction fraction (100%) for one matched track
35+
DECLARE_SOA_COLUMN(HadCorrOneTrack2, hadCorrOneTrack2, float); //! with hadronic correction fraction (70%) for one matched track - systematic studies
36+
DECLARE_SOA_COLUMN(HadCorrAllTracks1, hadCorrAllTracks1, float); //! with hadronic correction fraction (100%) for all matched tracks
37+
DECLARE_SOA_COLUMN(HadCorrAllTracks2, hadCorrAllTracks2, float); //! with hadronic correction fraction (70%) for all matched tracks - for systematic studies
3938

4039
} // namespace emcalhadroniccorrection
4140

42-
//Table Definitions - define what needs to be written into the tables produced by this tableproducer task
43-
DECLARE_SOA_TABLE(EmcalHCs, "AOD", "EMCALHCS", //!
44-
o2::soa::Index<>, //!
45-
emcalhadroniccorrection::HadCorrOneTrack1, // corrected cluster energy for 1 matched track (f = 100%)
46-
emcalhadroniccorrection::HadCorrOneTrack2, // corrected cluster energy for 1 matched track (f = 70%)
47-
emcalhadroniccorrection::HadCorrAllTracks1, // corrected cluster energy for all matched tracks (f = 100%)
48-
emcalhadroniccorrection::HadCorrAllTracks2 // corrected cluster energy for all matched tracks (f = 70%)
49-
)
41+
// Table Definitions - define what needs to be written into the tables produced by this tableproducer task
42+
DECLARE_SOA_TABLE(EmcalHCs, "AOD", "EMCALHCS", //!
43+
o2::soa::Index<>, //!
44+
emcalhadroniccorrection::HadCorrOneTrack1, // corrected cluster energy for 1 matched track (f = 100%)
45+
emcalhadroniccorrection::HadCorrOneTrack2, // corrected cluster energy for 1 matched track (f = 70%)
46+
emcalhadroniccorrection::HadCorrAllTracks1, // corrected cluster energy for all matched tracks (f = 100%)
47+
emcalhadroniccorrection::HadCorrAllTracks2 // corrected cluster energy for all matched tracks (f = 70%)
48+
)
5049

5150
using EmcalHC = EmcalHCs::iterator;
5251

53-
} //namespace o2::aod
54-
#endif // PWGJE_DATAMODEL_EMCALCLUSTERHADRONICCORRECTION_H_
52+
} // namespace o2::aod
53+
#endif // PWGJE_DATAMODEL_EMCALCLUSTERHADRONICCORRECTION_H_

PWGJE/TableProducer/emcalClusterHadronicCorrectionTask.cxx

Lines changed: 57 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -49,37 +49,35 @@
4949

5050
#include "CommonDataFormat/InteractionRecord.h"
5151

52-
5352
using namespace o2;
5453
using namespace o2::framework;
5554
using namespace o2::framework::expressions;
5655
using collisionEvSelIt = o2::soa::Join<o2::aod::Collisions, o2::aod::EvSels>::iterator;
57-
using myTracks = o2::soa::Filtered<o2::soa::Join<o2::aod::pidTPCFullEl, o2::aod::pidTPCFullPi, o2::aod::FullTracks, o2::aod::TrackSelection>>;
58-
56+
using myTracks = o2::soa::Filtered<o2::soa::Join<o2::aod::pidTPCFullEl, o2::aod::pidTPCFullPi, o2::aod::FullTracks, o2::aod::TrackSelection>>;
5957

6058
struct EmcalClusterHadronicCorrectionTask {
6159
Produces<o2::aod::EmcalHCs> hadroniccorrectedclusters;
6260

6361
HistogramRegistry registry;
64-
//Configurables for Histogram Binning
65-
Preslice<o2::aod::EMCALMatchedTracks> perClusterMatchedTracks = o2::aod::emcalclustercell::emcalclusterId; // looking at clusterID column in the EMCALMatchedTracks for every cluster
62+
// Configurables for Histogram Binning
63+
Preslice<o2::aod::EMCALMatchedTracks> perClusterMatchedTracks = o2::aod::emcalclustercell::emcalclusterId; // looking at clusterID column in the EMCALMatchedTracks for every cluster
6664

67-
//define configurables here
65+
// define configurables here
6866
Configurable<int> mClusterDefinition{"clusterDefinition", 10, "cluster definition to be selected, e.g. 10=kV3Default"};
6967
Configurable<float> minTime{"minTime", -25., "Minimum cluster time for time cut"};
7068
Configurable<float> maxTime{"maxTime", 20., "Maximum cluster time for time cut"};
7169
Configurable<float> minM02{"minM02", 0.1, "Minimum M02 for M02 cut"};
7270
Configurable<float> maxM02{"maxM02", 0.9, "Maximum M02 for M02 cut"};
7371
Configurable<float> minTrackPt{"minTrackPt", 0.15, "Minimum pT for tracks"};
74-
Configurable<double> fHadCorr1{"HadCorr1", 1., "hadronic correction fraction for complete cluster energy subtraction for one matched track" }; //100% - default
75-
Configurable<double> fHadCorr2{"HadCorr2", 0.7, "hadronic correction fraction for systematic studies for one matched track"}; //70%
76-
Configurable<double> fHadCorralltrks1{"HadCorralltrks1", 1., "hadronic correction fraction for complete cluster energy subtraction for all matched tracks" }; //100% - all tracks
77-
Configurable<double> fHadCorralltrks2{"HadCorralltrks2", 0.7, "hadronic correction fraction for systematic studies for all matched tracks"}; //70%
72+
Configurable<double> fHadCorr1{"HadCorr1", 1., "hadronic correction fraction for complete cluster energy subtraction for one matched track"}; // 100% - default
73+
Configurable<double> fHadCorr2{"HadCorr2", 0.7, "hadronic correction fraction for systematic studies for one matched track"}; // 70%
74+
Configurable<double> fHadCorralltrks1{"HadCorralltrks1", 1., "hadronic correction fraction for complete cluster energy subtraction for all matched tracks"}; // 100% - all tracks
75+
Configurable<double> fHadCorralltrks2{"HadCorralltrks2", 0.7, "hadronic correction fraction for systematic studies for all matched tracks"}; // 70%
7876
Configurable<float> minDEta{"minDEta", 0.01, "Minimum dEta between track and cluster"};
7977
Configurable<float> minDPhi{"minDPhi", 0.01, "Minimum dPhi between track and cluster"};
8078
Configurable<double> fConstantSubtractionValue{"ConstantSubtractionValue", 0.236, "Value to be used for constant MIP subtraction (only applicable if using constant subtraction in M02 scheme)"};
8179

82-
//pT-dependent track-matching configurables
80+
// pT-dependent track-matching configurables
8381
Configurable<float> Eta0{"eta0", 0.04, "Param 0 in eta for pt-dependent matching"};
8482
Configurable<float> Eta1{"eta1", 0.010, "Param 1 in eta for pt-dependent matching"};
8583
Configurable<float> Eta2{"eta2", 2.5, "Param 2 in eta for pt-dependent matching"};
@@ -96,13 +94,13 @@ struct EmcalClusterHadronicCorrectionTask {
9694
Configurable<bool> UseFraction1{"UseFraction1", false, "Fractional momentum subtraction for Ecluster1 and EclusterAll1"};
9795
Configurable<bool> UseFraction2{"UseFraction2", false, "Fractional momentum subtraction for Ecluster2 and EclusterAll2"};
9896

99-
void init(o2::framework::InitContext&) {
100-
97+
void init(o2::framework::InitContext&)
98+
{
10199

102-
//Event histograms
100+
// Event histograms
103101
registry.add("h_allcollisions", "Total events; event status;entries", {HistType::kTH1F, {{1, 0.5, 1.5}}});
104102

105-
//Matched-Cluster histograms
103+
// Matched-Cluster histograms
106104
registry.add("h_matchedclusters", "Total matched clusters; cluster status;entries", {HistType::kTH1F, {{1, 0.5, 1.5}}});
107105
registry.add("h_ClsE", "; Cls E w/o correction (GeV); entries", {HistType::kTH1F, {{350, 0., 350.}}});
108106
registry.add("h_Ecluster1", "; Ecluster1 (GeV); entries", {HistType::kTH1F, {{350, 0., 350.}}});
@@ -111,21 +109,21 @@ struct EmcalClusterHadronicCorrectionTask {
111109
registry.add("h_EclusterAll2", "; EclusterAll2 (GeV); entries", {HistType::kTH1F, {{350, 0., 350.}}});
112110
registry.add("h_ClsTime", "Cluster time distribution of uncorrected cluster E; #it{t}_{cls} (ns); entries", {HistType::kTH1F, {{500, -250., 250.}}});
113111
registry.add("h_ClsM02", "Cluster M02 distribution of uncorrected cluster E; #it{M}_{02}; entries", {HistType::kTH1F, {{400, 0., 5.}}});
114-
registry.add("h2_ClsEvsNmatches", "Original cluster energy vs Nmatches; Cls E w/o correction (GeV); Nmatches", {HistType::kTH2F,{{350, 0., 350.},{100, -0.5, 21.}}});
115-
registry.add("h2_ClsEvsEcluster1", "; Cls E w/o correction (GeV); Ecluster1 (GeV)", {HistType::kTH2F,{{350, 0., 350.},{350, 0., 350.}}});
116-
registry.add("h2_ClsEvsEcluster2", "; Cls E w/o correction (GeV); Ecluster2 (GeV)", {HistType::kTH2F,{{350, 0., 350.},{350, 0., 350.}}});
117-
registry.add("h2_ClsEvsEclusterAll1", "; Cls E w/o correction (GeV); EclusterAll1 (GeV)", {HistType::kTH2F,{{350, 0., 350.},{350, 0., 350.}}});
118-
registry.add("h2_ClsEvsEclusterAll2", "; Cls E w/o correction (GeV); EclusterAll2 (GeV)", {HistType::kTH2F,{{350, 0., 350.},{350, 0., 350.}}});
112+
registry.add("h2_ClsEvsNmatches", "Original cluster energy vs Nmatches; Cls E w/o correction (GeV); Nmatches", {HistType::kTH2F, {{350, 0., 350.}, {100, -0.5, 21.}}});
113+
registry.add("h2_ClsEvsEcluster1", "; Cls E w/o correction (GeV); Ecluster1 (GeV)", {HistType::kTH2F, {{350, 0., 350.}, {350, 0., 350.}}});
114+
registry.add("h2_ClsEvsEcluster2", "; Cls E w/o correction (GeV); Ecluster2 (GeV)", {HistType::kTH2F, {{350, 0., 350.}, {350, 0., 350.}}});
115+
registry.add("h2_ClsEvsEclusterAll1", "; Cls E w/o correction (GeV); EclusterAll1 (GeV)", {HistType::kTH2F, {{350, 0., 350.}, {350, 0., 350.}}});
116+
registry.add("h2_ClsEvsEclusterAll2", "; Cls E w/o correction (GeV); EclusterAll2 (GeV)", {HistType::kTH2F, {{350, 0., 350.}, {350, 0., 350.}}});
119117

120-
//Matched-Track histograms
118+
// Matched-Track histograms
121119
registry.add("h_matchedtracks", "Total matched tracks; track status;entries", {HistType::kTH1F, {{1, 0.5, 1.5}}});
122120
}
123121

124122
Filter clusterDefinitionSelection = (o2::aod::emcalcluster::definition == mClusterDefinition) && (o2::aod::emcalcluster::time >= minTime) && (o2::aod::emcalcluster::time <= maxTime) && (o2::aod::emcalcluster::m02 > minM02) && (o2::aod::emcalcluster::m02 < maxM02);
125123
Filter trackSelection = (o2::aod::track::pt >= minTrackPt);
126-
//The matching of clusters and tracks is already centralised in the EMCAL framework.
127-
//One only needs to apply a filter on matched clusters
128-
//Here looping over all collisions matched to EMCAL clusters
124+
// The matching of clusters and tracks is already centralised in the EMCAL framework.
125+
// One only needs to apply a filter on matched clusters
126+
// Here looping over all collisions matched to EMCAL clusters
129127
void processMatchedCollisions(collisionEvSelIt const&, o2::aod::EMCALClusters const& clusters, o2::aod::EMCALMatchedTracks const& matchedtracks, myTracks const&)
130128
{
131129
registry.fill(HIST("h_allcollisions"), 1);
@@ -135,22 +133,25 @@ struct EmcalClusterHadronicCorrectionTask {
135133
return;
136134
}
137135

138-
//Looping over all clusters matched to the collision
136+
// Looping over all clusters matched to the collision
139137
for (const auto& cluster : clusters) {
140138
registry.fill(HIST("h_matchedclusters"), 1);
141139

142-
double Ecluster1; double Ecluster2; double EclusterAll1; double EclusterAll2;
140+
double Ecluster1;
141+
double Ecluster2;
142+
double EclusterAll1;
143+
double EclusterAll2;
143144
Ecluster1 = Ecluster2 = EclusterAll1 = EclusterAll2 = cluster.energy();
144145

145146
registry.fill(HIST("h_ClsE"), cluster.energy());
146147
registry.fill(HIST("h_ClsM02"), cluster.m02());
147148
registry.fill(HIST("h_ClsTime"), cluster.time());
148-
//selecting ALL MATCHED TRACKS after slicing all entries in perClusterMatchedTracks by the cluster globalIndex
149+
// selecting ALL MATCHED TRACKS after slicing all entries in perClusterMatchedTracks by the cluster globalIndex
149150
auto tracksofcluster = matchedtracks.sliceBy(perClusterMatchedTracks, cluster.globalIndex());
150151

151152
int Nmatches = 0; // counter for closest matched track
152153
double closestTrkP = 0.0; // closest track momentum
153-
double totalTrkP = 0.0; // total track momentum
154+
double totalTrkP = 0.0; // total track momentum
154155

155156
// pT-dependent track-matching instead of PID based track-matching to be adapted from Run 2 - suggested by Markus Fasel
156157

@@ -175,22 +176,22 @@ struct EmcalClusterHadronicCorrectionTask {
175176
continue;
176177
}
177178

178-
//Looping over all matched tracks for the cluster
179-
//Total number of matched tracks = 20 (hard-coded)
179+
// Looping over all matched tracks for the cluster
180+
// Total number of matched tracks = 20 (hard-coded)
180181
for (const auto& match : tracksofcluster) {
181182

182183
double mom = abs(match.track_as<myTracks>().p());
183184
registry.fill(HIST("h_matchedtracks"), 1);
184185

185-
//CASE 1: skip tracks with a very low pT
186+
// CASE 1: skip tracks with a very low pT
186187
if (mom < 1e-6) {
187188
continue;
188189
} // end CASE 1
189190

190-
//CASE 2:
191-
// a) If one matched track -> 100% energy subtraction
192-
// b) If more than one matched track -> 100% energy subtraction
193-
// c) If you want to do systematic studies -> perform the above two checks a) and b), and then subtract 70% energy instead of 100%
191+
// CASE 2:
192+
// a) If one matched track -> 100% energy subtraction
193+
// b) If more than one matched track -> 100% energy subtraction
194+
// c) If you want to do systematic studies -> perform the above two checks a) and b), and then subtract 70% energy instead of 100%
194195

195196
// Perform dEta/dPhi matching
196197
double dEta = match.track_as<myTracks>().trackEtaEmcal() - cluster.eta();
@@ -199,12 +200,11 @@ struct EmcalClusterHadronicCorrectionTask {
199200
// Apply the eta and phi matching thresholds
200201
// dEta and dPhi cut : ensures that the matched track is within the desired eta/phi window
201202

202-
//Do pT-dependent track matching
203-
if(doMomDepMatching)
204-
{
205-
auto trackEtaMax = funcPtDepEta.Eval(mom);
203+
// Do pT-dependent track matching
204+
if (doMomDepMatching) {
205+
auto trackEtaMax = funcPtDepEta.Eval(mom);
206206
auto trackPhiHigh = +funcPtDepPhi.Eval(mom);
207-
auto trackPhiLow = -funcPtDepPhi.Eval(mom);
207+
auto trackPhiLow = -funcPtDepPhi.Eval(mom);
208208

209209
if ((dPhi < trackPhiHigh && dPhi > trackPhiLow) && fabs(dEta) < trackEtaMax) {
210210
if (Nmatches == 0) {
@@ -221,13 +221,13 @@ struct EmcalClusterHadronicCorrectionTask {
221221

222222
// If track passes fixed dEta/dPhi cuts, process it
223223
if (Nmatches == 0) {
224-
closestTrkP = mom; // Closest track match
224+
closestTrkP = mom; // Closest track match
225225
}
226-
totalTrkP += mom; // Accumulate momentum
227-
Nmatches++; // Count this match
226+
totalTrkP += mom; // Accumulate momentum
227+
Nmatches++; // Count this match
228228
}
229229

230-
} // End of track loop
230+
} // End of track loop
231231
registry.fill(HIST("h2_ClsEvsNmatches"), cluster.energy(), Nmatches);
232232

233233
if (Nmatches >= 1) {
@@ -267,40 +267,42 @@ struct EmcalClusterHadronicCorrectionTask {
267267
} // process function ends
268268

269269
// Helper function to prevent negative energy subtraction
270-
double subtractClusterEnergy(double Ecluster, double mom, double correctionFactor, int Nmatches, bool UseFraction) {
270+
double subtractClusterEnergy(double Ecluster, double mom, double correctionFactor, int Nmatches, bool UseFraction)
271+
{
271272
double Ecorr = Ecluster;
272273

273274
// if (UseConstantSubtractionValue) {
274-
if(!UseFraction) {
275-
Ecorr = Ecluster- fConstantSubtractionValue* Nmatches; // Use constant value for MIP-subtraction (regardless of the cluster-shape)
275+
if (!UseFraction) {
276+
Ecorr = Ecluster - fConstantSubtractionValue * Nmatches; // Use constant value for MIP-subtraction (regardless of the cluster-shape)
276277
} else {
277-
Ecorr = Ecluster - correctionFactor * mom; // Fractional momentum subtraction
278+
Ecorr = Ecluster - correctionFactor * mom; // Fractional momentum subtraction
278279
}
279280
return (Ecorr < 0) ? 0 : Ecorr;
280281
}
281282

282283
// Helper function for M02-based energy subtraction (based on cluster-shape)
283-
double subtractM02ClusterEnergy(double m02, double Ecluster, int Nmatches, double totalTrkP, double correctionFactor, bool UseFraction) {
284+
double subtractM02ClusterEnergy(double m02, double Ecluster, int Nmatches, double totalTrkP, double correctionFactor, bool UseFraction)
285+
{
284286
double Ecorr = Ecluster;
285287

286288
// For M02 in the single photon region, the signal is primarily: Single photons, single electrons, single MIPs
287-
if (m02 > 0.1 && m02 < 0.4) { //circular clusters(electron/photon)
288-
Ecorr = Ecluster; // Single electron, single MIP
289+
if (m02 > 0.1 && m02 < 0.4) { // circular clusters(electron/photon)
290+
Ecorr = Ecluster; // Single electron, single MIP
289291
} else if (m02 > 0.4) {
290292
// Large M02 region (M02 > 0.4), more complex overlaps and hadronic showers.
291293
// The signal is primarily: Single hadronic shower, photon-photon overlap, photon-MIP overlap, MIP-MIP overlap,
292294
// MIP-hadronic shower overlap, hadronic shower - hadronic shower overlap)
293295

294296
if (!UseFraction) {
295-
Ecorr = Ecluster- fConstantSubtractionValue* Nmatches; // Use constant value for MIP-subtraction (regardless of the cluster-shape)
297+
Ecorr = Ecluster - fConstantSubtractionValue * Nmatches; // Use constant value for MIP-subtraction (regardless of the cluster-shape)
296298
} else {
297-
Ecorr = Ecluster - correctionFactor * totalTrkP; // Fractional momentum subtraction
299+
Ecorr = Ecluster - correctionFactor * totalTrkP; // Fractional momentum subtraction
298300
}
299301
}
300-
return (Ecorr < 0) ? 0 : Ecorr; // Prevent negative energy
302+
return (Ecorr < 0) ? 0 : Ecorr; // Prevent negative energy
301303
}
302304

303305
PROCESS_SWITCH(EmcalClusterHadronicCorrectionTask, processMatchedCollisions, "Process matched clusters from collision", true);
304-
}; //end of struct
306+
}; // end of struct
305307

306308
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask<EmcalClusterHadronicCorrectionTask>(cfgc, TaskName{"emcal-cluster-hadronic-correction-task"})}; }

0 commit comments

Comments
 (0)