diff --git a/Detectors/TPC/qc/include/TPCQC/Tracks.h b/Detectors/TPC/qc/include/TPCQC/Tracks.h index 882e7c9222c29..87e949a255905 100644 --- a/Detectors/TPC/qc/include/TPCQC/Tracks.h +++ b/Detectors/TPC/qc/include/TPCQC/Tracks.h @@ -67,6 +67,7 @@ class Tracks /// Dump results to a file void dumpToFile(std::string_view filename); + // Just for backward compatibility with crrent QC, temporary, will be removed in the next PR // 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) @@ -79,32 +80,34 @@ class Tracks mTurnOffHistosForAsync = turnOffHistosForAsync; } - // Just for backward compatibility with crrent QC, temporary, will be removed in the next PR - /// get 1D histograms - std::vector& getHistograms1D() { return mHist1D; } - const std::vector& getHistograms1D() const { return mHist1D; } - - // Just for backward compatibility with crrent QC, temporary, will be removed in the next PR - /// get 2D histograms - std::vector& getHistograms2D() { return mHist2D; } - const std::vector& 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& getHistogramRatios1D() { return mHistRatio1D; } - const std::vector& getHistogramRatios1D() const { return mHistRatio1D; } + // 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, float cutMaxAbsDCAr = 0.1, bool useCutMaxAbsDCArOnHistos = false) + { + mCutAbsEta = AbsEta; + mCutMinnCls = nClusterCut; + mCutMindEdxTot = dEdxTot; + mCutMinPtDCAr = cutPtForDCAr; + mSamplingFractionDCAr = samplingFractionDCAr; + mTurnOffHistosForAsync = turnOffHistosForAsync; + mCutMaxAbsDCAr = cutMaxAbsDCAr; + mUseCutMaxAbsDCArOnHistos = useCutMaxAbsDCArOnHistos; + } /// get ratios of 1D histograms std::unordered_map>& getMapHist() { return mMapHist; } const std::unordered_map>& 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> mMapHist; std::vector mHist1D{}; ///< Initialize vector of 1D histograms std::vector mHist2D{}; ///< Initialize vector of 2D histograms diff --git a/Detectors/TPC/qc/src/Tracks.cxx b/Detectors/TPC/qc/src/Tracks.cxx index c42f35bd24644..f2d0dadb7419c 100644 --- a/Detectors/TPC/qc/src/Tracks.cxx +++ b/Detectors/TPC/qc/src/Tracks.cxx @@ -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()) { @@ -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; @@ -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 (dcaValue > mCutMaxAbsDCAr) { + return true; + } + if (hasASideOnly == 1) { mMapHist["hPhiAside"]->Fill(phi); } else if (hasCSideOnly == 1) { @@ -304,4 +349,4 @@ void Tracks::dumpToFile(std::string_view filename) arr.Write(arr.GetName(), TObject::kSingleKey); } f->Close(); -} +} \ No newline at end of file