Project
Loading...
Searching...
No Matches
GPUdEdx.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 GPUDEDX_H
16#define GPUDEDX_H
17
18#include "GPUCommonDef.h"
19
20#include "GPUDef.h"
21#include "GPUCommonMath.h"
22#include "GPUParam.h"
23#include "GPUdEdxInfo.h"
24#include "DataFormatsTPC/Defs.h"
25#include "CalibdEdxContainer.h"
26#include "GPUTPCGeometry.h"
27#include "GPUDebugStreamer.h"
28#include "GPUDataTypesIO.h"
29
30namespace o2::gpu
31{
32
34{
35 public:
36 // The driver must call clear(), fill clusters row by row outside-in, then run computedEdx() to get the result
38 GPUd() void fillCluster(float qtot, float qmax, int32_t padRow, uint8_t sector, float trackSnp, float trackTgl, const GPUCalibObjectsConst& calib, float z, float pad, float relTime GPUCA_DEBUG_STREAMER_CHECK(, int32_t iTrk, uint8_t flags));
39 GPUd() void fillSubThreshold(int32_t padRow);
40 GPUd() void computedEdx(GPUdEdxInfo& output, const GPUParam& param);
41
42 static GPUglobalconstexpr() size_t MAX_NCL = GPUTPCGeometry::NROWS;
43
44 private:
45 GPUd() float GetSortTruncMean(GPUCA_PAR_DEDX_STORAGE_TYPE_A* array, int32_t count, int32_t trunclow, int32_t trunchigh);
46 GPUd() void checkSubThresh(int32_t roc);
47
48 GPUCA_PAR_DEDX_STORAGE_TYPE_A mChargeTot[MAX_NCL]; // No need for default, just some memory
49 GPUCA_PAR_DEDX_STORAGE_TYPE_A mChargeMax[MAX_NCL]; // No need for default, just some memory
50 float mSubThreshMinTot = 0.f;
51 float mSubThreshMinMax = 0.f;
52 uint8_t mNClsROC[4] = {0};
53 uint8_t mNClsROCSubThresh[4] = {0};
54 uint8_t mCount = 0;
55 uint8_t mLastROC = 255;
56 uint8_t mNSubThresh = 0;
57};
58
59GPUdi() void GPUdEdx::checkSubThresh(int32_t roc)
60{
61 if (roc != mLastROC) {
62 if (mNSubThresh && mCount + mNSubThresh < MAX_NCL) {
63 for (int32_t i = 0; i < mNSubThresh; i++) {
64 mChargeTot[mCount] = (GPUCA_PAR_DEDX_STORAGE_TYPE_A)mSubThreshMinTot;
65 mChargeMax[mCount++] = (GPUCA_PAR_DEDX_STORAGE_TYPE_A)mSubThreshMinMax;
66 }
67 mNClsROC[mLastROC] += mNSubThresh;
68 mNClsROCSubThresh[mLastROC] += mNSubThresh;
69 }
70 mNSubThresh = 0;
71 mSubThreshMinTot = 1e10f;
72 mSubThreshMinMax = 1e10f;
73 }
74
75 mLastROC = roc;
76}
77
78GPUdnii() void GPUdEdx::fillCluster(float qtot, float qmax, int32_t padRow, uint8_t sector, float trackSnp, float trackTgl, const GPUCalibObjectsConst& calib, float z, float pad, float relTime GPUCA_DEBUG_STREAMER_CHECK(, int32_t iTrk, uint8_t flags))
79{
80 // container containing all the dE/dx corrections
81 auto calibContainer = calib.dEdxCalibContainer;
82 constexpr GPUTPCGeometry geo;
83
84 const int32_t roc = geo.GetROC(padRow);
85 checkSubThresh(roc);
86 if (mCount >= MAX_NCL) {
87 return;
88 }
89 GPUCA_DEBUG_STREAMER_CHECK(const float clqTot = qtot; const float clqMax = qmax;)
90 float snp2 = trackSnp * trackSnp;
91 if (snp2 > constants::MAX_SIN_PHI_LOW) {
92 snp2 = constants::MAX_SIN_PHI_LOW;
93 }
94
95 // setting maximum for snp for which the calibration object was created
96 const float snp = CAMath::Abs(trackSnp);
97
98 // tanTheta local dip angle: z angle - dz/dx (cm/cm)
99 const float sec2 = 1.f / (1.f - snp2);
100 const float tgl2 = trackTgl * trackTgl;
101 const float tanTheta = CAMath::Sqrt(tgl2 * sec2);
102
103 // getting the topology correction
104 const uint32_t padPos = CAMath::Min<uint32_t>(GPUTPCGeometry::NPads(padRow) - 1, CAMath::Float2UIntRn(pad)); // position of the pad is shifted half a pad ( pad=3 -> centre position of third pad)
105 const float absRelPad = CAMath::Abs(pad - padPos);
106 const int32_t region = geo.GetRegion(padRow);
107 z = CAMath::Abs(z);
108 const float threshold = calibContainer->getZeroSupressionThreshold(sector, padRow, padPos); // TODO: Use the mean zero supresion threshold of all pads in the cluster?
109 const bool useFullGainMap = calibContainer->isUsageOfFullGainMap();
110 float qTotIn = qtot;
111 const float fullGainMapGain = calibContainer->getGain(sector, padRow, padPos);
112 if (useFullGainMap) {
113 qmax /= fullGainMapGain;
114 qtot /= fullGainMapGain;
115 } else {
116 qTotIn *= fullGainMapGain;
117 }
118
119 const float qMaxTopologyCorr = calibContainer->getTopologyCorrection(region, o2::tpc::ChargeType::Max, tanTheta, snp, z, absRelPad, relTime, threshold, qTotIn);
120 const float qTotTopologyCorr = calibContainer->getTopologyCorrection(region, o2::tpc::ChargeType::Tot, tanTheta, snp, z, absRelPad, relTime, threshold, qTotIn);
121 qmax /= qMaxTopologyCorr;
122 qtot /= qTotTopologyCorr;
123
125 sector,
126 static_cast<tpc::GEMstack>(roc)};
127
128 const float qMaxResidualCorr = calibContainer->getResidualCorrection(stack, tpc::ChargeType::Max, trackTgl, trackSnp);
129 const float qTotResidualCorr = calibContainer->getResidualCorrection(stack, tpc::ChargeType::Tot, trackTgl, trackSnp);
130 qmax /= qMaxResidualCorr;
131 qtot /= qTotResidualCorr;
132
133 const float residualGainMapGain = calibContainer->getResidualGain(sector, padRow, padPos);
134 qmax /= residualGainMapGain;
135 qtot /= residualGainMapGain;
136
137 mChargeTot[mCount] = (GPUCA_PAR_DEDX_STORAGE_TYPE_A)qtot;
138 mChargeMax[mCount++] = (GPUCA_PAR_DEDX_STORAGE_TYPE_A)qmax;
139 mNClsROC[roc]++;
140 if (qtot < mSubThreshMinTot) {
141 mSubThreshMinTot = qtot;
142 }
143 if (qmax < mSubThreshMinMax) {
144 mSubThreshMinMax = qmax;
145 }
146
147 GPUCA_DEBUG_STREAMER_CHECK(if (o2::utils::DebugStreamer::checkStream(o2::utils::StreamFlags::streamdEdx)) {
148 float padlx = geo.Row2X(padRow);
149 float padly = geo.LinearPad2Y(sector, padRow, padPos);
150 o2::utils::DebugStreamer::instance()->getStreamer("debug_dedx", "UPDATE") << o2::utils::DebugStreamer::instance()->getUniqueTreeName("tree_dedx").data()
151 << "qTot=" << mChargeTot[mCount - 1]
152 << "qMax=" << mChargeMax[mCount - 1]
153 << "region=" << region
154 << "padRow=" << padRow
155 << "sector=" << sector
156 << "lx=" << padlx
157 << "ly=" << padly
158 << "tanTheta=" << tanTheta
159 << "trackTgl=" << trackTgl
160 << "sinPhi=" << trackSnp
161 << "z=" << z
162 << "absRelPad=" << absRelPad
163 << "relTime=" << relTime
164 << "threshold=" << threshold
165 << "qTotIn=" << qTotIn
166 << "qMaxTopologyCorr=" << qMaxTopologyCorr
167 << "qTotTopologyCorr=" << qTotTopologyCorr
168 << "qMaxResidualCorr=" << qMaxResidualCorr
169 << "qTotResidualCorr=" << qTotResidualCorr
170 << "residualGainMapGain=" << residualGainMapGain
171 << "fullGainMapGain=" << fullGainMapGain
172 << "iTrk=" << iTrk
173 << "flags=" << flags
174 << "clqTot=" << clqTot
175 << "clqMax=" << clqMax
176 << "\n";
177 })
178}
179
180GPUdi() void GPUdEdx::fillSubThreshold(int32_t padRow)
181{
182 const int32_t roc = GPUTPCGeometry::GetROC(padRow);
183 checkSubThresh(roc);
184 mNSubThresh++;
185}
186
187} // namespace o2::gpu
188
189#endif
Definition of container class for dE/dx corrections.
int32_t i
#define GPUCA_DEBUG_STREAMER_CHECK(...)
#define GPUCA_PAR_DEDX_STORAGE_TYPE_A
configStandalone Light OpenGL display display_light Apply smoothing to points Enable Z buffer Highlight links Highlight seeds Highlight sector tracks Highlight final tracks Show individual sector
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
void output(const std::map< std::string, ChannelStat > &channels)
Definition rawdump.cxx:197
uint32_t roc
Definition RawData.h:3
uint32_t stack
Definition RawData.h:1
float int32_t padRow
Definition GPUdEdx.h:38
float int32_t uint8_t sector
Definition GPUdEdx.h:38
float int32_t uint8_t float float const GPUCalibObjectsConst float float pad
Definition GPUdEdx.h:38
static GPUglobalconstexpr() size_t MAX_NCL
GPUd() void clear()
float int32_t uint8_t float float trackTgl
Definition GPUdEdx.h:38
float int32_t uint8_t float float const GPUCalibObjectsConst & calib
Definition GPUdEdx.h:38
float int32_t uint8_t float trackSnp
Definition GPUdEdx.h:38
GLint GLsizei count
Definition glcorearb.h:399
GLdouble f
Definition glcorearb.h:310
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
GLenum GLfloat param
Definition glcorearb.h:271
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
GPUdi() o2
Definition TrackTRD.h:39
GPUdnii() void GPUdEdx
Definition GPUdEdx.h:78
GEMstack
TPC GEM stack types.
Definition Defs.h:55
@ Tot
Definition Defs.h:74
@ Max
Definition Defs.h:73
@ streamdEdx
stream corrections and cluster properties used for the dE/dx
GEM stack identification.
Definition Defs.h:79
vec clear()