Skip to content

Commit d2d47ed

Browse files
Maximilian Korwieserwiechula
authored andcommitted
Add sampling to DCAr calculation, optional pT selection and DCAr vs pT, NCls, eta plots.
1 parent 3d1eebc commit d2d47ed

2 files changed

Lines changed: 54 additions & 19 deletions

File tree

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,13 @@ class Tracks
6969

7070
// To set the elementary track cuts
7171
void setTrackCuts(float AbsEta = 1.,
72-
int nClusterCut = 60, float dEdxTot = 20)
72+
int nClusterCut = 60, float dEdxTot = 20, float cutPtForDCAr = 1.5, float samplingFractionDCAr = 0.1)
7373
{
7474
mCutAbsEta = AbsEta;
7575
mCutMinnCls = nClusterCut;
7676
mCutMindEdxTot = dEdxTot;
77+
mCutMinPtDCAr = cutPtForDCAr;
78+
mSamplingFractionDCAr = samplingFractionDCAr;
7779
}
7880

7981
// Just for backward compatibility with crrent QC, temporary, will be removed in the next PR
@@ -96,9 +98,11 @@ class Tracks
9698
const std::unordered_map<std::string, std::unique_ptr<TH1>>& getMapHist() const { return mMapHist; }
9799

98100
private:
99-
float mCutAbsEta = 1.f; // Eta cut
100-
int mCutMinnCls = 60; // minimum N clusters
101-
float mCutMindEdxTot = 20.f; // dEdxTot min value
101+
float mCutAbsEta = 1.f; // Eta cut
102+
int mCutMinnCls = 60; // minimum N clusters
103+
float mCutMindEdxTot = 20.f; // dEdxTot min value
104+
float mCutMinPtDCAr = 1.5f; // minimum pT for DCAr plots DCAr vs. phi, eta, nCluster
105+
float mSamplingFractionDCAr = 0.1f; // sampling rate for calculation of DCAr
102106
std::unordered_map<std::string, std::unique_ptr<TH1>> mMapHist;
103107
std::vector<TH1F> mHist1D{}; ///< Initialize vector of 1D histograms
104108
std::vector<TH2F> mHist2D{}; ///< Initialize vector of 2D histograms

Detectors/TPC/qc/src/Tracks.cxx

Lines changed: 46 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
// root includes
1818
#include "TFile.h"
19+
#include "TRandom3.h"
1920

2021
// o2 includes
2122
#include "DataFormatsTPC/TrackTPC.h"
@@ -85,6 +86,13 @@ void Tracks::initializeHistograms()
8586
for (const auto type : types) {
8687
mMapHist[fmt::format("hDCAr_{}", type).data()] = std::make_unique<TH2F>(fmt::format("hDCAr_{}", type).data(), fmt::format("DCAr {};phi;DCAr (cm)", type).data(), 360, 0, o2::math_utils::twoPid(), 250, -10., 10.);
8788
}
89+
// DCA vs variables Histograms
90+
mMapHist["hDCArVsPtPos"] = std::make_unique<TH2F>("hDCArVsPtPos", "DCAr Pos;#it{p}_{T}T (GeV/#it{c});DCAr (cm)", logPtBinning.size() - 1, logPtBinning.data(), 250, -10., 10.);
91+
mMapHist["hDCArVsEtaPos"] = std::make_unique<TH2F>("hDCArVsEtaPos", "DCAr Pos;#eta;DCAr (cm)", 400, -2., 2., 250, -10., 10.);
92+
mMapHist["hDCArVsNClsPos"] = std::make_unique<TH2F>("hDCArVsNClsPos", "DCAr Pos;NClusters;DCAr (cm)", 400, -0.5, 399.5, 250, -10., 10.);
93+
mMapHist["hDCArVsPtNeg"] = std::make_unique<TH2F>("hDCArVsPtNeg", "DCAr Neg;#it{p}_{T}T (GeV/#it{c});DCAr (cm)", logPtBinning.size() - 1, logPtBinning.data(), 250, -10., 10.);
94+
mMapHist["hDCArVsEtaNeg"] = std::make_unique<TH2F>("hDCArVsEtaNeg", "DCAr Neg;#eta;DCAr (cm)", 400, -2., 2., 250, -10., 10.);
95+
mMapHist["hDCArVsNClsNeg"] = std::make_unique<TH2F>("hDCArVsNClsNeg", "DCAr Neg;NClusters;DCAr (cm)", 400, -0.5, 399.5, 250, -10., 10.);
8896
}
8997
//______________________________________________________________________________
9098
void Tracks::resetHistograms()
@@ -130,23 +138,46 @@ bool Tracks::processTrack(const o2::tpc::TrackTPC& track)
130138
auto propagator = o2::base::Propagator::Instance(true);
131139
const int type = (track.getQ2Pt() < 0) + 2 * track.hasCSideClustersOnly();
132140
auto dcaHist = mMapHist[fmt::format("hDCAr_{}", types[type]).data()].get();
141+
const std::string signType((sign < 0) ? "Neg" : "Pos");
142+
auto dcaHistPT = mMapHist["hDCArVsPt" + signType].get();
143+
auto dcaHistEta = mMapHist["hDCArVsEtaPos" + signType].get();
144+
auto dcaHistNCluster = mMapHist["hDCArVsNClsPos" + signType].get();
133145

134-
if (propagator->getMatLUT() && propagator->hasMagFieldSet()) {
135-
// ---| fill DCA histos |---
136-
o2::gpu::gpustd::array<float, 2> dca;
137-
const o2::math_utils::Point3D<float> refPoint{0, 0, 0};
138-
o2::track::TrackPar propTrack(track);
139-
if (propagator->propagateToDCABxByBz(refPoint, propTrack, 2.f, o2::base::Propagator::MatCorrType::USEMatCorrLUT, &dca)) {
140-
const auto phi = o2::math_utils::to02PiGen(track.getPhi());
141-
dcaHist->Fill(phi, dca[0]);
142-
}
143-
} else {
144-
static bool reported = false;
145-
if (!reported) {
146-
LOGP(error, "o2::base::Propagator not properly initialized, MatLUT ({}) and / or Field ({}) missing, will not fill DCA histograms", (void*)propagator->getMatLUT(), (void*)propagator->hasMagFieldSet());
147-
reported = true;
146+
// set-up sampling for the DCA calculation
147+
Double_t sampleProb = 2;
148+
149+
if (mSamplingFractionDCAr > 0) { // for now no SEED is given.
150+
TRandom3 randomGenerator(0);
151+
sampleProb = randomGenerator.Uniform(1);
152+
}
153+
154+
if (sampleProb > (Double_t)(1. - mSamplingFractionDCAr)) {
155+
156+
if (propagator->getMatLUT() && propagator->hasMagFieldSet()) {
157+
// ---| fill DCA histos |---
158+
o2::gpu::gpustd::array<float, 2> dca;
159+
const o2::math_utils::Point3D<float> refPoint{0, 0, 0};
160+
o2::track::TrackPar propTrack(track);
161+
if (propagator->propagateToDCABxByBz(refPoint, propTrack, 2.f, o2::base::Propagator::MatCorrType::USEMatCorrLUT, &dca)) {
162+
const auto phi = o2::math_utils::to02PiGen(track.getPhi());
163+
dcaHistPT->Fill(pt, dca[0]);
164+
if (pt > mCutMinPtDCAr) {
165+
dcaHist->Fill(phi, dca[0]);
166+
dcaHistEta->Fill(eta, dca[0]);
167+
dcaHistNCluster->Fill(nCls, dca[0]);
168+
}
169+
} else {
170+
static bool reported = false;
171+
if (!reported) {
172+
LOGP(error, "o2::base::Propagator not properly initialized, MatLUT ({}) and / or Field ({}) missing, will not fill DCA histograms", (void*)propagator->getMatLUT(), (void*)propagator->hasMagFieldSet());
173+
reported = true;
174+
}
175+
dcaHist->SetTitle(fmt::format("DCAr {} o2::base::Propagator not properly initialized", types[type]).data());
176+
dcaHistPT->SetTitle(fmt::format("DCAr p_{T} {} o2::base::Propagator not properly initialized", signType).data());
177+
dcaHistEta->SetTitle(fmt::format("DCAr eta {} o2::base::Propagator not properly initialized", signType).data());
178+
dcaHistNCluster->SetTitle(fmt::format("DCAr nClusters {} o2::base::Propagator not properly initialized", signType).data());
179+
}
148180
}
149-
dcaHist->SetTitle(fmt::format("DCAr {} o2::base::Propagator not properly initialized", types[type]).data());
150181
}
151182

152183
if (hasASideOnly == 1) {

0 commit comments

Comments
 (0)