Project
Loading...
Searching...
No Matches
CalibPadGainTracks.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_CalibPadGainTracks_H
18#define AliceO2_TPC_CalibPadGainTracks_H
19
20// o2 includes
22#include "TPCBase/CalDet.h"
25
26#include <vector>
27#include <gsl/span>
28#include <tuple>
29
30class TCanvas;
31
32namespace o2
33{
34
35namespace gpu
36{
37class GPUO2InterfaceRefit;
38class TPCFastTransformPOD;
39} // namespace gpu
40
41namespace tpc
42{
43
44class ClusterNativeAccess;
45class ClusterNative;
46class VDriftCorrFact;
47
73
75{
76
77 public:
79 enum DEdxType : unsigned char {
82 dedxBB
83 };
84
85 enum DEdxRegion : unsigned char {
88 sector
89 };
90
93 CalibPadGainTracks(const bool initCalPad = true) : CalibPadGainTracksBase(initCalPad) { reserveMemory(); }
94
97
100 void processTracks(const int nMaxTracks = -1);
101
106 void setMembers(gsl::span<const o2::tpc::TrackTPC>* vTPCTracksArrayInp, gsl::span<const o2::tpc::TPCClRefElem>* tpcTrackClIdxVecInput, const o2::tpc::ClusterNativeAccess& clIndex, gsl::span<const unsigned char> TPCRefitterShMap, gsl::span<const unsigned int> TPCRefitterOccMap);
107
111 void setMode(DEdxType iMode) { mMode = iMode; }
112
115 void setMomentumRange(const float momMin, const float momMax);
116
118 void setMaxEta(const float eta) { mEtaMax = eta; }
119
121 void setdEdxMin(const float mindedx) { mDedxMin = mindedx; }
122
124 void setdEdxMax(const float maxdEdx) { mDedxMax = maxdEdx; }
125
127 void doNotNomalize(const bool doNotNormCharge) { mDoNotNormCharge = doNotNormCharge; }
128
130 void setMinNClusters(const int nCl) { mMinClusters = nCl; }
131
133 void setPropagateTrack(const bool propagate) { mPropagateTrack = propagate; }
134
136 void setFieldNominalGPUBz(const float field) { mFieldNominalGPUBz = field; }
137
139 void setChargeType(const ChargeType chargeType) { mChargeType = chargeType; }
140
144 void setRefGainMap(const char* inpFile, const char* mapName);
145
148 void setRefGainMap(const CalPad& gainmap) { mGainMapRef = std::make_unique<CalPad>(gainmap); }
149
151 void setdEdxRegion(const DEdxRegion dedx);
152
154 float getMomMin() const { return mMomMin; }
155
157 float getMomMax() const { return mMomMax; }
158
160 float getEtaMax() const { return mEtaMax; }
161
163 float getdEdxMin() const { return mDedxMin; }
164
166 float getdEdxMax() const { return mDedxMax; }
167
169 bool getdoNotNomalize() const { return mDoNotNormCharge; }
170
172 float getMinNClusters() const { return mMinClusters; }
173
175 bool getPropagateTrack() const { return mPropagateTrack; }
176
178 float getFieldNominalGPUBz() const { return mFieldNominalGPUBz; };
179
183 void dumpToFile(const char* outFileName = "calPadGainTracks.root", const char* outName = "calPadGain") const;
184
187 void loadPolTopologyCorrectionFromFile(std::string_view fileName);
188
192
198 void drawReferenceGainMapSector(const int sector, const std::string filename = "GainMapSector.pdf", const float minZ = 0, const float maxZ = -1) const { drawRefGainMapHelper(false, sector, filename, minZ, maxZ); }
199
205 void drawReferenceGainMapSide(const o2::tpc::Side side, const std::string filename = "GainMapSide.pdf", const float minZ = 0, const float maxZ = -1) const { drawRefGainMapHelper(true, side == Side::A ? Sector(0) : Sector(Sector::MAXSECTOR - 1), filename, minZ, maxZ); }
206
210 void dumpReferenceExtractedGainMap(const char* outFileName = "GainMapRefExtracted.root", const char* outName = "GainMap") const;
211
214
217
218 private:
219 gsl::span<const TrackTPC>* mTracks{nullptr};
220 gsl::span<const TPCClRefElem>* mTPCTrackClIdxVecInput{nullptr};
221 const o2::tpc::ClusterNativeAccess* mClusterIndex{nullptr};
222 gsl::span<const unsigned char> mTPCRefitterShMap;
223 gsl::span<const unsigned int> mTPCRefitterOccMap;
224 std::vector<unsigned char> mBufVec;
225 DEdxType mMode = dedxTrack;
226 DEdxRegion mDedxRegion = stack;
227 float mFieldNominalGPUBz{-5};
228 float mMomMin{0.1f};
229 float mMomMax{5.f};
230 float mDedxMin{0.f};
231 float mDedxMax{-1.f};
232 float mEtaMax{1.f};
233 float mTPCVDriftRef = -1.;
234 float mTPCVDriftCorrFact = 1.;
235 float mTPCVDrift = -1.;
236 float mTPCDriftTimeOffset = 0.;
237 int mMinClusters{50};
238 bool mPropagateTrack{false};
239 bool mDoNotNormCharge{false};
240 ChargeType mChargeType{ChargeType::Max};
241 const o2::gpu::TPCFastTransformPOD* mTPCCorrMaps = nullptr;
242 std::vector<std::vector<float>> mDEdxBuffer{};
243 std::vector<std::tuple<unsigned char, unsigned char, unsigned char, float>> mClTrk;
244 std::vector<float> mDedxTmp{};
245 std::unique_ptr<CalPad> mGainMapRef;
246 std::unique_ptr<CalibdEdxTrackTopologyPol> mCalibTrackTopologyPol;
247
250 void processTrack(TrackTPC track, o2::gpu::GPUO2InterfaceRefit* refit);
251
257 static int getIndex(o2::tpc::PadSubset padSub, int padSubsetNumber, const int row, const int pad);
258
260 float getTrackTopologyCorrection(const o2::tpc::TrackTPC& track, const unsigned int region) const;
261
263 float getTrackTopologyCorrectionPol(const o2::tpc::TrackTPC& track, const o2::tpc::ClusterNative& cl, const unsigned int region, const float charge) const;
264
268 void getTruncMean(float low = 0.05f, float high = 0.6f);
269
271 void drawRefGainMapHelper(const bool type, const Sector sector, const std::string filename, const float minZ, const float maxZ) const;
272
274 void reserveMemory();
275
276 void resizedEdxBuffer();
277
278 int getdEdxBufferIndex(const int region) const;
279
280 float getdEdxIROC(const dEdxInfo& dedx) const { return (mChargeType == ChargeType::Max) ? dedx.dEdxMaxIROC : dedx.dEdxTotIROC; }
281 float getdEdxOROC1(const dEdxInfo& dedx) const { return (mChargeType == ChargeType::Max) ? dedx.dEdxMaxOROC1 : dedx.dEdxTotOROC1; }
282 float getdEdxOROC2(const dEdxInfo& dedx) const { return (mChargeType == ChargeType::Max) ? dedx.dEdxMaxOROC2 : dedx.dEdxTotOROC2; }
283 float getdEdxOROC3(const dEdxInfo& dedx) const { return (mChargeType == ChargeType::Max) ? dedx.dEdxMaxOROC3 : dedx.dEdxTotOROC3; }
284 float getdEdxTPC(const dEdxInfo& dedx) const { return (mChargeType == ChargeType::Max) ? dedx.dEdxMaxTPC : dedx.dEdxTotTPC; }
285};
286
287} // namespace tpc
288} // namespace o2
289
290#endif
int16_t charge
Definition RawEventData.h:5
uint32_t side
Definition RawData.h:0
base class for the pad-by-pad residual gain calibration this class can be used to store for each pad ...
Gain calibration class.
void setTPCVDrift(const o2::tpc::VDriftCorrFact &v)
set VDrift correction
void setPolTopologyCorrectionFromContainer(const CalibdEdxTrackTopologyPolContainer &polynomials)
void doNotNomalize(const bool doNotNormCharge)
void setdEdxMin(const float mindedx)
void setMomentumRange(const float momMin, const float momMax)
~CalibPadGainTracks()=default
default destructor
void setRefGainMap(const char *inpFile, const char *mapName)
void loadPolTopologyCorrectionFromFile(std::string_view fileName)
void processTracks(const int nMaxTracks=-1)
void setdEdxMax(const float maxdEdx)
void setTPCCorrMaps(const o2::gpu::TPCFastTransformPOD *maph)
set cluster correction maps helper
void setFieldNominalGPUBz(const float field)
void setdEdxRegion(const DEdxRegion dedx)
set how the dedx is calculated which is used for normalizing the cluster charge
@ sector
use the dE/dx from the whole sector
@ chamber
use the dE/dx from IROC and OROC
@ stack
use the dE/dx from IROC, OROC1, OROC2, OROC3
void setPropagateTrack(const bool propagate)
void drawReferenceGainMapSector(const int sector, const std::string filename="GainMapSector.pdf", const float minZ=0, const float maxZ=-1) const
CalibPadGainTracks(const bool initCalPad=true)
void setMaxEta(const float eta)
void setMinNClusters(const int nCl)
void setRefGainMap(const CalPad &gainmap)
DEdxType
mode of normalizing qmax
@ dedxTrack
normalize qMax using the truncated mean from the track
@ dedxTracking
normalize qMax using the dEdx which was calculated during the tracking
@ dedxBB
normalize qMax by evaluating a Bethe Bloch fit. THIS is yet not implemented and shouldnt be used.
void setChargeType(const ChargeType chargeType)
void dumpToFile(const char *outFileName="calPadGainTracks.root", const char *outName="calPadGain") const
void setMembers(gsl::span< const o2::tpc::TrackTPC > *vTPCTracksArrayInp, gsl::span< const o2::tpc::TPCClRefElem > *tpcTrackClIdxVecInput, const o2::tpc::ClusterNativeAccess &clIndex, gsl::span< const unsigned char > TPCRefitterShMap, gsl::span< const unsigned int > TPCRefitterOccMap)
void drawReferenceGainMapSide(const o2::tpc::Side side, const std::string filename="GainMapSide.pdf", const float minZ=0, const float maxZ=-1) const
void dumpReferenceExtractedGainMap(const char *outFileName="GainMapRefExtracted.root", const char *outName="GainMap") const
static constexpr int MAXSECTOR
Definition Sector.h:44
const GLdouble * v
Definition glcorearb.h:832
GLint GLint GLsizei GLint GLenum GLenum type
Definition glcorearb.h:275
GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat maxZ
Definition glcorearb.h:2910
GLfloat GLfloat minZ
Definition glcorearb.h:2910
ChargeType
Definition Defs.h:70
@ Max
Definition Defs.h:71
PadSubset
Definition of the different pad subsets.
Definition Defs.h:63
Side
TPC readout sidE.
Definition Defs.h:35
@ A
Definition Defs.h:35
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::string filename()
simple struct to enable writing the MultivariatePolynomialCT to file
std::vector< int > row