diff --git a/Detectors/TPC/qc/include/TPCQC/PID.h b/Detectors/TPC/qc/include/TPCQC/PID.h index f07e795afe6a0..c847f3f7fdb5f 100644 --- a/Detectors/TPC/qc/include/TPCQC/PID.h +++ b/Detectors/TPC/qc/include/TPCQC/PID.h @@ -24,6 +24,7 @@ // root includes #include "TH1.h" +// Decapricated to be removed in next PR #include "TCanvas.h" // o2 includes @@ -70,7 +71,7 @@ class PID // To set the elementary track cuts void setPIDCuts(int minnCls = 60, float absTgl = 1., float mindEdxTot = 10.0, - float maxdEdxTot = 70., float minpTPC = 0.05, float maxpTPC = 20., float minpTPCMIPs = 0.45, float maxpTPCMIPs = 0.55, bool turnOffHistosForAsync = false) + float maxdEdxTot = 70., float minpTPC = 0.05, float maxpTPC = 20., float minpTPCMIPs = 0.45, float maxpTPCMIPs = 0.55, bool turnOffHistosForAsync = false, bool getdEdxVspHypoHist = false) { mCutMinnCls = minnCls; mCutAbsTgl = absTgl; @@ -81,15 +82,21 @@ class PID mCutMinpTPCMIPs = minpTPCMIPs; mCutMaxpTPCMIPs = maxpTPCMIPs; mTurnOffHistosForAsync = turnOffHistosForAsync; + mGetdEdxVspHypoHist = getdEdxVspHypoHist; } + + // Decapricated to be removed in next PR void setCreateCanvas(int createCanvas = 1) { mCreateCanvas = createCanvas; } + std::unordered_map>>& getMapOfHisto() { return mMapHist; } + const std::unordered_map>>& getMapOfHisto() const { return mMapHist; } + + // Decapricated to be removed in next PR std::unordered_map>>& getMapOfCanvas() { return mMapCanvas; } TCanvas* getSeparationPowerCanvas() { return mSeparationPowerCanvas.get(); } - const std::unordered_map>>& getMapOfHisto() const { return mMapHist; } const std::unordered_map>>& getMapOfCanvas() const { return mMapCanvas; } private: @@ -101,15 +108,19 @@ class PID float mCutMaxpTPC = 20.f; // pTPC max value float mCutMinpTPCMIPs = 0.45f; // pTPC min value for MIPs float mCutMaxpTPCMIPs = 0.55f; // pTPC max value for MIPs - bool mCreateCanvas = true; // Decide whether to create the TCanvas Object as it cannot be merged bool mTurnOffHistosForAsync = false; // Decide whether to turn off some histograms for async to reduce memory + bool mGetdEdxVspHypoHist = false; // Decide whether to generate the EdxVspHypo histograms + // Decapricated to be removed in next PR + bool mCreateCanvas = true; // Decide whether to create the TCanvas Object as it cannot be merged + std::unordered_map>> mMapHist; + // Decapricated to be removed in next PR // Map for Canvases to be published std::unordered_map>> mMapCanvas; // Map for Histograms which will be put onto the canvases, and not published separately std::unordered_map>> mMapHistCanvas; - // Canvas for Trending Separation Power std::unique_ptr mSeparationPowerCanvas; + ClassDefNV(PID, 1) }; } // namespace qc diff --git a/Detectors/TPC/qc/src/PID.cxx b/Detectors/TPC/qc/src/PID.cxx index 76d747165ea32..9b94e15cd4416 100644 --- a/Detectors/TPC/qc/src/PID.cxx +++ b/Detectors/TPC/qc/src/PID.cxx @@ -18,7 +18,6 @@ // root includes #include "TStyle.h" #include "TFile.h" -#include "TCanvas.h" #include "TMathBase.h" #include "TObjArray.h" @@ -93,16 +92,11 @@ void PID::initializeHistograms() mMapHist["hdEdxMaxMIPVsSec"].emplace_back(std::make_unique(fmt::format("hdEdxMaxMIPVsSec_{}", name).data(), (fmt::format("MIP Q_{{Max}} {}", name) + ";sector;d#it{E}/d#it{x}_{Max} (arb. unit)").data(), binsSec.bins, binsSec.min, binsSec.max, binsdEdxMIPMax.bins, binsdEdxMIPMax.min, binsdEdxMIPMax.max)); mMapHist["hMIPNclVsTgl"].emplace_back(std::make_unique(fmt::format("hMIPNclVsTgl_{}", name).data(), (fmt::format("rec. clusters {}", name) + ";#tan(#lambda); rec clusters").data(), 50, -2, 2, nclMax[idEdxType] - nclCuts[idEdxType], nclCuts[idEdxType], nclMax[idEdxType])); mMapHist["hMIPNclVsTglSub"].emplace_back(std::make_unique(fmt::format("hMIPNclVsTglSub_{}", name).data(), (fmt::format("sub-thrs. clusters {}", name) + ";#tan(#lambda);sub-thrs. clusters").data(), 50, -2, 2, 20, 0, 20)); - if (mCreateCanvas) { - mMapHistCanvas["hdEdxVspHypoPos"].emplace_back(std::make_unique(fmt::format("hdEdxVspHypoPos_{}", name).data(), (fmt::format("Q_{{Tot}} Pos {}", name) + ";#it{p} (GeV/#it{c});d#it{E}/d#it{x}_{Tot} (arb. unit)").data(), 200, bins.data(), binNumber, binsdEdxTot_Log.data())); - mMapHistCanvas["hdEdxVspHypoNeg"].emplace_back(std::make_unique(fmt::format("hdEdxVspHypoNeg_{}", name).data(), (fmt::format("Q_{{Tot}} Neg {}", name) + ";#it{p} (GeV/#it{c});d#it{E}/d#it{x}_{Tot} (arb. unit)").data(), 200, bins.data(), binNumber, binsdEdxTot_Log.data())); + if (mGetdEdxVspHypoHist) { + mMapHist["hdEdxVspHypoPos"].emplace_back(std::make_unique(fmt::format("hdEdxVspHypoPos_{}", name).data(), (fmt::format("Q_{{Tot}} Pos {}", name) + ";#it{p} (GeV/#it{c});d#it{E}/d#it{x}_{Tot} (arb. unit)").data(), 200, bins.data(), binNumber, binsdEdxTot_Log.data())); + mMapHist["hdEdxVspHypoNeg"].emplace_back(std::make_unique(fmt::format("hdEdxVspHypoNeg_{}", name).data(), (fmt::format("Q_{{Tot}} Neg {}", name) + ";#it{p} (GeV/#it{c});d#it{E}/d#it{x}_{Tot} (arb. unit)").data(), 200, bins.data(), binNumber, binsdEdxTot_Log.data())); } } - if (mCreateCanvas) { - mMapCanvas["CdEdxPIDHypothesisVsp"].emplace_back(std::make_unique("CdEdxPIDHypothesisVsp", "PID Hypothesis Ratio")); - mMapCanvas["CdEdxPIDHypothesisVsp"].at(0)->Divide(5, 2); - } - mSeparationPowerCanvas.reset(new TCanvas("CSeparationPower", "Separation Power")); } //______________________________________________________________________________ @@ -113,11 +107,6 @@ void PID::resetHistograms() hist->Reset(); } } - for (const auto& pair : mMapHistCanvas) { - for (auto& hist : pair.second) { - hist->Reset(); - } - } } //______________________________________________________________________________ @@ -185,10 +174,10 @@ bool PID::processTrack(const o2::tpc::TrackTPC& track, size_t nTracks) if (std::abs(tgl) < mCutAbsTgl) { mMapHist["hdEdxTotVsp"][idEdxType]->Fill(pTPC, dEdxTot[idEdxType]); mMapHist["hdEdxMaxVsp"][idEdxType]->Fill(pTPC, dEdxMax[idEdxType]); - if (mCreateCanvas) { + if (mGetdEdxVspHypoHist) { const auto pidHypothesis = track.getPID().getID(); if (pidHypothesis <= o2::track::PID::NIDs) { - auto pidHist = mMapHistCanvas[(track.getCharge() > 0) ? "hdEdxVspHypoPos" : "hdEdxVspHypoNeg"][idEdxType].get(); + auto pidHist = mMapHist[(track.getCharge() > 0) ? "hdEdxVspHypoPos" : "hdEdxVspHypoNeg"][idEdxType].get(); pidHist->SetBinContent(pidHist->GetXaxis()->FindBin(pTPC), pidHist->GetYaxis()->FindBin(dEdxTot[idEdxType]), pidHypothesis + 1); } } @@ -227,21 +216,6 @@ bool PID::processTrack(const o2::tpc::TrackTPC& track, size_t nTracks) } } } - - if (mCreateCanvas) { - for (auto const& pairC : mMapCanvas) { - for (auto& canv : pairC.second) { - int h = 1; - for (auto const& pairH : mMapHistCanvas) { - for (auto& hist : pairH.second) { - canv->cd(h); - hist->Draw(); - h++; - } - } - } - } - } return true; }