Project
Loading...
Searching...
No Matches
PID.h
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
16
17#ifndef AliceO2_TPC_QC_PID_H
18#define AliceO2_TPC_QC_PID_H
19
20#include <vector>
21#include <unordered_map>
22#include <memory>
23#include <string_view>
24
25// root includes
26#include "TH1.h"
27// Decapricated to be removed in next PR
28#include "TCanvas.h"
29
30// o2 includes
31#include "DataFormatsTPC/Defs.h"
32
33namespace o2
34{
35namespace tpc
36{
37
38class TrackTPC;
39
40namespace qc
41{
42
50class PID
51{
52 public:
54 PID() = default;
55
58 bool processTrack(const o2::tpc::TrackTPC& track, size_t nTracks);
59
60 // dummy version to make it compatible with old QC version
61 bool processTrack(const o2::tpc::TrackTPC& track);
62
65
67 void resetHistograms();
68
70 void dumpToFile(std::string filename);
71
72 // To set the elementary track cuts
73 void setPIDCuts(int minnCls = 60, float absTgl = 1., float mindEdxTot = 10.0,
74 float maxdEdxTot = 70., float minpTPC = 0.05, float maxpTPC = 20., float minpTPCMIPs = 0.45, float maxpTPCMIPs = 0.55, bool turnOffHistosForAsync = false, bool getdEdxVspHypoHist = false)
75 {
76 mCutMinnCls = minnCls;
77 mCutAbsTgl = absTgl;
78 mCutMindEdxTot = mindEdxTot;
79 mCutMaxdEdxTot = maxdEdxTot;
80 mCutMinpTPC = minpTPC;
81 mCutMaxpTPC = maxpTPC;
82 mCutMinpTPCMIPs = minpTPCMIPs;
83 mCutMaxpTPCMIPs = maxpTPCMIPs;
84 mTurnOffHistosForAsync = turnOffHistosForAsync;
85 mGetdEdxVspHypoHist = getdEdxVspHypoHist;
86 }
87
88 // Decapricated to be removed in next PR
90 {
91 mCreateCanvas = createCanvas;
92 }
93
94 std::unordered_map<std::string_view, std::vector<std::unique_ptr<TH1>>>& getMapOfHisto() { return mMapHist; }
95 const std::unordered_map<std::string_view, std::vector<std::unique_ptr<TH1>>>& getMapOfHisto() const { return mMapHist; }
96
97 // Decapricated to be removed in next PR
98 std::unordered_map<std::string_view, std::vector<std::unique_ptr<TCanvas>>>& getMapOfCanvas() { return mMapCanvas; }
99 TCanvas* getSeparationPowerCanvas() { return mSeparationPowerCanvas.get(); }
100 const std::unordered_map<std::string_view, std::vector<std::unique_ptr<TCanvas>>>& getMapOfCanvas() const { return mMapCanvas; }
101
102 private:
103 int mCutMinnCls = 60; // minimum N clusters
104 float mCutAbsTgl = 1.f; // AbsTgl max cut
105 float mCutMindEdxTot = 10.f; // dEdxTot min value
106 float mCutMaxdEdxTot = 70.f; // dEdxTot max value
107 float mCutMinpTPC = 0.05f; // pTPC min value
108 float mCutMaxpTPC = 20.f; // pTPC max value
109 float mCutMinpTPCMIPs = 0.45f; // pTPC min value for MIPs
110 float mCutMaxpTPCMIPs = 0.55f; // pTPC max value for MIPs
111 bool mTurnOffHistosForAsync = false; // Decide whether to turn off some histograms for async to reduce memory
112 bool mGetdEdxVspHypoHist = false; // Decide whether to generate the EdxVspHypo histograms
113 // Decapricated to be removed in next PR
114 bool mCreateCanvas = true; // Decide whether to create the TCanvas Object as it cannot be merged
115
116 std::unordered_map<std::string_view, std::vector<std::unique_ptr<TH1>>> mMapHist;
117 // Decapricated to be removed in next PR
118 // Map for Canvases to be published
119 std::unordered_map<std::string_view, std::vector<std::unique_ptr<TCanvas>>> mMapCanvas;
120 // Map for Histograms which will be put onto the canvases, and not published separately
121 std::unordered_map<std::string_view, std::vector<std::unique_ptr<TH1>>> mMapHistCanvas;
122 std::unique_ptr<TCanvas> mSeparationPowerCanvas;
123
124 ClassDefNV(PID, 1)
125};
126} // namespace qc
127} // namespace tpc
128} // namespace o2
129
130#endif
PID quality control class.
Definition PID.h:51
std::unordered_map< std::string_view, std::vector< std::unique_ptr< TH1 > > > & getMapOfHisto()
Definition PID.h:94
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, bool getdEdxVspHypoHist=false)
Definition PID.h:73
const std::unordered_map< std::string_view, std::vector< std::unique_ptr< TCanvas > > > & getMapOfCanvas() const
Definition PID.h:100
void setCreateCanvas(int createCanvas=1)
Definition PID.h:89
const std::unordered_map< std::string_view, std::vector< std::unique_ptr< TH1 > > > & getMapOfHisto() const
Definition PID.h:95
void dumpToFile(std::string filename)
Dump results to a file.
Definition PID.cxx:223
void resetHistograms()
Reset all histograms.
Definition PID.cxx:103
PID()=default
Constructor.
Definition PID.cxx:23
TCanvas * getSeparationPowerCanvas()
Definition PID.h:99
void initializeHistograms()
Initialize all histograms.
Definition PID.cxx:56
bool processTrack(const o2::tpc::TrackTPC &track, size_t nTracks)
Definition PID.cxx:119
std::unordered_map< std::string_view, std::vector< std::unique_ptr< TCanvas > > > & getMapOfCanvas()
Definition PID.h:98
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::string filename()
TCanvas * createCanvas(std::string name, std::string title, std::vector< std::shared_ptr< TH1I > > &histograms)