Project
Loading...
Searching...
No Matches
MatLayerCylSet.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
14
15#ifndef ALICEO2_MATLAYERCYLSET_H
16#define ALICEO2_MATLAYERCYLSET_H
17
18#include "GPUCommonDef.h"
20#include "DetectorsBase/Ray.h"
21#include "FlatObject.h"
22
23#ifndef GPUCA_ALIGPUCODE // this part is unvisible on GPU version
24#include "MathUtils/Cartesian.h"
25#endif // !GPUCA_ALIGPUCODE
26
27/**********************************************************************
28 * *
29 * Set of cylindrical material layer *
30 * *
31 **********************************************************************/
32namespace o2
33{
34namespace base
35{
36
38 float mRMin;
39 float mRMax;
40 float mZMax;
41 float mRMin2;
42 float mRMax2;
45 MatLayerCyl* mLayers; //[mNLayers] set of cylinrical layers
46 float* mR2Intervals; //[mNRIntervals] limits of layers
47 int* mInterval2LrID; //[mNRIntervals-1] mapping from r2 interval to layer ID
48};
49
51{
52
53 public:
54#ifndef GPUCA_GPUCODE
55 MatLayerCylSet() = default;
56 ~MatLayerCylSet() = default;
58#endif
59
60 GPUd() const MatLayerCylSetLayout* get() const { return reinterpret_cast<const MatLayerCylSetLayout*>(mFlatBufferPtr); }
61 GPUd() MatLayerCylSetLayout* get() { return reinterpret_cast<MatLayerCylSetLayout*>(mFlatBufferPtr); }
62
63 GPUd() int getNLayers() const { return get() ? get()->mNLayers : 0; }
64 GPUd() const MatLayerCyl& getLayer(int i) const { return get()->mLayers[i]; }
65
66 GPUd() bool getLayersRange(const Ray& ray, short& lmin, short& lmax) const;
67 GPUd() float getRMin() const { return get()->mRMin; }
68 GPUd() float getRMax() const { return get()->mRMax; }
69 GPUd() float getZMax() const { return get()->mZMax; }
70 GPUd() float getRMin2() const { return get()->mRMin2; }
71 GPUd() float getRMax2() const { return get()->mRMax2; }
72
73#ifndef GPUCA_ALIGPUCODE // this part is unvisible on GPU version
74 void print(bool data = false) const;
75 void addLayer(float rmin, float rmax, float zmax, float dz, float drphi);
80 void populateFromTGeo(int ntrPerCel = 10, int nThreads = -1, MatbudGeomBackend backend = MatbudGeomBackend::ROOT);
81 static int getNThreadsFromEnv();
82 void optimizePhiSlices(float maxRelDiff = 0.05);
83
84 void dumpToTree(const std::string& outName = "matbudTree.root") const;
85 void writeToFile(const std::string& outFName = "matbud.root");
86 static MatLayerCylSet* loadFromFile(const std::string& inpFName = "matbud.root");
88
89 // initializes internal voxel lookup
90 void initLayerVoxelLU();
91
92 void flatten();
93
94 MatLayerCyl& getLayer(int i) { return get()->mLayers[i]; }
95 MatLayerCylSet* extractCopy(float rmin, float rmax, float tol = 1e-3, const MatLayerCylSet* toAdd = nullptr) const;
96 void finalizeStructures();
97
98#endif // !GPUCA_ALIGPUCODE
99
100#ifndef GPUCA_ALIGPUCODE // this part is unvisible on GPU version
101 MatBudget getMatBudget(const math_utils::Point3D<float>& point0, const math_utils::Point3D<float>& point1) const
102 {
103 // get material budget traversed on the line between point0 and point1
104 return getMatBudget(point0.X(), point0.Y(), point0.Z(), point1.X(), point1.Y(), point1.Z());
105 }
106
107 void scaleLayersByID(int lrFrom, int lrTo, float factor, bool _x2x0 = true, bool _rho = true);
108 void scaleLayersByR(float rFrom, float rTo, float factor, bool _x2x0 = true, bool _rho = true);
109
110#endif // !GPUCA_ALIGPUCODE
111 GPUd() MatBudget getMatBudget(float x0, float y0, float z0, float x1, float y1, float z1) const;
112
113 GPUd() int searchSegment(float val, int low = -1, int high = -1) const;
114
116 GPUd() int searchLayerFast(float r2, int low = -1, int high = -1) const;
117
119 GPUd() int resolveLayerRange(float r2, int voxel, uint16_t entry) const;
120
122 GPUd() int voxelIndex(float r2) const { return int(o2::gpu::CAMath::Sqrt(r2) * InvVoxelRDelta); }
123
125 GPUd() static constexpr float voxelRMin(int voxel) { return voxel * VoxelRDelta; }
126 GPUd() static constexpr float voxelRMax(int voxel) { return (voxel + 1) * VoxelRDelta; }
127
128#ifndef GPUCA_GPUCODE
129 //-----------------------------------------------------------
130 std::size_t estimateFlatBufferSize() const;
131 void moveBufferTo(char* newFlatBufferPtr);
132
133 void setActualBufferAddress(char* actualFlatBufferPtr);
134 void setFutureBufferAddress(char* futureFlatBufferPtr);
135 void cloneFromObject(const MatLayerCylSet& obj, char* newFlatBufferPtr);
138
139 void fixPointers(char* newPtr = nullptr);
140 void fixPointers(char* oldPtr, char* newPtr, bool newPtrValid = true);
141
143 static constexpr size_t getClassAlignmentBytes() { return 8; }
145 static constexpr size_t getBufferAlignmentBytes() { return 8; }
146#endif // !GPUCA_GPUCODE
147
148 static GPUglobalconstexpr() float LayerRMax = 500; // maximum value of R lookup (corresponds to last layer of MatLUT)
149 static GPUglobalconstexpr() float VoxelRDelta = 0.05; // voxel spacing for layer lookup; seems a natural choice - corresponding ~ to smallest spacing
150 static GPUglobalconstexpr() float InvVoxelRDelta = 1.f / VoxelRDelta;
151 static GPUglobalconstexpr() int NumVoxels = int(LayerRMax / VoxelRDelta);
152 static GPUglobalconstexpr() uint16_t VoxelAmbiguousBit = 0x8000u;
153 static GPUglobalconstexpr() uint16_t VoxelSegmentMask = 0x7fffu;
154
157
159};
160
161} // namespace base
162} // namespace o2
163
164#endif
void print() const
unsigned short int uint16_t
Definition of FlatObject class.
int32_t i
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char e
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 false
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 bool
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
Declarations for single cylindrical material layer class.
TBranch * ptr
void setActualBufferAddress(char *actualFlatBufferPtr)
uint16_t mLayerVoxelLU[NumVoxels]
static constexpr size_t getBufferAlignmentBytes()
Gives minimal alignment in bytes required for the flat buffer.
GPUd() float getZMax() const
short short &lmax const
void addLayer(float rmin, float rmax, float zmax, float dz, float drphi)
GPUd() float getRMax() const
void optimizePhiSlices(float maxRelDiff=0.05)
void cloneFromObject(const MatLayerCylSet &obj, char *newFlatBufferPtr)
MatLayerCyl & getLayer(int i)
GPUd() static const expr float voxelRMin(int voxel)
Radial boundaries of a voxel.
MatLayerCylSet(const MatLayerCylSet &src)=delete
MatBudget getMatBudget(const math_utils::Point3D< float > &point0, const math_utils::Point3D< float > &point1) const
static MatLayerCylSet * loadFromFile(const std::string &inpFName="matbud.root")
MatLayerCylSet * extractCopy(float rmin, float rmax, float tol=1e-3, const MatLayerCylSet *toAdd=nullptr) const
GPUd() const MatLayerCylSetLayout *get() const
void populateFromTGeo(int ntrPerCel=10, int nThreads=-1, MatbudGeomBackend backend=MatbudGeomBackend::ROOT)
bool mInitializedLayerVoxelLU
first interval based on known radius, plus the ambiguity flag (static dimension for easy copy to GPU)
void scaleLayersByR(float rFrom, float rTo, float factor, bool _x2x0=true, bool _rho=true)
static GPUglobalconstexpr() float LayerRMax
GPUd() static const expr float voxelRMax(int voxel)
static constexpr size_t getClassAlignmentBytes()
Gives minimal alignment in bytes required for the class object.
void moveBufferTo(char *newFlatBufferPtr)
GPUd() float getRMin2() const
std::size_t estimateFlatBufferSize() const
GPUCA_ALIGPUCODE.
ClassDefNV(MatLayerCylSet, 1)
if the voxels have been initialized
void dumpToTree(const std::string &outName="matbudTree.root") const
GPUd() MatLayerCylSetLayout *get()
static MatLayerCylSet * rectifyPtrFromFile(MatLayerCylSet *ptr)
GPUd() const MatLayerCyl &getLayer(int i) const
void setFutureBufferAddress(char *futureFlatBufferPtr)
GPUd() float getRMax2() const
void scaleLayersByID(int lrFrom, int lrTo, float factor, bool _x2x0=true, bool _rho=true)
void fixPointers(char *newPtr=nullptr)
void writeToFile(const std::string &outFName="matbud.root")
GPUd() int getNLayers() const
char * releaseInternalBuffer()
_____________ Methods for making the data buffer external __________________________
Definition FlatObject.h:538
void adoptInternalBuffer(char *buf)
Definition FlatObject.h:546
GLuint GLfloat GLfloat GLfloat GLfloat y1
Definition glcorearb.h:5034
GLuint GLfloat GLfloat GLfloat x1
Definition glcorearb.h:5034
GLdouble f
Definition glcorearb.h:310
GLuint GLfloat x0
Definition glcorearb.h:5034
GLuint GLfloat * val
Definition glcorearb.h:1582
GLuint GLfloat GLfloat y0
Definition glcorearb.h:5034
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
int mNRIntervals
number of R interval boundaries, one more than the number of intervals (gaps are possible)
float mRMax2
precalculater rmax^2
float mRMin2
precalculater rmin^2