Skip to content
Merged
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
5 changes: 3 additions & 2 deletions Detectors/Base/include/DetectorsBase/Propagator.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace parameters
{
class GRPObject;
class GRPMagField;
}
} // namespace parameters

namespace dataformats
{
Expand All @@ -45,7 +45,7 @@ namespace field
{
class MagFieldFast;
class MagneticField;
}
} // namespace field

namespace gpu
{
Expand Down Expand Up @@ -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<value_type>& trc) const;

Expand Down
7 changes: 6 additions & 1 deletion Detectors/TPC/qc/include/TPCQC/Helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "TH2F.h"

#include <vector>
#include <string>
#include "TPCBase/CalDet.h"

namespace o2
Expand Down Expand Up @@ -58,6 +59,10 @@ void setStyleHistogram(TH1& histo);
void setStyleHistogramsInMap(std::unordered_map<std::string_view, std::vector<std::unique_ptr<TH1>>>& mapOfvectors);
// set nice style of histograms in a map
void setStyleHistogramsInMap(std::unordered_map<std::string_view, std::unique_ptr<TH1>>& mapOfHisto);
// set nice style of histograms in a map of vectors
void setStyleHistogramsInMap(std::unordered_map<std::string, std::vector<std::unique_ptr<TH1>>>& mapOfvectors);
// set nice style of histograms in a map
void setStyleHistogramsInMap(std::unordered_map<std::string, std::unique_ptr<TH1>>& 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
Expand All @@ -70,4 +75,4 @@ bool newZSCalib(const o2::tpc::CalDet<float>& refPedestal, const o2::tpc::CalDet
} // namespace tpc
} // namespace o2

#endif
#endif
11 changes: 5 additions & 6 deletions Detectors/TPC/qc/include/TPCQC/Tracks.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include <vector>
#include <string_view>
#include <string>
#include <unordered_map>
#include <memory>

Expand All @@ -27,9 +28,6 @@
#include "TH1F.h"
#include "TH2F.h"

// o2 includes
#include "DataFormatsTPC/Defs.h"

namespace o2
{
namespace tpc
Expand Down Expand Up @@ -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<TH1F>& getHistograms1D() { return mHist1D; }
Expand All @@ -93,14 +92,14 @@ class Tracks
const std::vector<TH1F>& getHistogramRatios1D() const { return mHistRatio1D; }

/// get ratios of 1D histograms
std::unordered_map<std::string_view, std::unique_ptr<TH1>>& getMapHist() { return mMapHist; }
const std::unordered_map<std::string_view, std::unique_ptr<TH1>>& getMapHist() const { return mMapHist; }
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
std::unordered_map<std::string_view, std::unique_ptr<TH1>> mMapHist;
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
std::vector<TH1F> mHistRatio1D{}; ///< Initialize vector of ratios of 1D histograms
Expand Down
21 changes: 20 additions & 1 deletion Detectors/TPC/qc/src/Helpers.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,25 @@ void helpers::setStyleHistogramsInMap(std::unordered_map<std::string_view, std::
helpers::setStyleHistogram(*(keyValue.second));
}
}

//______________________________________________________________________________
void helpers::setStyleHistogramsInMap(std::unordered_map<std::string, std::vector<std::unique_ptr<TH1>>>& mapOfvectors)
{
for (const auto& keyValue : mapOfvectors) {
for (auto& hist : keyValue.second) {
helpers::setStyleHistogram(*hist);
}
}
}

//______________________________________________________________________________
void helpers::setStyleHistogramsInMap(std::unordered_map<std::string, std::unique_ptr<TH1>>& mapOfHisto)
{
for (const auto& keyValue : mapOfHisto) {
helpers::setStyleHistogram(*(keyValue.second));
}
}

//______________________________________________________________________________
bool helpers::newZSCalib(const o2::tpc::CalDet<float>& refPedestal, const o2::tpc::CalDet<float>& refNoise, const o2::tpc::CalDet<float>& pedestal)
{
Expand All @@ -119,4 +138,4 @@ bool helpers::newZSCalib(const o2::tpc::CalDet<float>& refPedestal, const o2::tp
}

return false;
}
}
38 changes: 35 additions & 3 deletions Detectors/TPC/qc/src/Tracks.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string_view> types{"A_Pos", "A_Neg", "C_Pos", "C_Neg"};
//______________________________________________________________________________
void Tracks::initializeHistograms()
{
Expand Down Expand Up @@ -78,6 +80,11 @@ void Tracks::initializeHistograms()
mMapHist["hPhiAsideRatio"] = std::make_unique<TH1F>("hPhiAsideRatio", "Azimuthal angle, A side, ratio neg./pos. ;phi", 360, 0., 2 * M_PI);
mMapHist["hPhiCsideRatio"] = std::make_unique<TH1F>("hPhiCsideRatio", "Azimuthal angle, C side, ratio neg./pos. ;phi", 360, 0., 2 * M_PI);
mMapHist["hPtRatio"] = std::make_unique<TH1F>("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<TH2F>(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()
Expand All @@ -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);
Expand All @@ -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<float, 2> dca;
const o2::math_utils::Point3D<float> 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) {
Expand Down