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#include "TPCFastTransform.h"
26
27#include <vector>
28#include <gsl/span>
29#include <tuple>
30
31class TCanvas;
32
33namespace o2
34{
35
36namespace gpu
37{
38class GPUO2InterfaceRefit;
39class CorrectionMapsHelper;
40}
41
42namespace tpc
43{
44
45class ClusterNativeAccess;
46class ClusterNative;
47class VDriftCorrFact;
48
74
76{
77
78 public:
80 enum DEdxType : unsigned char {
83 dedxBB
84 };
85
86 enum DEdxRegion : unsigned char {
89 sector
90 };
91
94 CalibPadGainTracks(const bool initCalPad = true) : CalibPadGainTracksBase(initCalPad) { reserveMemory(); }
95
98
101 void processTracks(const int nMaxTracks = -1);
102
107 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);
108
112 void setMode(DEdxType iMode) { mMode = iMode; }
113
116 void setMomentumRange(const float momMin, const float momMax);
117
119 void setMaxEta(const float eta) { mEtaMax = eta; }
120
122 void setdEdxMin(const float mindedx) { mDedxMin = mindedx; }
123
125 void setdEdxMax(const float maxdEdx) { mDedxMax = maxdEdx; }
126
128 void doNotNomalize(const bool doNotNormCharge) { mDoNotNormCharge = doNotNormCharge; }
129
131 void setMinNClusters(const int nCl) { mMinClusters = nCl; }
132
134 void setPropagateTrack(const bool propagate) { mPropagateTrack = propagate; }
135
137 void setFieldNominalGPUBz(const float field) { mFieldNominalGPUBz = field; }
138
140 void setChargeType(const ChargeType chargeType) { mChargeType = chargeType; }
141
145 void setRefGainMap(const char* inpFile, const char* mapName);
146
149 void setRefGainMap(const CalPad& gainmap) { mGainMapRef = std::make_unique<CalPad>(gainmap); }
150
152 void setdEdxRegion(const DEdxRegion dedx);
153
155 float getMomMin() const { return mMomMin; }
156
158 float getMomMax() const { return mMomMax; }
159
161 float getEtaMax() const { return mEtaMax; }
162
164 float getdEdxMin() const { return mDedxMin; }
165
167 float getdEdxMax() const { return mDedxMax; }
168
170 bool getdoNotNomalize() const { return mDoNotNormCharge; }
171
173 float getMinNClusters() const { return mMinClusters; }
174
176 bool getPropagateTrack() const { return mPropagateTrack; }
177
179 float getFieldNominalGPUBz() const { return mFieldNominalGPUBz; };
180
184 void dumpToFile(const char* outFileName = "calPadGainTracks.root", const char* outName = "calPadGain") const;
185
188 void loadPolTopologyCorrectionFromFile(std::string_view fileName);
189
193
199 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); }
200
206 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); }
207
211 void dumpReferenceExtractedGainMap(const char* outFileName = "GainMapRefExtracted.root", const char* outName = "GainMap") const;
212
215
218
219 private:
220 gsl::span<const TrackTPC>* mTracks{nullptr};
221 gsl::span<const TPCClRefElem>* mTPCTrackClIdxVecInput{nullptr};
222 const o2::tpc::ClusterNativeAccess* mClusterIndex{nullptr};
223 gsl::span<const unsigned char> mTPCRefitterShMap;
224 gsl::span<const unsigned int> mTPCRefitterOccMap;
225 std::vector<unsigned char> mBufVec;
226 DEdxType mMode = dedxTrack;
227 DEdxRegion mDedxRegion = stack;
228 float mFieldNominalGPUBz{-5};
229 float mMomMin{0.1f};
230 float mMomMax{5.f};
231 float mDedxMin{0.f};
232 float mDedxMax{-1.f};
233 float mEtaMax{1.f};
234 float mTPCVDriftRef = -1.;
235 float mTPCVDriftCorrFact = 1.;
236 float mTPCVDrift = -1.;
237 float mTPCDriftTimeOffset = 0.;
238 int mMinClusters{50};
239 bool mPropagateTrack{false};
240 bool mDoNotNormCharge{false};
241 ChargeType mChargeType{ChargeType::Max};
242 o2::gpu::CorrectionMapsHelper* mTPCCorrMapsHelper = nullptr;
243 std::vector<std::vector<float>> mDEdxBuffer{};
244 std::vector<std::tuple<unsigned char, unsigned char, unsigned char, float>> mClTrk;
245 std::vector<float> mDedxTmp{};
246 std::unique_ptr<CalPad> mGainMapRef;
247 std::unique_ptr<CalibdEdxTrackTopologyPol> mCalibTrackTopologyPol;
248
251 void processTrack(TrackTPC track, o2::gpu::GPUO2InterfaceRefit* refit);
252
258 static int getIndex(o2::tpc::PadSubset padSub, int padSubsetNumber, const int row, const int pad);
259
261 float getTrackTopologyCorrection(const o2::tpc::TrackTPC& track, const unsigned int region) const;
262
264 float getTrackTopologyCorrectionPol(const o2::tpc::TrackTPC& track, const o2::tpc::ClusterNative& cl, const unsigned int region, const float charge) const;
265
269 void getTruncMean(float low = 0.05f, float high = 0.6f);
270
272 void drawRefGainMapHelper(const bool type, const Sector sector, const std::string filename, const float minZ, const float maxZ) const;
273
275 void reserveMemory();
276
277 void resizedEdxBuffer();
278
279 int getdEdxBufferIndex(const int region) const;
280
281 float getdEdxIROC(const dEdxInfo& dedx) const { return (mChargeType == ChargeType::Max) ? dedx.dEdxMaxIROC : dedx.dEdxTotIROC; }
282 float getdEdxOROC1(const dEdxInfo& dedx) const { return (mChargeType == ChargeType::Max) ? dedx.dEdxMaxOROC1 : dedx.dEdxTotOROC1; }
283 float getdEdxOROC2(const dEdxInfo& dedx) const { return (mChargeType == ChargeType::Max) ? dedx.dEdxMaxOROC2 : dedx.dEdxTotOROC2; }
284 float getdEdxOROC3(const dEdxInfo& dedx) const { return (mChargeType == ChargeType::Max) ? dedx.dEdxMaxOROC3 : dedx.dEdxTotOROC3; }
285 float getdEdxTPC(const dEdxInfo& dedx) const { return (mChargeType == ChargeType::Max) ? dedx.dEdxMaxTPC : dedx.dEdxTotTPC; }
286};
287
288} // namespace tpc
289} // namespace o2
290
291#endif
int16_t charge
Definition RawEventData.h:5
uint32_t side
Definition RawData.h:0
Definition of TPCFastTransform class.
base class for the pad-by-pad residual gain calibration this class can be used to store for each pad ...
Gain calibration class.
void setTPCCorrMaps(o2::gpu::CorrectionMapsHelper *maph)
set cluster correction maps helper
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 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