Project
Loading...
Searching...
No Matches
Tracking.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
14
15#define _USE_MATH_DEFINES
16
17#include <cmath>
18
19//root includes
20#include "TStyle.h"
21#include "TFile.h"
22#include "TCanvas.h"
23#include "TH1F.h"
24#include "TH2F.h"
25#include "TH1D.h"
26
27//o2 includes
29#include "TPCQC/Tracking.h"
30#include "GPUO2InterfaceQA.h"
31#include "GPUO2InterfaceUtils.h"
35
37
38using namespace o2::tpc::qc;
39using namespace o2::gpu;
40
41Tracking::Tracking() = default;
42Tracking::~Tracking() = default;
43
44static constexpr int QAMODE = 7; // Efficiency (1) | Res (2) | Pull (3), others are not supported from external input!
45
46//______________________________________________________________________________
47void Tracking::initialize(outputModes outputMode, bool postprocessOnly)
48{
49 mOutputMode = outputMode;
50 mQAConfig = std::make_unique<GPUO2InterfaceConfiguration>();
51 const auto grp = o2::parameters::GRPObject::loadFrom();
52 if (grp) {
53 mQAConfig->configGRP.solenoidBzNominalGPU = GPUO2InterfaceUtils::getNominalGPUBz(*grp);
54 mQAConfig->configGRP.grpContinuousMaxTimeBin = grp->isDetContinuousReadOut(o2::detectors::DetID::TPC) ? -1 : 0;
55 } else {
56 throw std::runtime_error("Failed to initialize run parameters from GRP");
57 }
58 auto global = mQAConfig->ReadConfigurableParam();
59 if (grp->isDetReadOut(o2::detectors::DetID::TPC) && global.tpcTriggeredMode ^ !grp->isDetContinuousReadOut(o2::detectors::DetID::TPC)) {
60 throw std::runtime_error("TPC triggered mode (GPU_global.tpcTriggeredMode) not set correctly");
61 }
62 mQAConfig->configQA.shipToQCAsCanvas = mOutputMode == outputLayout;
63 mQA = std::make_unique<GPUO2InterfaceQA>(mQAConfig.get());
64 if (!postprocessOnly) {
65 mQA->initializeForProcessing(QAMODE);
66 }
67}
68
69//______________________________________________________________________________
71{
72 mQA->resetHists();
73}
74
75//______________________________________________________________________________
76void Tracking::processTracks(const std::vector<o2::tpc::TrackTPC>* tracks, const std::vector<o2::MCCompLabel>* tracksMC, const o2::tpc::ClusterNativeAccess* clNative, TObjArray* out)
77{
78 mQA->runQA(tracks, tracksMC, clNative);
79 if (mOutputMode == outputPostprocessed || mOutputMode == outputLayout) {
80 mQA->postprocess(*out);
81 }
82}
83
84int Tracking::postprocess(std::vector<TH1F>& in1, std::vector<TH2F>& in2, std::vector<TH1D>& in3, std::vector<TGraphAsymmErrors>& in4, TObjArray& out)
85{
86 return mQA->postprocessExternal(in1, in2, in3, in4, out, QAMODE);
87}
88
89void Tracking::getHists(const std::vector<TH1F>*& h1, const std::vector<TH2F>*& h2, const std::vector<TH1D>*& h3, const std::vector<TGraphAsymmErrors>*& h4) const
90{
91 mQA->getHists(h1, h2, h3, h4);
92}
Header of the General Run Parameters object.
Definition of the Names Generator class.
ClassImp(o2::tpc::qc::Tracking)
static constexpr ID TPC
Definition DetID.h:64
static float getNominalGPUBz(T &src)
static GRPObject * loadFrom(const std::string &grpFileName="")
void getHists(const std::vector< TH1F > *&h1, const std::vector< TH2F > *&h2, const std::vector< TH1D > *&h3, const std::vector< TGraphAsymmErrors > *&h4) const
get histograms
Definition Tracking.cxx:89
void processTracks(const std::vector< o2::tpc::TrackTPC > *tracks, const std::vector< o2::MCCompLabel > *tracksMC, const o2::tpc::ClusterNativeAccess *clNative, TObjArray *out=nullptr)
Definition Tracking.cxx:76
void initialize(outputModes outputMode, bool postprocessOnly=false)
Definition Tracking.cxx:47
int postprocess(std::vector< TH1F > &in1, std::vector< TH2F > &in2, std::vector< TH1D > &in3, std::vector< TGraphAsymmErrors > &in4, TObjArray &out)
Definition Tracking.cxx:84
Tracking()
default constructor
void resetHistograms()
Reset all histograms.
Definition Tracking.cxx:70