Skip to content

Commit b03655e

Browse files
[PWGLF] NucleiTask - Fix ITS PID related MC bug (#10210)
1 parent bddf56f commit b03655e

File tree

1 file changed

+47
-32
lines changed

1 file changed

+47
-32
lines changed

PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx

Lines changed: 47 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
///
1717
/// \author Giovanni Malfattore <giovanni.malfattore@cern.ch> and Rutuparna Rath <rutuparna.rath@cern.ch>
1818
///
19+
20+
#include "PWGLF/DataModel/LFNucleiTables.h"
21+
1922
#include "EventFiltering/Zorro.h"
2023
#include "EventFiltering/ZorroSummary.h"
21-
2224
#include "CCDB/BasicCCDBManager.h"
2325
#include <string>
24-
25-
#include "PWGLF/DataModel/LFNucleiTables.h"
2626
#include <TLorentzVector.h>
2727
#include <TF1.h>
2828
#include "ReconstructionDataFormats/Track.h"
@@ -145,8 +145,11 @@ struct LFNucleiBATask {
145145
ConfigurableAxis avClsBins{"avClsBins", {200, 0, 20}, "Binning in average cluster size"};
146146

147147
// Enable custom cuts/debug functions
148-
Configurable<bool> enableFiltering{"enableFiltering", false, "Flag to enable filtering for p,d,t,He only -- disable if launch on skimmed dataset!"};
149-
Configurable<bool> enableEvTimeSplitting{"enableEvTimeSplitting", false, "Flag to enable histograms splitting depending on the Event Time used"};
148+
struct : ConfigurableGroup {
149+
Configurable<bool> enableFiltering{"enableFiltering", false, "Flag to enable filtering for p,d,t,He only -- disable if launch on skimmed dataset!"};
150+
Configurable<bool> enableIsGlobalTrack{"enableIsGlobalTrack", true, "Flag to enable IsGlobalTrackWoDCA"};
151+
Configurable<bool> enableEvTimeSplitting{"enableEvTimeSplitting", false, "Flag to enable histograms splitting depending on the Event Time used"};
152+
} filterOptions;
150153

151154
Configurable<bool> enableDCACustomCut{"enableDCACustomCut", false, "Flag to enable DCA custom cuts - unflag to use standard isGlobalCut DCA cut"};
152155
struct : ConfigurableGroup {
@@ -304,7 +307,10 @@ struct LFNucleiBATask {
304307

305308
histos.add<TH1>("event/eventSelection", "eventSelection", HistType::kTH1D, {{7, -0.5, 6.5}});
306309
auto h = histos.get<TH1>(HIST("event/eventSelection"));
307-
h->GetXaxis()->SetBinLabel(1, "Total");
310+
if (skimmingOptions.applySkimming)
311+
h->GetXaxis()->SetBinLabel(1, "Skimmed events");
312+
else
313+
h->GetXaxis()->SetBinLabel(1, "Total");
308314
h->GetXaxis()->SetBinLabel(2, "TVX trigger cut");
309315
h->GetXaxis()->SetBinLabel(3, "TF border cut");
310316
h->GetXaxis()->SetBinLabel(4, "ITS ROF cut");
@@ -375,9 +381,10 @@ struct LFNucleiBATask {
375381
if (enableDebug) {
376382
debugHistos.add<TH1>("debug/event/h1CentV0M", "V0M; Multiplicity; counts", HistType::kTH1F, {{27000, 0, 27000}});
377383
// trackQA
378-
debugHistos.add<TH1>("debug/tracks/h1Eta", "pseudoRapidity; #eta; counts", HistType::kTH1F, {{200, -1.0, 1.0}});
384+
debugHistos.add<TH1>("debug/tracks/h1Eta", "pseudoRapidity; #eta; counts", HistType::kTH1F, {{200, -2.0, 2.0}});
379385
debugHistos.add<TH1>("debug/tracks/h1VarPhi", "#phi; #phi; counts", HistType::kTH1F, {{63, 0.0, 6.3}});
380-
debugHistos.add<TH2>("debug/tracks/h2EtaVsPhi", "#eta vs #phi; #eta; #phi", HistType::kTH2F, {{200, -1.0, 1.0}, {63, 0.0, 6.3}});
386+
debugHistos.add<TH2>("debug/tracks/h2EtaVsPhi", "#eta vs #phi; #eta; #phi", HistType::kTH2F, {{200, -2.0, 2.0}, {63, 0.0, 6.3}});
387+
debugHistos.add<TH2>("debug/tracks/h2PionYvsPt", "#it{y} vs #it{p}_{T} (#pi)", HistType::kTH2F, {{200, -2.0, 2.0}, {ptAxis}});
381388
}
382389

383390
if (enablePtSpectra) {
@@ -1724,7 +1731,7 @@ struct LFNucleiBATask {
17241731
}
17251732
}
17261733
// TOF EvTime Splitting plots
1727-
if (enableEvTimeSplitting) {
1734+
if (filterOptions.enableEvTimeSplitting) {
17281735
// Bethe-Bloch TPC distribution - TOF EvTime Splitted
17291736
evtimeHistos.add<TH2>("tracks/evtime/fill/h2TPCsignVsTPCmomentum", "TPC <-dE/dX> vs #it{p}/Z; Signed #it{p} (GeV/#it{c}); TPC <-dE/dx> (a.u.)", HistType::kTH2F, {{500, -5.f, 5.f}, {dedxAxis}});
17301737
evtimeHistos.add<TH2>("tracks/evtime/tof/h2TPCsignVsTPCmomentum", "TPC <-dE/dX> vs #it{p}/Z; Signed #it{p} (GeV/#it{c}); TPC <-dE/dx> (a.u.)", HistType::kTH2F, {{500, -5.f, 5.f}, {dedxAxis}});
@@ -1921,8 +1928,8 @@ struct LFNucleiBATask {
19211928
}
19221929
}
19231930
}
1924-
1925-
if (!doprocessMCGen) {
1931+
// To be optimised
1932+
if (!doprocessMCGen && !doprocessMCReco && !doprocessMCRecoLfPid && !doprocessMCRecoFiltered && !doprocessMCRecoFilteredLight) {
19261933
LOG(info) << "Histograms of LFNucleiBATask:";
19271934
histos.print();
19281935
return;
@@ -2150,14 +2157,11 @@ struct LFNucleiBATask {
21502157
LOG(fatal) << "Problem with track size";
21512158
}
21522159

2153-
for (auto& track : tracksWithITS) {
2154-
if (enablePIDplot) {
2155-
histos.fill(HIST("tracks/h1pT"), track.pt());
2156-
histos.fill(HIST("tracks/h1p"), track.p());
2157-
}
2160+
tracks.copyIndexBindings(tracksWithITS);
21582161

2162+
for (auto& track : tracksWithITS) {
21592163
if constexpr (!IsFilteredData) {
2160-
if (!track.isGlobalTrackWoDCA()) {
2164+
if (!track.isGlobalTrackWoDCA() && filterOptions.enableIsGlobalTrack) {
21612165
continue;
21622166
}
21632167
}
@@ -2169,6 +2173,11 @@ struct LFNucleiBATask {
21692173
if (track.tpcNClsFound() < cfgCutTPCClusters)
21702174
continue;
21712175

2176+
if (enablePIDplot) {
2177+
histos.fill(HIST("tracks/h1pT"), track.pt());
2178+
histos.fill(HIST("tracks/h1p"), track.p());
2179+
}
2180+
21722181
isTritonTPCpid = std::abs(track.tpcNSigmaTr()) < nsigmaTPCvar.nsigmaTPCTr;
21732182

21742183
float shiftPtPos = 0.f;
@@ -2393,6 +2402,9 @@ struct LFNucleiBATask {
23932402
// p cut
23942403
if (std::abs(track.tpcInnerParam()) < kinemOptions.pCut)
23952404
continue;
2405+
// eta cut
2406+
if (std::abs(track.eta()) > kinemOptions.etaCut)
2407+
continue;
23962408

23972409
// Rapidity cuts
23982410
prRapCut = track.rapidity(o2::track::PID::getMass2Z(o2::track::PID::Proton)) > kinemOptions.yLowCut && track.rapidity(o2::track::PID::getMass2Z(o2::track::PID::Proton)) < kinemOptions.yHighCut;
@@ -3553,12 +3565,14 @@ struct LFNucleiBATask {
35533565

35543566
// DCA Cut
35553567
if constexpr (!IsFilteredData) {
3556-
if (!enableDCACustomCut) {
3557-
if (!track.isGlobalTrack())
3558-
continue;
3559-
} else {
3560-
if (!track.isGlobalTrackWoDCA())
3561-
continue;
3568+
if (filterOptions.enableIsGlobalTrack) {
3569+
if (!enableDCACustomCut) {
3570+
if (!track.isGlobalTrack())
3571+
continue;
3572+
} else {
3573+
if (!track.isGlobalTrackWoDCA())
3574+
continue;
3575+
}
35623576
}
35633577
}
35643578

@@ -3670,6 +3684,7 @@ struct LFNucleiBATask {
36703684
debugHistos.fill(HIST("debug/tracks/h1Eta"), track.eta());
36713685
debugHistos.fill(HIST("debug/tracks/h1VarPhi"), track.phi());
36723686
debugHistos.fill(HIST("debug/tracks/h2EtaVsPhi"), track.eta(), track.phi());
3687+
debugHistos.fill(HIST("debug/tracks/h2PionYvsPt"), track.rapidity(o2::track::PID::getMass2Z(o2::track::PID::Pion)), track.pt());
36733688

36743689
if (track.sign() > 0) {
36753690
debugHistos.fill(HIST("debug/qa/h2TPCncrVsPtPos"), track.tpcInnerParam(), track.tpcNClsCrossedRows());
@@ -3706,7 +3721,7 @@ struct LFNucleiBATask {
37063721
if (enablePtSpectra)
37073722
histos.fill(HIST("tracks/eff/h2pVsTPCmomentum"), track.tpcInnerParam(), track.p());
37083723

3709-
if (enableFiltering) {
3724+
if (filterOptions.enableFiltering) {
37103725
if (track.tpcNSigmaKa() < 5)
37113726
continue;
37123727
}
@@ -3804,7 +3819,7 @@ struct LFNucleiBATask {
38043819
histos.fill(HIST("tracks/proton/h2ProtonTOFExpSignalDiffVsPt"), track.pt(), track.tofExpSignalDiffPr());
38053820
}
38063821

3807-
if (enableEvTimeSplitting && track.hasTOF()) {
3822+
if (filterOptions.enableEvTimeSplitting && track.hasTOF()) {
38083823
if (track.isEvTimeTOF() && track.isEvTimeT0AC()) {
38093824
if (enablePr)
38103825
evtimeHistos.fill(HIST("tracks/evtime/ft0tof/proton/h2ProtonVspTNSigmaTOF"), track.pt(), track.tofNSigmaPr());
@@ -3958,7 +3973,7 @@ struct LFNucleiBATask {
39583973
if (outFlagOptions.enableExpSignalTOF)
39593974
histos.fill(HIST("tracks/proton/h2antiProtonTOFExpSignalDiffVsPt"), track.pt(), track.tofExpSignalDiffPr());
39603975
}
3961-
if (enableEvTimeSplitting && track.hasTOF()) {
3976+
if (filterOptions.enableEvTimeSplitting && track.hasTOF()) {
39623977
if (track.isEvTimeTOF() && track.isEvTimeT0AC()) {
39633978
if (enablePr)
39643979
evtimeHistos.fill(HIST("tracks/evtime/ft0tof/proton/h2antiProtonVspTNSigmaTOF"), track.pt(), track.tofNSigmaPr());
@@ -4362,7 +4377,7 @@ struct LFNucleiBATask {
43624377
}
43634378
}
43644379
}
4365-
if (enableEvTimeSplitting) {
4380+
if (filterOptions.enableEvTimeSplitting) {
43664381
if (track.isEvTimeTOF() && track.isEvTimeT0AC()) {
43674382
evtimeHistos.fill(HIST("tracks/evtime/ft0tof/h2TOFbetaVsP"), track.p() / (1.f * track.sign()), track.beta());
43684383
evtimeHistos.fill(HIST("tracks/evtime/ft0tof/h2TPCsignVsTPCmomentum"), track.tpcInnerParam() / (1.f * track.sign()), track.tpcSignal());
@@ -4490,7 +4505,7 @@ struct LFNucleiBATask {
44904505
if (passDCAxyzCut) {
44914506
if (enablePIDplot)
44924507
histos.fill(HIST("tracks/h2TOFmassVsPt"), massTOF, track.pt());
4493-
if (enableEvTimeSplitting) {
4508+
if (filterOptions.enableEvTimeSplitting) {
44944509
if (track.isEvTimeTOF() && track.isEvTimeT0AC()) {
44954510
evtimeHistos.fill(HIST("tracks/evtime/ft0tof/h2TOFmassVsPt"), massTOF, track.pt());
44964511
} else if (track.isEvTimeT0AC()) {
@@ -4517,7 +4532,7 @@ struct LFNucleiBATask {
45174532
}
45184533
if (outFlagOptions.enableExpSignalTOF)
45194534
histos.fill(HIST("tracks/proton/h2ProtonTOFExpSignalDiffVsPtCut"), track.pt(), track.tofExpSignalDiffPr());
4520-
if (enableEvTimeSplitting) {
4535+
if (filterOptions.enableEvTimeSplitting) {
45214536
if (track.isEvTimeTOF() && track.isEvTimeT0AC()) {
45224537
evtimeHistos.fill(HIST("tracks/evtime/ft0tof/proton/h2TOFmass2ProtonVsPt"), massTOF * massTOF - MassProtonVal * MassProtonVal, track.pt());
45234538
} else if (track.isEvTimeT0AC()) {
@@ -4541,7 +4556,7 @@ struct LFNucleiBATask {
45414556
}
45424557
if (outFlagOptions.enableExpSignalTOF)
45434558
histos.fill(HIST("tracks/proton/h2antiProtonTOFExpSignalDiffVsPtCut"), track.pt(), track.tofExpSignalDiffPr());
4544-
if (enableEvTimeSplitting) {
4559+
if (filterOptions.enableEvTimeSplitting) {
45454560
if (track.isEvTimeTOF() && track.isEvTimeT0AC()) {
45464561
evtimeHistos.fill(HIST("tracks/evtime/ft0tof/proton/h2TOFmass2antiProtonVsPt"), massTOF * massTOF - MassProtonVal * MassProtonVal, track.pt());
45474562
} else if (track.isEvTimeT0AC()) {
@@ -4595,7 +4610,7 @@ struct LFNucleiBATask {
45954610
}
45964611
if (outFlagOptions.enableExpSignalTOF)
45974612
histos.fill(HIST("tracks/deuteron/h2DeuteronTOFExpSignalDiffVsPtCut"), DPt, track.tofExpSignalDiffDe());
4598-
if (enableEvTimeSplitting) {
4613+
if (filterOptions.enableEvTimeSplitting) {
45994614
if (track.isEvTimeTOF() && track.isEvTimeT0AC()) {
46004615
evtimeHistos.fill(HIST("tracks/evtime/ft0tof/deuteron/h2TOFmass2DeuteronVsPt"), massTOF * massTOF - MassDeuteronVal * MassDeuteronVal, DPt);
46014616
} else if (track.isEvTimeT0AC()) {
@@ -4621,7 +4636,7 @@ struct LFNucleiBATask {
46214636
}
46224637
if (outFlagOptions.enableExpSignalTOF)
46234638
histos.fill(HIST("tracks/deuteron/h2antiDeuteronTOFExpSignalDiffVsPtCut"), antiDPt, track.tofExpSignalDiffDe());
4624-
if (enableEvTimeSplitting) {
4639+
if (filterOptions.enableEvTimeSplitting) {
46254640
if (track.isEvTimeTOF() && track.isEvTimeT0AC()) {
46264641
evtimeHistos.fill(HIST("tracks/evtime/ft0tof/deuteron/h2TOFmass2antiDeuteronVsPt"), massTOF * massTOF - MassDeuteronVal * MassDeuteronVal, antiDPt);
46274642
} else if (track.isEvTimeT0AC()) {

0 commit comments

Comments
 (0)