Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TPC-QC] Add DCAr selection to Tracks.cxx #13565

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 12 additions & 22 deletions Detectors/TPC/qc/include/TPCQC/Tracks.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,42 +69,32 @@ class Tracks

// To set the elementary track cuts
void setTrackCuts(float AbsEta = 1.,
int nClusterCut = 60, float dEdxTot = 20, float cutPtForDCAr = 1.5, float samplingFractionDCAr = 0.1, bool turnOffHistosForAsync = false)
int nClusterCut = 60, float dEdxTot = 20, float cutPtForDCAr = 1.5, float samplingFractionDCAr = 0.1, bool turnOffHistosForAsync = false, float cutMaxAbsDCAr = 0.1, bool useCutMaxAbsDCArOnHistos = false)
{
mCutAbsEta = AbsEta;
mCutMinnCls = nClusterCut;
mCutMindEdxTot = dEdxTot;
mCutMinPtDCAr = cutPtForDCAr;
mSamplingFractionDCAr = samplingFractionDCAr;
mTurnOffHistosForAsync = turnOffHistosForAsync;
mCutMaxAbsDCAr = cutMaxAbsDCAr;
mUseCutMaxAbsDCArOnHistos = useCutMaxAbsDCArOnHistos;
}

// Just for backward compatibility with crrent QC, temporary, will be removed in the next PR
/// get 1D histograms
std::vector<TH1F>& getHistograms1D() { return mHist1D; }
const std::vector<TH1F>& getHistograms1D() const { return mHist1D; }

// Just for backward compatibility with crrent QC, temporary, will be removed in the next PR
/// get 2D histograms
std::vector<TH2F>& getHistograms2D() { return mHist2D; }
const std::vector<TH2F>& getHistograms2D() const { return mHist2D; }

// Just for backward compatibility with crrent QC, temporary, will be removed in the next PR
/// get ratios of 1D histograms
std::vector<TH1F>& getHistogramRatios1D() { return mHistRatio1D; }
const std::vector<TH1F>& getHistogramRatios1D() const { return mHistRatio1D; }

/// get ratios of 1D histograms
std::unordered_map<std::string, std::unique_ptr<TH1>>& getMapHist() { return mMapHist; }
const std::unordered_map<std::string, std::unique_ptr<TH1>>& getMapHist() const { return mMapHist; }

private:
float mCutAbsEta = 1.f; // Eta cut
int mCutMinnCls = 60; // minimum N clusters
float mCutMindEdxTot = 20.f; // dEdxTot min value
float mCutMinPtDCAr = 1.5f; // minimum pT for DCAr plots DCAr vs. phi, eta, nCluster
float mSamplingFractionDCAr = 0.1f; // sampling rate for calculation of DCAr
bool mTurnOffHistosForAsync = false; // Decide whether to turn off some histograms for async to reduce memory
float mCutAbsEta = 1.f; // Eta cut
int mCutMinnCls = 60; // minimum N clusters
float mCutMindEdxTot = 20.f; // dEdxTot min value
float mCutMinPtDCAr = 1.5f; // minimum pT for DCAr plots DCAr vs. phi, eta, nCluster
float mSamplingFractionDCAr = 0.1f; // sampling rate for calculation of DCAr
bool mTurnOffHistosForAsync = false; // Decide whether to turn off some histograms for async to reduce memory
float mCutMaxAbsDCAr = 1.f; // maximum DCAr
bool mUseCutMaxAbsDCArOnHistos = false; // Decide whether to use the cut on maximum DCAr for the histograms

std::unordered_map<std::string, std::unique_ptr<TH1>> mMapHist;
std::vector<TH1F> mHist1D{}; ///< Initialize vector of 1D histograms
std::vector<TH2F> mHist2D{}; ///< Initialize vector of 2D histograms
Expand Down
47 changes: 46 additions & 1 deletion Detectors/TPC/qc/src/Tracks.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ bool Tracks::processTrack(const o2::tpc::TrackTPC& track)
sampleProb = randomGenerator.Uniform(1);
}

bool isDcaCalculated = false;
float dcaValue = -999;

if (sampleProb > (Double_t)(1. - mSamplingFractionDCAr)) {

if (propagator->getMatLUT() && propagator->hasMagFieldSet()) {
Expand All @@ -190,6 +193,8 @@ bool Tracks::processTrack(const o2::tpc::TrackTPC& track)
dcaHistEta_pTmin->Fill(eta, dca[0]);
dcaHistNCluster_pTmin->Fill(nCls, dca[0]);
}
dcaValue = dca[0];
isDcaCalculated = true;
}
} else {
static bool reported = false;
Expand All @@ -207,6 +212,46 @@ bool Tracks::processTrack(const o2::tpc::TrackTPC& track)
}
}

if (mUseCutMaxAbsDCArOnHistos && !isDcaCalculated) {
// In this case the DCAr selection should be applied but is not available for the track, hence we simply return and report back
// For ease we just report back for every histogram that the propagator was not initialized
static bool reported = false;
if (!reported) {
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());
mMapHist["hPhiAside"]->SetTitle("hPhiAside o2::base::Propagator not properly initialized");
mMapHist["hPhiCside"]->SetTitle("hPhiCside o2::base::Propagator not properly initialized");
mMapHist["hPhiBothSides"]->SetTitle("hPhiBothSides o2::base::Propagator not properly initialized");
mMapHist["hPt"]->SetTitle("hPt o2::base::Propagator not properly initialized");
mMapHist["hSign"]->SetTitle("hSign o2::base::Propagator not properly initialized");
mMapHist["hQOverPt"]->SetTitle("hQOverPt o2::base::Propagator not properly initialized");
mMapHist["hEtaNeg"]->SetTitle("hEtaNeg o2::base::Propagator not properly initialized");
mMapHist["hPhiAsideNeg"]->SetTitle("hPhiAsideNeg o2::base::Propagator not properly initialized");
mMapHist["hPhiCsideNeg"]->SetTitle("hPhiCsideNeg o2::base::Propagator not properly initialized");
mMapHist["hEtaPos"]->SetTitle("hEtaPos o2::base::Propagator not properly initialized");
mMapHist["hPtPos"]->SetTitle("hPtPos o2::base::Propagator not properly initialized");
mMapHist["hPhiAsidePos"]->SetTitle("hPhiAsidePos o2::base::Propagator not properly initialized");
mMapHist["hPhiCsidePos"]->SetTitle("hPhiCsidePos o2::base::Propagator not properly initialized");
mMapHist["h2DNClustersEta"]->SetTitle("h2DNClustersEta o2::base::Propagator not properly initialized");
mMapHist["h2DNClustersPhiAside"]->SetTitle("h2DNClustersPhiAside o2::base::Propagator not properly initialized");
mMapHist["h2DQOverPtPhiAside"]->SetTitle("h2DQOverPtPhiAside o2::base::Propagator not properly initialized");
mMapHist["h2DNClustersPhiCside"]->SetTitle("h2DNClustersPhiCside o2::base::Propagator not properly initialized");
mMapHist["h2DQOverPtPhiCside"]->SetTitle("h2DQOverPtPhiCside o2::base::Propagator not properly initialized");
mMapHist["h2DNClustersPt"]->SetTitle("h2DNClustersPt o2::base::Propagator not properly initialized");
mMapHist["h2DEtaPhi"]->SetTitle("h2DEtaPhi o2::base::Propagator not properly initialized");
mMapHist["h2DEtaPhiNeg"]->SetTitle("h2DEtaPhiNeg o2::base::Propagator not properly initialized");
mMapHist["hEtaVsPtNeg"]->SetTitle("hEtaVsPtNeg o2::base::Propagator not properly initialized");
mMapHist["hPhiVsPtNeg"]->SetTitle("hPhiVsPtNeg o2::base::Propagator not properly initialized");
mMapHist["h2DEtaPhiPos"]->SetTitle("h2DEtaPhiPos o2::base::Propagator not properly initialized");
mMapHist["hEtaVsPtPos"]->SetTitle("hEtaVsPtPos o2::base::Propagator not properly initialized");
mMapHist["hPhiVsPtPos"]->SetTitle("hPhiVsPtPos o2::base::Propagator not properly initialized");
}
return true;
}

if (mUseCutMaxAbsDCArOnHistos && (std::abs(dcaValue) > mCutMaxAbsDCAr)) {
return true;
}

if (hasASideOnly == 1) {
mMapHist["hPhiAside"]->Fill(phi);
} else if (hasCSideOnly == 1) {
Expand Down Expand Up @@ -304,4 +349,4 @@ void Tracks::dumpToFile(std::string_view filename)
arr.Write(arr.GetName(), TObject::kSingleKey);
}
f->Close();
}
}
Loading