Project
Loading...
Searching...
No Matches
CalibdEdxTrackTopologySpline.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 CalibdEdxTrackTopologySpline_H
18#define CalibdEdxTrackTopologySpline_H
19
20#include "GPUCommonDef.h"
21
22#include "FlatObject.h"
23#include "Spline.h"
24#include "GPUCommonRtypes.h"
25#include "DataFormatsTPC/Defs.h"
26
27#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE) // code invisible on GPU and in the standalone compilation
28#include <fmt/format.h>
29#endif
30
31namespace o2::tpc
32{
33
69
71{
72 public:
74
76
77#if !defined(GPUCA_GPUCODE)
80
83 CalibdEdxTrackTopologySpline(const char* dEdxSplinesFile, const char* name = "CalibdEdxTrackTopologySpline");
84
87
90
91 void recreate(const int32_t nKnots[]);
92#else
94
98#endif
99
102
104
107
108#if !defined(GPUCA_GPUCODE)
109 void cloneFromObject(const CalibdEdxTrackTopologySpline& obj, char* newFlatBufferPtr);
110 void moveBufferTo(char* newBufferPtr);
111#endif
112
114
115 void destroy();
116 void setActualBufferAddress(char* actualFlatBufferPtr);
117 void setFutureBufferAddress(char* futureFlatBufferPtr);
118
120#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE)
122 void setSplinesFromFile(TFile& inpf);
123
125 void setRangesFromFile(TFile& inpf);
126
128 void setDefaultSplines();
129
133 void setScalingFactorqTot(const float factor, const int32_t region) { mScalingFactorsqTot[region] = factor; };
134
138 void setScalingFactorqMax(const float factor, const int32_t region) { mScalingFactorsqMax[region] = factor; };
139
142 void setMaxTanTheta(const float maxTanTheta) { mMaxTanTheta = maxTanTheta; };
143
146 void setMaxSinPhi(const float maxSinPhi) { mMaxSinPhi = maxSinPhi; };
147#endif
148
150 GPUd() uint32_t getFSplines() const { return FSplines; };
151
153 GPUd() float getMaxTanTheta() const { return mMaxTanTheta; };
154
156 GPUd() float getMaxSinPhi() const { return mMaxSinPhi; };
157
160 GPUd() float getScalingFactorqTot(const int32_t region) const { return mScalingFactorsqTot[region]; };
161
164 GPUd() float getScalingFactorqMax(const int32_t region) const { return mScalingFactorsqMax[region]; };
165
171 GPUd() float interpolateqMax(const int32_t region, const float tanTheta, const float sinPhi, const float z) const
172 {
173 const float x[FDimX] = {z, tanTheta, sinPhi};
174 return mScalingFactorsqMax[region] * mCalibSplinesqMax[region].interpolate(x);
175 };
176
182 GPUd() float interpolateqTot(const int32_t region, const float tanTheta, const float sinPhi, const float z) const
183 {
184 const float x[FDimX] = {z, tanTheta, sinPhi};
185 return mScalingFactorsqTot[region] * mCalibSplinesqTot[region].interpolate(x);
186 };
187
194 GPUd() float getCorrection(const int32_t region, const ChargeType charge, const float tanTheta, const float sinPhi, const float z) const { return (charge == ChargeType::Max) ? interpolateqMax(region, tanTheta, sinPhi, z) : interpolateqTot(region, tanTheta, sinPhi, z); }
195
200 GPUd() float getCorrection(const int32_t region, const ChargeType charge, const float x[/*inpXdim*/]) const { return (charge == ChargeType::Tot) ? mCalibSplinesqTot[region].interpolate(x) : mCalibSplinesqMax[region].interpolate(x); }
201
204 GPUd() SplineType& getSplineqMax(const int32_t region) { return mCalibSplinesqMax[region]; };
205
208 GPUd() SplineType& getSplineqTot(const int32_t region) { return mCalibSplinesqTot[region]; };
209
211#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE)
213 int32_t writeToFile(TFile& outf, const char* name = "CalibdEdxTrackTopologySpline");
214
218 void setFromFile(TFile& inpf, const char* name);
219
221 static CalibdEdxTrackTopologySpline* readFromFile(TFile& inpf, const char* name);
222
226 static std::string getSplineName(const int32_t region, const ChargeType charge);
227#endif
228
229 private:
230 GPUglobalconstexpr() static uint32_t FSplines = 10;
231 GPUglobalconstexpr() static int32_t FDimX = 3;
232 SplineType mCalibSplinesqMax[FSplines];
233 SplineType mCalibSplinesqTot[FSplines];
234 float mMaxTanTheta{2.f};
235 float mMaxSinPhi{0.99f};
236 float mScalingFactorsqTot[FSplines]{1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
237 float mScalingFactorsqMax[FSplines]{1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
238
239 ClassDefNV(CalibdEdxTrackTopologySpline, 1);
240};
241
242#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE)
243
245{
247
248 int32_t buffSize = 0;
249 int32_t offsets1[FSplines];
250 int32_t offsets2[FSplines];
251
252 for (uint32_t ireg = 0; ireg < FSplines; ++ireg) {
253 std::string splinename = getSplineName(ireg, ChargeType::Max);
254 SplineType* splineTmpqMax = SplineType::readFromFile(inpf, splinename.data());
255 mCalibSplinesqMax[ireg] = *splineTmpqMax;
256 buffSize = alignSize(buffSize, mCalibSplinesqMax[ireg].getBufferAlignmentBytes());
257 offsets1[ireg] = buffSize;
258 buffSize += mCalibSplinesqMax[ireg].getFlatBufferSize();
259 delete splineTmpqMax;
260 }
261
262 for (uint32_t ireg = 0; ireg < FSplines; ++ireg) {
263 std::string splinename = getSplineName(ireg, ChargeType::Tot);
264 SplineType* splineTmpqTot = SplineType::readFromFile(inpf, splinename.data());
265 mCalibSplinesqTot[ireg] = *splineTmpqTot;
266 buffSize = alignSize(buffSize, mCalibSplinesqTot[ireg].getBufferAlignmentBytes());
267 offsets2[ireg] = buffSize;
268 buffSize += mCalibSplinesqTot[ireg].getFlatBufferSize();
269 delete splineTmpqTot;
270 }
271
273
274 for (uint32_t i = 0; i < FSplines; i++) {
275 mCalibSplinesqMax[i].moveBufferTo(mFlatBufferPtr + offsets1[i]);
276 }
277 for (uint32_t i = 0; i < FSplines; i++) {
278 mCalibSplinesqTot[i].moveBufferTo(mFlatBufferPtr + offsets2[i]);
279 }
280}
281
282#endif
283
284} // namespace o2::tpc
285
286#endif
Definition of FlatObject class.
int32_t i
configStandalone Reconstruction rec_tpc multiplier for the combined cluster track error during track following area in cm for the search of for z only used if decrease removal by when above this local occupancy rowx Shift of TPC revert cluster flag edge bit distance to edge exceeds this ZOffset for secondary multiple of radius max P of electron K BB bands crossing max P of electron p BB bands crossing max P of electron d BB bands crossing max P of electron t BB bands crossing min accepted dEdxMaxTPC of the track Additive extra cluster error for Y2 if edge flag set Additive extra cluster error for Y2 if single set Additive extra cluster error for Y2 if or single set Additive extra cluster error for Z2 if or single set Extra errors to add to track when crossing depending on addErrorsCECrossing Inner portion of y range in sector that is not used in searching for extrapolated track candidates factor2YS for track merging factor2K for track merging Margin in cm of Y position when rejecting edge clusters based on uncorrected track Y Max fraction of shared clusters for tracklet Except pad from cluster finding if total number of charges in a fragment is above this Except pad from cluster finding if number of consecutive charges in a fragment is above this Threshold where a timebin is considered disabling the noisy pad check for that pad Treat signal above this minimum as saturated Smoothing factor for the exponential Highly Ionising Particle tail filter Number of timebins to use for the averaging Add additional custom track errors when crossing relative as fraction of Do N fit passes in final fit of< 0:reject at max -n hits") AddOptionRTC(rejectIFCLowRadiusCluster, uint8_t, 1, "", 0, "Reject clusters that get the IFC mask error during refit") AddOptionRTC(dEdxTruncLow, uint8_t, 2, "", 0, "Low truncation threshold, fraction of 128") AddOptionRTC(dEdxTruncHigh, uint8_t, 77, "", 0, "High truncation threshold, fraction of 128") AddOptionRTC(extrapolationTracking, int8_t, 1, "", 0, "Enable Extrapolation Tracking(prolong tracks to adjacent sectors to find short segments)") AddOptionRTC(disableRefitAttachment, uint8_t, 0, "", 0, "Bitmask to disable certain attachment steps during refit(1:attachment, 2:propagation, 4:loop following, 8:mirroring)") AddOptionRTC(rejectionStrategy, uint8_t, o2::gpu::GPUSettings::RejectionStrategyA, "", 0, "Enable rejection of TPC clusters for compression(0=no, 1=strategy A, 2=strategy B)") AddOptionRTC(mergeLoopersAfterburner, uint8_t, 1, "", 0, "Run afterburner for additional looper merging") AddOptionRTC(compressionTypeMask, uint8_t, o2::gpu::GPUSettings::CompressionFull, "", 0, "TPC Compression mode bits(1=truncate charge/width LSB, 2=differences, 4=track-model)") AddOptionRTC(compressionSortOrder, uint8_t, o2::gpu::GPUSettings::SortTime, "", 0, "Sort order of TPC compression(0=time, 1=pad, 2=Z-time-pad, 3=Z-pad-time, 4=no sorting(use incoming order))") AddOptionRTC(sigBitsCharge, uint8_t, 4, "", 0, "Number of significant bits for TPC cluster charge in compression mode 1") AddOptionRTC(sigBitsWidth, uint8_t, 3, "", 0, "Number of significant bits for TPC cluster width in compression mode 1") AddOptionRTC(dropLoopers, uint8_t, 0, "", 0, "Drop looping tracks starting from second loop") AddOptionRTC(mergerInterpolateErrors, uint8_t, 1, "", 0, "Use interpolation instead of extrapolation for chi2 based cluster rejection") AddOptionRTC(mergerInterpolateRejectAlsoOnCurrentPosition, uint8_t, 1, "", 0, "When using mergerInterpolateErrors, reject based on chi2 twice computed with interpolated and current track position starting from NDF > mergerNonInterpolateRejectMinNDF Merge tracks accross the central electrode Enable PID response Add sub threshold clusters in TPC dEdx computation OR mask of TPC flags that will reject the cluster in alternative dEdx Reject edge clusters based on uncorrected track Y during track fit Increase decrease removal by when on this number of pads from the edge h configStandalone Reconstruction rec_trd Max chi2 for TRD tracklets to be matched to a track Chi2 cut for strict matching mode Number of sigmas for ITS TPC track time error estimate Addition to search road around track prolongation along Y in cm Optimal tracklet rphi resolution in maximum chi2 per attached tracklet for TRD tracks take into account the full likelihood of the slope including exponential tails Tracks with less attached tracklets are discarded after the tracking Post trigger Pile up integration time in BCs fits all iterations but the last one in projections Use material lookup table for TPC refit Apply workarounds to avoid cyclic merge should not be needed tpc dyn configStandalone Processing proc_rtc Replace constant variables static by constexpr expressions Compile RTC in deterministic with NO_FAST_MATH flags and GPUCA_DETERMINISTIC_MODE define Use RTC to optimize GPU code h configStandalone Processing proc_rtctech Use a file lock to serialize access to the cache folder int32_t
configStandalone Reconstruction rec_tpc multiplier for the combined cluster track error during track following area in cm for the search of for z only used if decrease removal by factor
configStandalone Reconstruction rec_tpc float
Definition of Spline class.
char * releaseInternalBuffer()
_____________ Methods for making the data buffer external __________________________
Definition FlatObject.h:538
static constexpr size_t getBufferAlignmentBytes()
Gives minimal alignment in bytes required for the flat buffer.
Definition FlatObject.h:195
void startConstruction()
_____________ Construction _________
Definition FlatObject.h:354
void finishConstruction(int32_t flatBufferSize)
Definition FlatObject.h:370
static constexpr size_t alignSize(size_t sizeBytes, size_t alignmentBytes)
_______________ Generic utilities _______________________________________________
Definition FlatObject.h:275
static constexpr size_t getClassAlignmentBytes()
GPUCA_GPUCODE.
Definition FlatObject.h:192
static Spline * readFromFile(TFile &inpf, const char *name)
read a class object from the file
Definition Spline.h:101
void setFutureBufferAddress(char *futureFlatBufferPtr)
GPUd() SplineType &getSplineqMax(const int32_t region)
static constexpr size_t getBufferAlignmentBytes()
_____________ FlatObject functionality, see FlatObject class for description ____________
Definition FlatObject.h:195
void setSplinesFromFile(TFile &inpf)
sets the splines from an input file
void setFromFile(TFile &inpf, const char *name)
GPUd() float getMaxSinPhi() const
returns the maximum SinPhi for which the splines are valid
CalibdEdxTrackTopologySpline()=default
_____________ Constructors / destructors __________________________
GPUd() float getScalingFactorqTot(const int32_t region) const
void cloneFromObject(const CalibdEdxTrackTopologySpline &obj, char *newFlatBufferPtr)
void setScalingFactorqTot(const float factor, const int32_t region)
void setScalingFactorqMax(const float factor, const int32_t region)
static CalibdEdxTrackTopologySpline * readFromFile(TFile &inpf, const char *name)
read a class object from the file
int32_t writeToFile(TFile &outf, const char *name="CalibdEdxTrackTopologySpline")
_______________ IO ________________________
GPUd() float getScalingFactorqMax(const int32_t region) const
void setRangesFromFile(TFile &inpf)
sets maximum TanTheta and maximum snp from file
void setDefaultSplines()
set default splines: the return value of the splines will be 1 (no correction will be applied)
const float const float const float z const
~CalibdEdxTrackTopologySpline()=default
Destructor.
GPUd() float interpolateqTot(const int32_t region
GPUd() float getMaxTanTheta() const
returns the maximum TanTheta for which the splines are valid
CalibdEdxTrackTopologySpline & operator=(const CalibdEdxTrackTopologySpline &)
Assignment operator.
void setActualBufferAddress(char *actualFlatBufferPtr)
GPUd() uint32_t getFSplines() const
returns the number of splines stored in the calibration object
GPUd() SplineType &getSplineqTot(const int32_t region)
static std::string getSplineName(const int32_t region, const ChargeType charge)
GLint GLenum GLint x
Definition glcorearb.h:403
GLuint const GLchar * name
Definition glcorearb.h:781
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
Global TPC definitions and constants.
ChargeType
Definition Defs.h:72
@ Tot
Definition Defs.h:74
@ Max
Definition Defs.h:73