Skip to content

Commit 60060b0

Browse files
Maximilian Korwiesershahor02
authored andcommitted
[TPC-QC] Add DCAr selection to Tracks.cxx
1 parent 6a54652 commit 60060b0

File tree

2 files changed

+58
-23
lines changed

2 files changed

+58
-23
lines changed

Detectors/TPC/qc/include/TPCQC/Tracks.h

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -69,42 +69,32 @@ class Tracks
6969

7070
// To set the elementary track cuts
7171
void setTrackCuts(float AbsEta = 1.,
72-
int nClusterCut = 60, float dEdxTot = 20, float cutPtForDCAr = 1.5, float samplingFractionDCAr = 0.1, bool turnOffHistosForAsync = false)
72+
int nClusterCut = 60, float dEdxTot = 20, float cutPtForDCAr = 1.5, float samplingFractionDCAr = 0.1, bool turnOffHistosForAsync = false, float cutMaxAbsDCAr = 0.1, bool useCutMaxAbsDCArOnHistos = false)
7373
{
7474
mCutAbsEta = AbsEta;
7575
mCutMinnCls = nClusterCut;
7676
mCutMindEdxTot = dEdxTot;
7777
mCutMinPtDCAr = cutPtForDCAr;
7878
mSamplingFractionDCAr = samplingFractionDCAr;
7979
mTurnOffHistosForAsync = turnOffHistosForAsync;
80+
mCutMaxAbsDCAr = cutMaxAbsDCAr;
81+
mUseCutMaxAbsDCArOnHistos = useCutMaxAbsDCArOnHistos;
8082
}
8183

82-
// Just for backward compatibility with crrent QC, temporary, will be removed in the next PR
83-
/// get 1D histograms
84-
std::vector<TH1F>& getHistograms1D() { return mHist1D; }
85-
const std::vector<TH1F>& getHistograms1D() const { return mHist1D; }
86-
87-
// Just for backward compatibility with crrent QC, temporary, will be removed in the next PR
88-
/// get 2D histograms
89-
std::vector<TH2F>& getHistograms2D() { return mHist2D; }
90-
const std::vector<TH2F>& getHistograms2D() const { return mHist2D; }
91-
92-
// Just for backward compatibility with crrent QC, temporary, will be removed in the next PR
93-
/// get ratios of 1D histograms
94-
std::vector<TH1F>& getHistogramRatios1D() { return mHistRatio1D; }
95-
const std::vector<TH1F>& getHistogramRatios1D() const { return mHistRatio1D; }
96-
9784
/// get ratios of 1D histograms
9885
std::unordered_map<std::string, std::unique_ptr<TH1>>& getMapHist() { return mMapHist; }
9986
const std::unordered_map<std::string, std::unique_ptr<TH1>>& getMapHist() const { return mMapHist; }
10087

10188
private:
102-
float mCutAbsEta = 1.f; // Eta cut
103-
int mCutMinnCls = 60; // minimum N clusters
104-
float mCutMindEdxTot = 20.f; // dEdxTot min value
105-
float mCutMinPtDCAr = 1.5f; // minimum pT for DCAr plots DCAr vs. phi, eta, nCluster
106-
float mSamplingFractionDCAr = 0.1f; // sampling rate for calculation of DCAr
107-
bool mTurnOffHistosForAsync = false; // Decide whether to turn off some histograms for async to reduce memory
89+
float mCutAbsEta = 1.f; // Eta cut
90+
int mCutMinnCls = 60; // minimum N clusters
91+
float mCutMindEdxTot = 20.f; // dEdxTot min value
92+
float mCutMinPtDCAr = 1.5f; // minimum pT for DCAr plots DCAr vs. phi, eta, nCluster
93+
float mSamplingFractionDCAr = 0.1f; // sampling rate for calculation of DCAr
94+
bool mTurnOffHistosForAsync = false; // Decide whether to turn off some histograms for async to reduce memory
95+
float mCutMaxAbsDCAr = 1.f; // maximum DCAr
96+
bool mUseCutMaxAbsDCArOnHistos = false; // Decide whether to use the cut on maximum DCAr for the histograms
97+
10898
std::unordered_map<std::string, std::unique_ptr<TH1>> mMapHist;
10999
std::vector<TH1F> mHist1D{}; ///< Initialize vector of 1D histograms
110100
std::vector<TH2F> mHist2D{}; ///< Initialize vector of 2D histograms

Detectors/TPC/qc/src/Tracks.cxx

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,9 @@ bool Tracks::processTrack(const o2::tpc::TrackTPC& track)
172172
sampleProb = randomGenerator.Uniform(1);
173173
}
174174

175+
bool isDcaCalculated = false;
176+
float dcaValue = -999;
177+
175178
if (sampleProb > (Double_t)(1. - mSamplingFractionDCAr)) {
176179

177180
if (propagator->getMatLUT() && propagator->hasMagFieldSet()) {
@@ -190,6 +193,8 @@ bool Tracks::processTrack(const o2::tpc::TrackTPC& track)
190193
dcaHistEta_pTmin->Fill(eta, dca[0]);
191194
dcaHistNCluster_pTmin->Fill(nCls, dca[0]);
192195
}
196+
dcaValue = dca[0];
197+
isDcaCalculated = true;
193198
}
194199
} else {
195200
static bool reported = false;
@@ -207,6 +212,46 @@ bool Tracks::processTrack(const o2::tpc::TrackTPC& track)
207212
}
208213
}
209214

215+
if (mUseCutMaxAbsDCArOnHistos && !isDcaCalculated) {
216+
// In this case the DCAr selection should be applied but is not available for the track, hence we simply return and report back
217+
// For ease we just report back for every histogram that the propagator was not initialized
218+
static bool reported = false;
219+
if (!reported) {
220+
LOGP(error, "o2::base::Propagator not properly initialized, MatLUT ({}) and / or Field ({}) missing, will not fill apply DCAr selection on histograms", (void*)propagator->getMatLUT(), propagator->hasMagFieldSet());
221+
mMapHist["hPhiAside"]->SetTitle("hPhiAside o2::base::Propagator not properly initialized");
222+
mMapHist["hPhiCside"]->SetTitle("hPhiCside o2::base::Propagator not properly initialized");
223+
mMapHist["hPhiBothSides"]->SetTitle("hPhiBothSides o2::base::Propagator not properly initialized");
224+
mMapHist["hPt"]->SetTitle("hPt o2::base::Propagator not properly initialized");
225+
mMapHist["hSign"]->SetTitle("hSign o2::base::Propagator not properly initialized");
226+
mMapHist["hQOverPt"]->SetTitle("hQOverPt o2::base::Propagator not properly initialized");
227+
mMapHist["hEtaNeg"]->SetTitle("hEtaNeg o2::base::Propagator not properly initialized");
228+
mMapHist["hPhiAsideNeg"]->SetTitle("hPhiAsideNeg o2::base::Propagator not properly initialized");
229+
mMapHist["hPhiCsideNeg"]->SetTitle("hPhiCsideNeg o2::base::Propagator not properly initialized");
230+
mMapHist["hEtaPos"]->SetTitle("hEtaPos o2::base::Propagator not properly initialized");
231+
mMapHist["hPtPos"]->SetTitle("hPtPos o2::base::Propagator not properly initialized");
232+
mMapHist["hPhiAsidePos"]->SetTitle("hPhiAsidePos o2::base::Propagator not properly initialized");
233+
mMapHist["hPhiCsidePos"]->SetTitle("hPhiCsidePos o2::base::Propagator not properly initialized");
234+
mMapHist["h2DNClustersEta"]->SetTitle("h2DNClustersEta o2::base::Propagator not properly initialized");
235+
mMapHist["h2DNClustersPhiAside"]->SetTitle("h2DNClustersPhiAside o2::base::Propagator not properly initialized");
236+
mMapHist["h2DQOverPtPhiAside"]->SetTitle("h2DQOverPtPhiAside o2::base::Propagator not properly initialized");
237+
mMapHist["h2DNClustersPhiCside"]->SetTitle("h2DNClustersPhiCside o2::base::Propagator not properly initialized");
238+
mMapHist["h2DQOverPtPhiCside"]->SetTitle("h2DQOverPtPhiCside o2::base::Propagator not properly initialized");
239+
mMapHist["h2DNClustersPt"]->SetTitle("h2DNClustersPt o2::base::Propagator not properly initialized");
240+
mMapHist["h2DEtaPhi"]->SetTitle("h2DEtaPhi o2::base::Propagator not properly initialized");
241+
mMapHist["h2DEtaPhiNeg"]->SetTitle("h2DEtaPhiNeg o2::base::Propagator not properly initialized");
242+
mMapHist["hEtaVsPtNeg"]->SetTitle("hEtaVsPtNeg o2::base::Propagator not properly initialized");
243+
mMapHist["hPhiVsPtNeg"]->SetTitle("hPhiVsPtNeg o2::base::Propagator not properly initialized");
244+
mMapHist["h2DEtaPhiPos"]->SetTitle("h2DEtaPhiPos o2::base::Propagator not properly initialized");
245+
mMapHist["hEtaVsPtPos"]->SetTitle("hEtaVsPtPos o2::base::Propagator not properly initialized");
246+
mMapHist["hPhiVsPtPos"]->SetTitle("hPhiVsPtPos o2::base::Propagator not properly initialized");
247+
}
248+
return true;
249+
}
250+
251+
if (mUseCutMaxAbsDCArOnHistos && (std::abs(dcaValue) > mCutMaxAbsDCAr)) {
252+
return true;
253+
}
254+
210255
if (hasASideOnly == 1) {
211256
mMapHist["hPhiAside"]->Fill(phi);
212257
} else if (hasCSideOnly == 1) {
@@ -304,4 +349,4 @@ void Tracks::dumpToFile(std::string_view filename)
304349
arr.Write(arr.GetName(), TObject::kSingleKey);
305350
}
306351
f->Close();
307-
}
352+
}

0 commit comments

Comments
 (0)