diff --git a/Detectors/Base/include/DetectorsBase/Propagator.h b/Detectors/Base/include/DetectorsBase/Propagator.h index 84cc4b5f30732..2227f2156c401 100644 --- a/Detectors/Base/include/DetectorsBase/Propagator.h +++ b/Detectors/Base/include/DetectorsBase/Propagator.h @@ -34,7 +34,7 @@ namespace parameters { class GRPObject; class GRPMagField; -} +} // namespace parameters namespace dataformats { @@ -45,7 +45,7 @@ namespace field { class MagFieldFast; class MagneticField; -} +} // namespace field namespace gpu { @@ -134,6 +134,7 @@ class PropagatorImpl GPUd() void setGPUField(const o2::gpu::GPUTPCGMPolynomialField* field) { mGPUField = field; } GPUd() const o2::gpu::GPUTPCGMPolynomialField* getGPUField() const { return mGPUField; } GPUd() void setBz(value_type bz) { mBz = bz; } + GPUd() bool hasMagFieldSet() const { return mField != nullptr; } GPUd() void estimateLTFast(o2::track::TrackLTIntegral& lt, const o2::track::TrackParametrization& trc) const; diff --git a/Detectors/TPC/qc/include/TPCQC/Helpers.h b/Detectors/TPC/qc/include/TPCQC/Helpers.h index 9469121bf8f19..23eeb8286104e 100644 --- a/Detectors/TPC/qc/include/TPCQC/Helpers.h +++ b/Detectors/TPC/qc/include/TPCQC/Helpers.h @@ -22,6 +22,7 @@ #include "TH2F.h" #include +#include #include "TPCBase/CalDet.h" namespace o2 @@ -58,6 +59,10 @@ void setStyleHistogram(TH1& histo); void setStyleHistogramsInMap(std::unordered_map>>& mapOfvectors); // set nice style of histograms in a map void setStyleHistogramsInMap(std::unordered_map>& mapOfHisto); +// set nice style of histograms in a map of vectors +void setStyleHistogramsInMap(std::unordered_map>>& mapOfvectors); +// set nice style of histograms in a map +void setStyleHistogramsInMap(std::unordered_map>& mapOfHisto); /// Check if at least one pad in refPedestal and pedestal differs by 3*refNoise to see if new ZS calibration data should be uploaded to the FECs. /// @param refPedestal /// @param refNoise @@ -70,4 +75,4 @@ bool newZSCalib(const o2::tpc::CalDet& refPedestal, const o2::tpc::CalDet } // namespace tpc } // namespace o2 -#endif \ No newline at end of file +#endif diff --git a/Detectors/TPC/qc/include/TPCQC/Tracks.h b/Detectors/TPC/qc/include/TPCQC/Tracks.h index 899d0878fa401..509855673ee48 100644 --- a/Detectors/TPC/qc/include/TPCQC/Tracks.h +++ b/Detectors/TPC/qc/include/TPCQC/Tracks.h @@ -19,6 +19,7 @@ #include #include +#include #include #include @@ -27,9 +28,6 @@ #include "TH1F.h" #include "TH2F.h" -// o2 includes -#include "DataFormatsTPC/Defs.h" - namespace o2 { namespace tpc @@ -77,6 +75,7 @@ class Tracks mCutMinnCls = nClusterCut; mCutMindEdxTot = dEdxTot; } + // Just for backward compatibility with crrent QC, temporary, will be removed in the next PR /// get 1D histograms std::vector& getHistograms1D() { return mHist1D; } @@ -93,14 +92,14 @@ class Tracks const std::vector& getHistogramRatios1D() const { return mHistRatio1D; } /// get ratios of 1D histograms - std::unordered_map>& getMapHist() { return mMapHist; } - const std::unordered_map>& getMapHist() const { return mMapHist; } + 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 - std::unordered_map> mMapHist; + std::unordered_map> mMapHist; std::vector mHist1D{}; ///< Initialize vector of 1D histograms std::vector mHist2D{}; ///< Initialize vector of 2D histograms std::vector mHistRatio1D{}; ///< Initialize vector of ratios of 1D histograms diff --git a/Detectors/TPC/qc/src/Helpers.cxx b/Detectors/TPC/qc/src/Helpers.cxx index 3eb2501edc57e..2abf79f93836a 100644 --- a/Detectors/TPC/qc/src/Helpers.cxx +++ b/Detectors/TPC/qc/src/Helpers.cxx @@ -99,6 +99,25 @@ void helpers::setStyleHistogramsInMap(std::unordered_map>>& mapOfvectors) +{ + for (const auto& keyValue : mapOfvectors) { + for (auto& hist : keyValue.second) { + helpers::setStyleHistogram(*hist); + } + } +} + +//______________________________________________________________________________ +void helpers::setStyleHistogramsInMap(std::unordered_map>& mapOfHisto) +{ + for (const auto& keyValue : mapOfHisto) { + helpers::setStyleHistogram(*(keyValue.second)); + } +} + //______________________________________________________________________________ bool helpers::newZSCalib(const o2::tpc::CalDet& refPedestal, const o2::tpc::CalDet& refNoise, const o2::tpc::CalDet& pedestal) { @@ -119,4 +138,4 @@ bool helpers::newZSCalib(const o2::tpc::CalDet& refPedestal, const o2::tp } return false; -} \ No newline at end of file +} diff --git a/Detectors/TPC/qc/src/Tracks.cxx b/Detectors/TPC/qc/src/Tracks.cxx index 49615c3c786a6..878212c1e0429 100644 --- a/Detectors/TPC/qc/src/Tracks.cxx +++ b/Detectors/TPC/qc/src/Tracks.cxx @@ -16,18 +16,20 @@ // root includes #include "TFile.h" -#include "TMathBase.h" // o2 includes #include "DataFormatsTPC/TrackTPC.h" #include "DataFormatsTPC/dEdxInfo.h" +#include "GPUCommonArray.h" +#include "DetectorsBase/Propagator.h" #include "TPCQC/Tracks.h" #include "TPCQC/Helpers.h" ClassImp(o2::tpc::qc::Tracks); using namespace o2::tpc::qc; - +// DCA histograms +const std::vector types{"A_Pos", "A_Neg", "C_Pos", "C_Neg"}; //______________________________________________________________________________ void Tracks::initializeHistograms() { @@ -78,6 +80,11 @@ void Tracks::initializeHistograms() mMapHist["hPhiAsideRatio"] = std::make_unique("hPhiAsideRatio", "Azimuthal angle, A side, ratio neg./pos. ;phi", 360, 0., 2 * M_PI); mMapHist["hPhiCsideRatio"] = std::make_unique("hPhiCsideRatio", "Azimuthal angle, C side, ratio neg./pos. ;phi", 360, 0., 2 * M_PI); mMapHist["hPtRatio"] = std::make_unique("hPtRatio", "Transverse momentum, ratio neg./pos. ;p_T", logPtBinning.size() - 1, logPtBinning.data()); + + // DCA Histograms + for (const auto type : types) { + mMapHist[fmt::format("hDCAr_{}", type).data()] = std::make_unique(fmt::format("hDCAr_{}", type).data(), fmt::format("DCAr {};phi;DCAr (cm)", type).data(), 360, 0, o2::math_utils::twoPid(), 250, -10., 10.); + } } //______________________________________________________________________________ void Tracks::resetHistograms() @@ -100,7 +107,7 @@ bool Tracks::processTrack(const o2::tpc::TrackTPC& track) const auto hasASideOnly = track.hasASideClustersOnly(); const auto hasCSideOnly = track.hasCSideClustersOnly(); - double absEta = TMath::Abs(eta); + const auto absEta = std::abs(eta); // ===| histogram filling before cuts |=== mMapHist["hNClustersBeforeCuts"]->Fill(nCls); @@ -117,6 +124,31 @@ bool Tracks::processTrack(const o2::tpc::TrackTPC& track) mMapHist["hNClustersAfterCuts"]->Fill(nCls); mMapHist["hEta"]->Fill(eta); + //---| propagate to 0,0,0 |--- + // + // propagator instance must be configured before (LUT, MagField) + auto propagator = o2::base::Propagator::Instance(true); + const int type = (track.getQ2Pt() < 0) + 2 * track.hasCSideClustersOnly(); + auto dcaHist = mMapHist[fmt::format("hDCAr_{}", types[type]).data()].get(); + + if (propagator->getMatLUT() && propagator->hasMagFieldSet()) { + // ---| fill DCA histos |--- + o2::gpu::gpustd::array dca; + const o2::math_utils::Point3D refPoint{0, 0, 0}; + o2::track::TrackPar propTrack(track); + if (propagator->propagateToDCABxByBz(refPoint, propTrack, 2.f, o2::base::Propagator::MatCorrType::USEMatCorrLUT, &dca)) { + const auto phi = o2::math_utils::to02PiGen(track.getPhi()); + dcaHist->Fill(phi, dca[0]); + } + } else { + static bool reported = false; + if (!reported) { + LOGP(error, "o2::base::Propagator not properly initialized, MatLUT ({}) and / or Field ({}) missing, will not fill DCA histograms", (void*)propagator->getMatLUT(), (void*)propagator->hasMagFieldSet()); + reported = true; + } + dcaHist->SetTitle(fmt::format("DCAr {} o2::base::Propagator not properly initialized", types[type]).data()); + } + if (hasASideOnly == 1) { mMapHist["hPhiAside"]->Fill(phi); } else if (hasCSideOnly == 1) {