Skip to content

Commit 1d59041

Browse files
committed
fixes
1 parent 7787cd9 commit 1d59041

1 file changed

Lines changed: 74 additions & 73 deletions

File tree

‎PWGUD/TableProducer/twoFwdTracksEventTableProducer.cxx‎

Lines changed: 74 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
#include <Framework/OutputObjHeader.h>
3434
#include <Framework/runDataProcessing.h>
3535

36-
#include <Math/Vector4D.h>
36+
#include <Math/Vector4D.h> // IWYU pragma: keep (do not replace with Math/Vector4Dfwd.h)
37+
#include <Math/Vector4Dfwd.h>
3738
#include <TH1.h>
3839
#include <TString.h>
3940

@@ -59,36 +60,36 @@ constexpr float DefaultFloat = -999.f; // value of float columns without infor
5960
constexpr uint32_t DefaultMIDBoards = 0; // value of MID-board columns without information
6061

6162
enum EventSelection {
62-
kEvSelAll = 0,
63-
kEvSelFV0Veto,
64-
kEvSelNumContrib,
65-
kEvSelTwoTracks,
66-
kEvSelInvariantMass,
67-
kEvSelSystemPt,
68-
kEvSelOneTrackMomentum,
69-
kEvSelBothTracksMomentum,
70-
kNEvSels
63+
EvSelAll = 0,
64+
EvSelFV0Veto,
65+
EvSelNumContrib,
66+
EvSelTwoTracks,
67+
EvSelInvariantMass,
68+
EvSelSystemPt,
69+
EvSelOneTrackMomentum,
70+
EvSelBothTracksMomentum,
71+
NEvSels
7172
};
7273

7374
enum FwdTrackSelection {
74-
kTrkSelAll = 0,
75-
kTrkSelType,
76-
kTrkSelPt,
77-
kTrkSelEta,
78-
kTrkSelRabs,
79-
kTrkSelPDca,
80-
kTrkSelChi2,
81-
kTrkSelChi2MatchMCHMFT,
82-
kNTrkSels
75+
TrkSelAll = 0,
76+
TrkSelType,
77+
TrkSelPt,
78+
TrkSelEta,
79+
TrkSelRabs,
80+
TrkSelPDca,
81+
TrkSelChi2,
82+
TrkSelChi2MatchMCHMFT,
83+
NTrkSels
8384
};
8485

8586
enum TruthTrouble {
86-
kTroubleTooManyMothers = 1,
87-
kTroubleTooManyDaughters,
88-
kTroubleNoTrack,
89-
kTroubleMoreTracks,
90-
kTroubleDifferentCandidates,
91-
kNTroubles
87+
TroubleTooManyMothers = 1,
88+
TroubleTooManyDaughters,
89+
TroubleNoTrack,
90+
TroubleMoreTracks,
91+
TroubleDifferentCandidates,
92+
NTroubles
9293
};
9394

9495
// reco-level information of one row, shared by the measured and the simulated table
@@ -100,8 +101,8 @@ struct RecoInfo {
100101
float posY{DefaultFloat};
101102
float posZ{DefaultFloat};
102103
float totalFV0AmplitudeA{DefaultFloat};
103-
std::vector<float> amplitudesV0A{};
104-
std::vector<int8_t> ampRelBCsV0A{};
104+
std::vector<float> amplitudesV0A;
105+
std::vector<int8_t> ampRelBCsV0A;
105106
float energyCommonZNA{DefaultFloat};
106107
float energyCommonZNC{DefaultFloat};
107108
float timeZNA{DefaultFloat};
@@ -194,38 +195,38 @@ struct TwoFwdTracksEventTableProducer {
194195
if (verboseInfo)
195196
printMediumMessage("INIT METHOD");
196197

197-
histos.add("Reco/hSelections", "Effect of selections;;Number of events (-)", HistType::kTH1D, {{kNEvSels, -0.5, kNEvSels - 0.5}});
198+
histos.add("Reco/hSelections", "Effect of selections;;Number of events (-)", HistType::kTH1D, {{NEvSels, -0.5, static_cast<double>(NEvSels) - 0.5}});
198199
auto hSel = histos.get<TH1>(HIST("Reco/hSelections"));
199-
hSel->GetXaxis()->SetBinLabel(kEvSelAll + 1, "All");
200-
hSel->GetXaxis()->SetBinLabel(kEvSelFV0Veto + 1, "FV0A veto");
201-
hSel->GetXaxis()->SetBinLabel(kEvSelNumContrib + 1, "N contrib.");
202-
hSel->GetXaxis()->SetBinLabel(kEvSelTwoTracks + 1, "2 sel. tracks");
203-
hSel->GetXaxis()->SetBinLabel(kEvSelInvariantMass + 1, "Inv. mass");
204-
hSel->GetXaxis()->SetBinLabel(kEvSelSystemPt + 1, "System pT");
205-
hSel->GetXaxis()->SetBinLabel(kEvSelOneTrackMomentum + 1, "One trk p");
206-
hSel->GetXaxis()->SetBinLabel(kEvSelBothTracksMomentum + 1, "Both trks p");
207-
208-
histos.add("Reco/hFwdTrackSelections", "Effect of forward track selections;;Number of tracks (-)", HistType::kTH1D, {{kNTrkSels, -0.5, kNTrkSels - 0.5}});
200+
hSel->GetXaxis()->SetBinLabel(EvSelAll + 1, "All");
201+
hSel->GetXaxis()->SetBinLabel(EvSelFV0Veto + 1, "FV0A veto");
202+
hSel->GetXaxis()->SetBinLabel(EvSelNumContrib + 1, "N contrib.");
203+
hSel->GetXaxis()->SetBinLabel(EvSelTwoTracks + 1, "2 sel. tracks");
204+
hSel->GetXaxis()->SetBinLabel(EvSelInvariantMass + 1, "Inv. mass");
205+
hSel->GetXaxis()->SetBinLabel(EvSelSystemPt + 1, "System pT");
206+
hSel->GetXaxis()->SetBinLabel(EvSelOneTrackMomentum + 1, "One trk p");
207+
hSel->GetXaxis()->SetBinLabel(EvSelBothTracksMomentum + 1, "Both trks p");
208+
209+
histos.add("Reco/hFwdTrackSelections", "Effect of forward track selections;;Number of tracks (-)", HistType::kTH1D, {{NTrkSels, -0.5, static_cast<double>(NTrkSels) - 0.5}});
209210
auto hTrkSel = histos.get<TH1>(HIST("Reco/hFwdTrackSelections"));
210-
hTrkSel->GetXaxis()->SetBinLabel(kTrkSelAll + 1, "All");
211-
hTrkSel->GetXaxis()->SetBinLabel(kTrkSelType + 1, "Track type");
212-
hTrkSel->GetXaxis()->SetBinLabel(kTrkSelPt + 1, "pT");
213-
hTrkSel->GetXaxis()->SetBinLabel(kTrkSelEta + 1, "#eta");
214-
hTrkSel->GetXaxis()->SetBinLabel(kTrkSelRabs + 1, "R_{abs}");
215-
hTrkSel->GetXaxis()->SetBinLabel(kTrkSelPDca + 1, "pDCA");
216-
hTrkSel->GetXaxis()->SetBinLabel(kTrkSelChi2 + 1, "#chi^{2}");
217-
hTrkSel->GetXaxis()->SetBinLabel(kTrkSelChi2MatchMCHMFT + 1, "#chi^{2}_{MCH-MFT}");
211+
hTrkSel->GetXaxis()->SetBinLabel(TrkSelAll + 1, "All");
212+
hTrkSel->GetXaxis()->SetBinLabel(TrkSelType + 1, "Track type");
213+
hTrkSel->GetXaxis()->SetBinLabel(TrkSelPt + 1, "pT");
214+
hTrkSel->GetXaxis()->SetBinLabel(TrkSelEta + 1, "#eta");
215+
hTrkSel->GetXaxis()->SetBinLabel(TrkSelRabs + 1, "R_{abs}");
216+
hTrkSel->GetXaxis()->SetBinLabel(TrkSelPDca + 1, "pDCA");
217+
hTrkSel->GetXaxis()->SetBinLabel(TrkSelChi2 + 1, "#chi^{2}");
218+
hTrkSel->GetXaxis()->SetBinLabel(TrkSelChi2MatchMCHMFT + 1, "#chi^{2}_{MCH-MFT}");
218219

219220
histos.add("Reco/hNanalyzedPerRun", "N analyzed events per run;Run number (-);Number of analyzed events (-)", HistType::kTH1D, {{1, 0., 1.}});
220221
histos.add("Reco/hNselectedPerRun", "N selected events per run;Run number (-);Number of selected events (-)", HistType::kTH1D, {{1, 0., 1.}});
221222

222-
histos.add("Truth/hTroubles", "Counter of unwanted issues;;Number of troubles (-)", HistType::kTH1D, {{kNTroubles - 1, 0.5, kNTroubles - 0.5}});
223+
histos.add("Truth/hTroubles", "Counter of unwanted issues;;Number of troubles (-)", HistType::kTH1D, {{NTroubles - 1, 0.5, static_cast<double>(NTroubles) - 0.5}});
223224
auto hTroubles = histos.get<TH1>(HIST("Truth/hTroubles"));
224-
hTroubles->GetXaxis()->SetBinLabel(kTroubleTooManyMothers + 1, "> 2 mothers");
225-
hTroubles->GetXaxis()->SetBinLabel(kTroubleTooManyDaughters + 1, "> 2 charged daughters");
226-
hTroubles->GetXaxis()->SetBinLabel(kTroubleNoTrack + 1, "Daughter without track");
227-
hTroubles->GetXaxis()->SetBinLabel(kTroubleMoreTracks + 1, "Daughter in > 1 cand.");
228-
hTroubles->GetXaxis()->SetBinLabel(kTroubleDifferentCandidates + 1, "Daughters in diff. cand.");
225+
hTroubles->GetXaxis()->SetBinLabel(TroubleTooManyMothers + 1, "> 2 mothers");
226+
hTroubles->GetXaxis()->SetBinLabel(TroubleTooManyDaughters + 1, "> 2 charged daughters");
227+
hTroubles->GetXaxis()->SetBinLabel(TroubleNoTrack + 1, "Daughter without track");
228+
hTroubles->GetXaxis()->SetBinLabel(TroubleMoreTracks + 1, "Daughter in > 1 cand.");
229+
hTroubles->GetXaxis()->SetBinLabel(TroubleDifferentCandidates + 1, "Daughters in diff. cand.");
229230
} // end init
230231

231232
bool isAcceptedTrackType(uint8_t trackType)
@@ -264,40 +265,40 @@ struct TwoFwdTracksEventTableProducer {
264265
if (fillHistos)
265266
histos.fill(HIST("Reco/hFwdTrackSelections"), step);
266267
};
267-
countPassed(kTrkSelAll);
268+
countPassed(TrkSelAll);
268269

269270
if (!isAcceptedTrackType(track.trackType()))
270271
return false;
271-
countPassed(kTrkSelType);
272+
countPassed(TrkSelType);
272273

273274
if (!cutFwdTrack.applyFwdTrackSelection)
274275
return true;
275276

276277
const auto vec = muonVector(track);
277278
if (vec.Pt() < cutFwdTrack.cutMinPt || vec.Pt() > cutFwdTrack.cutMaxPt)
278279
return false;
279-
countPassed(kTrkSelPt);
280+
countPassed(TrkSelPt);
280281

281282
if (vec.Eta() < cutFwdTrack.cutMinEta || vec.Eta() > cutFwdTrack.cutMaxEta)
282283
return false;
283-
countPassed(kTrkSelEta);
284+
countPassed(TrkSelEta);
284285

285286
if (track.rAtAbsorberEnd() < cutFwdTrack.cutMinRabs || track.rAtAbsorberEnd() > cutFwdTrack.cutMaxRabs)
286287
return false;
287-
countPassed(kTrkSelRabs);
288+
countPassed(TrkSelRabs);
288289

289290
float maxPDca = track.rAtAbsorberEnd() < upchelpers::AbsorberMid ? cutFwdTrack.cutMaxPDcaLowRabs : cutFwdTrack.cutMaxPDcaHighRabs;
290291
if (track.pDca() > maxPDca)
291292
return false;
292-
countPassed(kTrkSelPDca);
293+
countPassed(TrkSelPDca);
293294

294295
if (track.chi2() > cutFwdTrack.cutMaxChi2)
295296
return false;
296-
countPassed(kTrkSelChi2);
297+
countPassed(TrkSelChi2);
297298

298299
if (hasMFT(track.trackType()) && track.chi2MatchMCHMFT() > cutFwdTrack.cutMaxChi2MatchMCHMFT)
299300
return false;
300-
countPassed(kTrkSelChi2MatchMCHMFT);
301+
countPassed(TrkSelChi2MatchMCHMFT);
301302

302303
return true;
303304
}
@@ -402,15 +403,15 @@ struct TwoFwdTracksEventTableProducer {
402403
const char* srun = Form("%d", cand.runNumber());
403404
histos.get<TH1>(HIST("Reco/hNanalyzedPerRun"))->Fill(srun, 1);
404405

405-
histos.fill(HIST("Reco/hSelections"), kEvSelAll);
406+
histos.fill(HIST("Reco/hSelections"), EvSelAll);
406407

407408
if (cutSample.useFV0Veto && getMaxFV0Amplitude(cand, cutSample.cutFV0RelBcRange) > cutSample.cutMaxFV0Amp)
408409
return;
409-
histos.fill(HIST("Reco/hSelections"), kEvSelFV0Veto);
410+
histos.fill(HIST("Reco/hSelections"), EvSelFV0Veto);
410411

411412
if (cutSample.useNumContrib && cand.numContrib() != cutSample.cutNumContrib)
412413
return;
413-
histos.fill(HIST("Reco/hSelections"), kEvSelNumContrib);
414+
histos.fill(HIST("Reco/hSelections"), EvSelNumContrib);
414415

415416
RecoInfo info;
416417
std::array<ROOT::Math::PxPyPzMVector, NumTracks> daug;
@@ -428,30 +429,30 @@ struct TwoFwdTracksEventTableProducer {
428429
// Critical selection, without it the rest of the process function will fail
429430
if (nSelected != NumTracks)
430431
return;
431-
histos.fill(HIST("Reco/hSelections"), kEvSelTwoTracks);
432+
histos.fill(HIST("Reco/hSelections"), EvSelTwoTracks);
432433

433434
const auto mother = daug[0] + daug[1];
434435

435436
// Apply system selections
436437
// invariant mass
437438
if (mother.M() < cutPreselect.preselMinInvariantMass || mother.M() > cutPreselect.preselMaxInvariantMass)
438439
return;
439-
histos.fill(HIST("Reco/hSelections"), kEvSelInvariantMass);
440+
histos.fill(HIST("Reco/hSelections"), EvSelInvariantMass);
440441

441442
// system pt
442443
if (cutPreselect.preselUseOppositeSystemPtCut ? mother.Pt() < cutPreselect.preselSystemPtCut : mother.Pt() > cutPreselect.preselSystemPtCut)
443444
return;
444-
histos.fill(HIST("Reco/hSelections"), kEvSelSystemPt);
445+
histos.fill(HIST("Reco/hSelections"), EvSelSystemPt);
445446

446447
// one track momentum
447448
if (daug[0].P() < cutPreselect.preselMinTrackMomentum && daug[1].P() < cutPreselect.preselMinTrackMomentum)
448449
return;
449-
histos.fill(HIST("Reco/hSelections"), kEvSelOneTrackMomentum);
450+
histos.fill(HIST("Reco/hSelections"), EvSelOneTrackMomentum);
450451

451452
// both tracks momentum
452453
if (cutPreselect.preselUseMinMomentumOnBothTracks && (daug[0].P() < cutPreselect.preselMinTrackMomentum || daug[1].P() < cutPreselect.preselMinTrackMomentum))
453454
return;
454-
histos.fill(HIST("Reco/hSelections"), kEvSelBothTracksMomentum);
455+
histos.fill(HIST("Reco/hSelections"), EvSelBothTracksMomentum);
455456

456457
histos.get<TH1>(HIST("Reco/hNselectedPerRun"))->Fill(srun, 1);
457458

@@ -484,7 +485,7 @@ struct TwoFwdTracksEventTableProducer {
484485
if (static_cast<int>(daughterIds.size()) >= NumTracks) {
485486
if (verboseInfo)
486487
printLargeMessage("Truth collision has more than 2 total charged daughters. Breaking the daughter loop.");
487-
histos.fill(HIST("Truth/hTroubles"), kTroubleTooManyDaughters);
488+
histos.fill(HIST("Truth/hTroubles"), TroubleTooManyDaughters);
488489
truth.problem = true;
489490
return false;
490491
}
@@ -509,7 +510,7 @@ struct TwoFwdTracksEventTableProducer {
509510
if (countMothers > NumTracks) {
510511
if (verboseInfo)
511512
printLargeMessage("Truth collision has more than 2 no mother particles. Breaking the particle loop.");
512-
histos.fill(HIST("Truth/hTroubles"), kTroubleTooManyMothers);
513+
histos.fill(HIST("Truth/hTroubles"), TroubleTooManyMothers);
513514
truth.problem = true;
514515
break;
515516
}
@@ -548,12 +549,12 @@ struct TwoFwdTracksEventTableProducer {
548549
if (candTracks.empty()) {
549550
if (verboseInfo)
550551
printLargeMessage("Daughter has no associated track. Skipping this daughter.");
551-
histos.fill(HIST("Truth/hTroubles"), kTroubleNoTrack);
552+
histos.fill(HIST("Truth/hTroubles"), TroubleNoTrack);
552553
truth.problem = true;
553554
continue;
554555
}
555556
if (candTracks.size() > 1)
556-
histos.fill(HIST("Truth/hTroubles"), kTroubleMoreTracks);
557+
histos.fill(HIST("Truth/hTroubles"), TroubleMoreTracks);
557558
nRecoDaughters++;
558559
} // daughters
559560

@@ -579,7 +580,7 @@ struct TwoFwdTracksEventTableProducer {
579580
if (bestScore.first < nRecoDaughters) {
580581
if (verboseInfo)
581582
printLargeMessage("Daughters are reconstructed in different candidates.");
582-
histos.fill(HIST("Truth/hTroubles"), kTroubleDifferentCandidates);
583+
histos.fill(HIST("Truth/hTroubles"), TroubleDifferentCandidates);
583584
truth.problem = true;
584585
}
585586
truth.hasRecoColl = true;

0 commit comments

Comments
 (0)