1818#include " Common/DataModel/PIDResponse.h"
1919#include " Common/DataModel/TrackSelectionTables.h"
2020
21+ #include < CommonConstants/PhysicsConstants.h>
2122#include < Framework/ASoAHelpers.h>
2223#include < Framework/AnalysisTask.h>
2324#include < Framework/runDataProcessing.h>
2425
26+ #include < map>
27+
2528using namespace o2 ;
2629using namespace o2 ::constants::math;
30+ using namespace o2 ::constants::physics;
2731using namespace o2 ::framework;
2832using namespace o2 ::framework::expressions;
2933
3034enum PdgCode {
3135 kEta = 221 ,
3236 kOmega = 223 ,
33- kPhi = 333 ,
3437 kEtaPrime = 331
3538};
3639
3740enum SourceType {
38- NotElec = 0 , // not electron
39- DirectCharm = 1 , // electrons from prompt charm hadrons
40- DirectBeauty = 2 , // electrons from primary beauty hadrons
41- BeautyCharm = 3 , // electrons from non-prompt charm hadrons
42- DirectGamma = 4 , // electrons from direct photon
43- GammaPi0 = 5 ,
44- GammaEta = 6 ,
45- GammaOmega = 7 ,
46- GammaPhi = 8 ,
47- GammaEtaPrime = 9 ,
48- GammaRho0 = 10 ,
49- GammaK0s = 11 ,
50- GammaK0l = 12 ,
51- GammaKe3 = 13 ,
52- GammaLambda0 = 14 ,
53- GammaSigma = 15 ,
54- Pi0 = 16 ,
55- Eta = 17 ,
56- Omega = 18 ,
57- Phi = 19 ,
58- EtaPrime = 20 ,
59- Rho0 = 21 ,
60- K0s = 22 ,
61- K0l = 23 ,
62- Ke3 = 24 ,
63- Lambda0 = 25 ,
64- Sigma = 26 ,
65- Else = 27
41+ fNotElec = 0 , // not electron
42+ fDirectCharm = 1 , // electrons from prompt charm hadrons
43+ fDirectBeauty = 2 , // electrons from primary beauty hadrons
44+ fBeautyCharm = 3 , // electrons from non-prompt charm hadrons
45+ fDirectGamma = 4 , // electrons from direct photon
46+ fGammaPi0 = 5 ,
47+ fGammaEta = 6 ,
48+ fGammaOmega = 7 ,
49+ fGammaPhi = 8 ,
50+ fGammaEtaPrime = 9 ,
51+ fGammaRho0 = 10 ,
52+ fGammaK0s = 11 ,
53+ fGammaK0l = 12 ,
54+ fGammaKe3 = 13 ,
55+ fGammaLambda0 = 14 ,
56+ fGammaSigma = 15 ,
57+ fPi0 = 16 ,
58+ fEta = 17 ,
59+ fOmega = 18 ,
60+ fPhi = 19 ,
61+ fEtaPrime = 20 ,
62+ fRho0 = 21 ,
63+ fK0s = 22 ,
64+ fK0l = 23 ,
65+ fKe3 = 24 ,
66+ fLambda0 = 25 ,
67+ fSigma = 26 ,
68+ fElse = 27
6669};
6770
6871struct HfTaskSingleElectron {
@@ -118,38 +121,38 @@ struct HfTaskSingleElectron {
118121 void init (InitContext const &)
119122 {
120123 // create histograms
121- histos.add (" nEvents" , " Number of events" , kTH1F , {{1 , 0 ., 1 .}});
122- histos.add (" VtxZ" , " VtxZ; cm; entries" , kTH1F , {axisPosZ});
123- histos.add (" etaTrack" , " etaTrack; #eta; entries" , kTH1F , {axisEta});
124- histos.add (" ptTrack" , " #it{p}_{T} distribution of selected tracks; #it{p}_{T} (GeV/#it{c}); entries" , kTH1F , {axisPt});
124+ histos.add (" nEvents" , " Number of events" , kTH1D , {{1 , 0 ., 1 .}});
125+ histos.add (" VtxZ" , " VtxZ; cm; entries" , kTH1D , {axisPosZ});
126+ histos.add (" etaTrack" , " etaTrack; #eta; entries" , kTH1D , {axisEta});
127+ histos.add (" ptTrack" , " #it{p}_{T} distribution of selected tracks; #it{p}_{T} (GeV/#it{c}); entries" , kTH1D , {axisPt});
125128
126129 // QA plots for trigger track selection
127- histos.add (" tpcNClsTrack" , " tpcNClsTrack" , kTH1F , {{200 , 0 , 200 }});
128- histos.add (" tpcFoundFindableTrack" , " " , kTH1F , {{10 , 0 , 1 }});
129- histos.add (" tpcChi2Track" , " " , kTH1F , {{100 , 0 , 10 }});
130- histos.add (" itsIBClsTrack" , " " , kTH1F , {{10 , 0 , 10 }});
131- histos.add (" dcaXYTrack" , " " , kTH1F , {{600 , -3 , 3 }});
132- histos.add (" dcaZTrack" , " " , kTH1F , {{600 , -3 , 3 }});
130+ histos.add (" tpcNClsTrack" , " tpcNClsTrack" , kTH1D , {{200 , 0 , 200 }});
131+ histos.add (" tpcFoundFindableTrack" , " " , kTH1D , {{10 , 0 , 1 }});
132+ histos.add (" tpcChi2Track" , " " , kTH1D , {{100 , 0 , 10 }});
133+ histos.add (" itsIBClsTrack" , " " , kTH1D , {{10 , 0 , 10 }});
134+ histos.add (" dcaXYTrack" , " " , kTH1D , {{600 , -3 , 3 }});
135+ histos.add (" dcaZTrack" , " " , kTH1D , {{600 , -3 , 3 }});
133136
134137 // pid
135- histos.add (" tofNSigPt" , " " , kTH2F , {{axisPtEl}, {axisNsig}});
136- histos.add (" tofNSigPtQA" , " " , kTH2F , {{axisPtEl}, {axisNsig}});
137- histos.add (" tpcNSigPt" , " " , kTH2F , {{axisPtEl}, {axisNsig}});
138- histos.add (" tpcNSigPtAfterTofCut" , " " , kTH2F , {{axisPtEl}, {axisNsig}});
139- histos.add (" tpcNSigPtQA" , " " , kTH2F , {{axisPtEl}, {axisNsig}});
138+ histos.add (" tofNSigPt" , " " , kTH2D , {{axisPtEl}, {axisNsig}});
139+ histos.add (" tofNSigPtQA" , " " , kTH2D , {{axisPtEl}, {axisNsig}});
140+ histos.add (" tpcNSigPt" , " " , kTH2D , {{axisPtEl}, {axisNsig}});
141+ histos.add (" tpcNSigPtAfterTofCut" , " " , kTH2D , {{axisPtEl}, {axisNsig}});
142+ histos.add (" tpcNSigPtQA" , " " , kTH2D , {{axisPtEl}, {axisNsig}});
140143
141144 // track impact parameter
142- histos.add (" dcaTrack" , " " , kTH2F , {{axisPtEl}, {axisTrackIp}});
143- histos.add (" dcaBeauty" , " " , kTH2F , {{axisPtEl}, {axisTrackIp}});
144- histos.add (" dcaCharm" , " " , kTH2F , {{axisPtEl}, {axisTrackIp}});
145- histos.add (" dcaDalitz" , " " , kTH2F , {{axisPtEl}, {axisTrackIp}});
146- histos.add (" dcaConv" , " " , kTH2F , {{axisPtEl}, {axisTrackIp}});
145+ histos.add (" dcaTrack" , " " , kTH2D , {{axisPtEl}, {axisTrackIp}});
146+ histos.add (" dcaBeauty" , " " , kTH2D , {{axisPtEl}, {axisTrackIp}});
147+ histos.add (" dcaCharm" , " " , kTH2D , {{axisPtEl}, {axisTrackIp}});
148+ histos.add (" dcaDalitz" , " " , kTH2D , {{axisPtEl}, {axisTrackIp}});
149+ histos.add (" dcaConv" , " " , kTH2D , {{axisPtEl}, {axisTrackIp}});
147150
148151 // QA plots for MC
149- histos.add (" hPdgC" , " " , kTH1F , {{10001 , -0.5 , 10000.5 }});
150- histos.add (" hPdgB" , " " , kTH1F , {{10001 , -0.5 , 10000.5 }});
151- histos.add (" hPdgDa" , " " , kTH1F , {{10001 , -0.5 , 10000.5 }});
152- histos.add (" hPdgCo" , " " , kTH1F , {{10001 , -0.5 , 10000.5 }});
152+ histos.add (" hPdgC" , " " , kTH1D , {{10001 , -0.5 , 10000.5 }});
153+ histos.add (" hPdgB" , " " , kTH1D , {{10001 , -0.5 , 10000.5 }});
154+ histos.add (" hPdgDa" , " " , kTH1D , {{10001 , -0.5 , 10000.5 }});
155+ histos.add (" hPdgCo" , " " , kTH1D , {{10001 , -0.5 , 10000.5 }});
153156 }
154157
155158 template <typename TrackType>
@@ -191,7 +194,7 @@ struct HfTaskSingleElectron {
191194 {
192195 auto mcpart = track.mcParticle ();
193196 if (std::abs (mcpart.pdgCode ()) != kElectron ) {
194- return NotElec ;
197+ return fNotElec ;
195198 }
196199
197200 int motherPdg = -999 ;
@@ -220,27 +223,27 @@ struct HfTaskSingleElectron {
220223 auto const & grmothersIdsVec = mctrack.front ().mothersIds ();
221224
222225 if (grmothersIdsVec.empty ()) {
223- return DirectCharm ;
226+ return fDirectCharm ;
224227 } else {
225228 grmotherPt = mctrack.front ().pt ();
226229 grmotherPdg = std::abs (mctrack.front ().pdgCode ());
227230 if ((static_cast <int >(grmotherPdg / 100 .) % 10 ) == kBottom || (static_cast <int >(grmotherPdg / 1000 .) % 10 ) == kBottom ) {
228231 mpt = grmotherPt;
229232 mpdg = grmotherPdg;
230- return BeautyCharm ;
233+ return fBeautyCharm ;
231234 }
232235 }
233236 }
234237 partMother = mctrack;
235238 }
236239 } else if ((static_cast <int >(motherPdg / 100 .) % 10 ) == kBottom || (static_cast <int >(motherPdg / 1000 .) % 10 ) == kBottom ) { // check if electron from beauty hadrons
237- return DirectBeauty ;
240+ return fDirectBeauty ;
238241 } else if (motherPdg == kGamma ) { // check if electron from photon conversion
239242 mctrack = partMother.front ().template mothers_as <aod::McParticles>();
240243 if (mctrack.size ()) {
241244 auto const & grmothersIdsVec = mctrack.front ().mothersIds ();
242245 if (grmothersIdsVec.empty ()) {
243- return DirectGamma ;
246+ return fDirectGamma ;
244247 } else {
245248 grmotherPdg = std::abs (mctrack.front ().pdgCode ());
246249 mpdg = grmotherPdg;
@@ -252,19 +255,19 @@ struct HfTaskSingleElectron {
252255 auto const & ggrmothersIdsVec = mctrack.front ().mothersIds ();
253256 if (ggrmothersIdsVec.empty ()) {
254257 if (grmotherPdg == kPi0 ) {
255- return GammaPi0 ;
258+ return fGammaPi0 ;
256259 } else if (grmotherPdg == kEta ) {
257- return GammaEta ;
260+ return fGammaEta ;
258261 } else if (grmotherPdg == kOmega ) {
259- return GammaOmega ;
262+ return fGammaOmega ;
260263 } else if (grmotherPdg == kPhi ) {
261- return GammaPhi ;
264+ return fGammaPhi ;
262265 } else if (grmotherPdg == kEtaPrime ) {
263- return GammaEtaPrime ;
266+ return fGammaEtaPrime ;
264267 } else if (grmotherPdg == kRho770_0 ) {
265- return GammaRho0 ;
268+ return fGammaRho0 ;
266269 } else {
267- return Else ;
270+ return fElse ;
268271 }
269272 } else {
270273 ggrmotherPdg = mctrack.front ().pdgCode ();
@@ -273,42 +276,42 @@ struct HfTaskSingleElectron {
273276 mpt = ggrmotherPt;
274277 if (grmotherPdg == kPi0 ) {
275278 if (ggrmotherPdg == kK0Short ) {
276- return GammaK0s ;
279+ return fGammaK0s ;
277280 } else if (ggrmotherPdg == kK0Long ) {
278- return GammaK0l ;
281+ return fGammaK0l ;
279282 } else if (ggrmotherPdg == kKPlus ) {
280- return GammaKe3 ;
283+ return fGammaKe3 ;
281284 } else if (ggrmotherPdg == kLambda0 ) {
282- return GammaLambda0 ;
285+ return fGammaLambda0 ;
283286 } else if (ggrmotherPdg == kSigmaPlus ) {
284- return GammaSigma ;
287+ return fGammaSigma ;
285288 } else {
286289 mpdg = grmotherPdg;
287290 mpt = grmotherPt;
288- return GammaPi0 ;
291+ return fGammaPi0 ;
289292 }
290293 } else if (grmotherPdg == kEta ) {
291294 mpdg = grmotherPdg;
292295 mpt = grmotherPt;
293- return GammaEta ;
296+ return fGammaEta ;
294297 } else if (grmotherPdg == kOmega ) {
295298 mpdg = grmotherPdg;
296299 mpt = grmotherPt;
297- return GammaOmega ;
300+ return fGammaOmega ;
298301 } else if (grmotherPdg == kPhi ) {
299302 mpdg = grmotherPdg;
300303 mpt = grmotherPt;
301- return GammaPhi ;
304+ return fGammaPhi ;
302305 } else if (grmotherPdg == kEtaPrime ) {
303306 mpdg = grmotherPdg;
304307 mpt = grmotherPt;
305- return GammaEtaPrime ;
308+ return fGammaEtaPrime ;
306309 } else if (grmotherPdg == kRho770_0 ) {
307310 mpdg = grmotherPdg;
308311 mpt = grmotherPt;
309- return GammaRho0 ;
312+ return fGammaRho0 ;
310313 } else {
311- return Else ;
314+ return fElse ;
312315 }
313316 }
314317 }
@@ -319,68 +322,65 @@ struct HfTaskSingleElectron {
319322 if (mctrack.size ()) {
320323 auto const & grmothersIdsVec = mctrack.front ().mothersIds ();
321324 if (grmothersIdsVec.empty ()) {
322- if (motherPdg == kPi0 ) {
323- return Pi0;
324- } else if (motherPdg == kEta ) {
325- return Eta;
326- } else if (motherPdg == kOmega ) {
327- return Omega;
328- } else if (motherPdg == kPhi ) {
329- return Phi;
330- } else if (motherPdg == kEtaPrime ) {
331- return EtaPrime;
332- } else if (motherPdg == kRho770_0 ) {
333- return Rho0;
334- } else if (motherPdg == kKPlus ) {
335- return Ke3;
336- } else if (motherPdg == kK0Long ) {
337- return K0l;
338- } else {
339- return Else;
325+ static const std::map<int , SourceType> pdgToSource = {
326+ {kPi0 , fPi0 },
327+ {kEta , fEta },
328+ {kOmega , fOmega },
329+ {kPhi , fPhi },
330+ {kEtaPrime , fEtaPrime },
331+ {kRho770_0 , fRho0 },
332+ {kKPlus , fKe3 },
333+ {kK0Long , fK0l }};
334+
335+ auto it = pdgToSource.find (motherPdg);
336+ if (it != pdgToSource.end ()) {
337+ return it->second ;
340338 }
339+ return fElse ;
340+
341341 } else {
342342 if (motherPdg == kPi0 ) {
343343 grmotherPt = mctrack.front ().pt ();
344344 grmotherPdg = mctrack.front ().pdgCode ();
345345 mpt = grmotherPt;
346346 mpdg = grmotherPdg;
347347 if (grmotherPdg == kK0Short ) {
348- return K0s ;
348+ return fK0s ;
349349 } else if (grmotherPdg == kK0Long ) {
350- return K0l ;
350+ return fK0l ;
351351 } else if (grmotherPdg == kKPlus ) {
352- return Ke3 ;
352+ return fKe3 ;
353353 } else if (grmotherPdg == kLambda0 ) {
354- return Lambda0 ;
354+ return fLambda0 ;
355355 } else if (grmotherPdg == kSigmaPlus ) {
356- return Sigma ;
356+ return fSigma ;
357357 } else {
358358 mpt = motherPt;
359359 mpdg = motherPdg;
360- return Pi0 ;
360+ return fPi0 ;
361361 }
362362 } else if (motherPdg == kEta ) {
363- return Eta ;
363+ return fEta ;
364364 } else if (motherPdg == kOmega ) {
365- return Omega ;
365+ return fOmega ;
366366 } else if (motherPdg == kPhi ) {
367- return Phi ;
367+ return fPhi ;
368368 } else if (motherPdg == kEtaPrime ) {
369- return EtaPrime ;
369+ return fEtaPrime ;
370370 } else if (motherPdg == kRho770_0 ) {
371- return Rho0 ;
371+ return fRho0 ;
372372 } else if (motherPdg == kKPlus ) {
373- return Ke3 ;
373+ return fKe3 ;
374374 } else if (motherPdg == kK0Long ) {
375- return K0l ;
375+ return fK0l ;
376376 } else {
377- return Else ;
377+ return fElse ;
378378 }
379379 }
380380 }
381381 }
382382
383- return Else ;
383+ return fElse ;
384384 }
385385
386386 void processData (soa::Filtered<MyCollisions>::iterator const & collision,
@@ -474,22 +474,22 @@ struct HfTaskSingleElectron {
474474 double mpt; // electron source pt
475475 int source = getElecSource (track, mpt, mpdg);
476476
477- if (source == DirectBeauty || source == BeautyCharm ) {
477+ if (source == fDirectBeauty || source == fBeautyCharm ) {
478478 histos.fill (HIST (" hPdgB" ), mpdg);
479479 histos.fill (HIST (" dcaBeauty" ), track.pt (), track.dcaXY ());
480480 }
481481
482- if (source == DirectCharm ) {
482+ if (source == fDirectCharm ) {
483483 histos.fill (HIST (" hPdgC" ), mpdg);
484484 histos.fill (HIST (" dcaCharm" ), track.pt (), track.dcaXY ());
485485 }
486486
487- if (source >= GammaPi0 && source <= GammaSigma ) {
487+ if (source >= fGammaPi0 && source <= fGammaSigma ) {
488488 histos.fill (HIST (" hPdgCo" ), mpdg);
489489 histos.fill (HIST (" dcaConv" ), track.pt (), track.dcaXY ());
490490 }
491491
492- if (source >= Pi0 && source <= Sigma ) {
492+ if (source >= fPi0 && source <= fSigma ) {
493493 histos.fill (HIST (" hPdgDa" ), mpdg);
494494 histos.fill (HIST (" dcaDalitz" ), track.pt (), track.dcaXY ());
495495 }
0 commit comments