16#ifndef O2_GPU_TRD_RECOPARAM_H
17#define O2_GPU_TRD_RECOPARAM_H
40#if !defined(GPUCA_GPUCODE_DEVICE)
51 GPUd() float convertAngleToDy(
float snp)
const {
return 3.f *
snp / CAMath::Sqrt(1 -
snp *
snp); }
54 GPUd()
float getCorrYDy(
float snp)
const {
return CAMath::Sqrt(mCorrYDyA + mCorrYDyC * (
snp - mLorentzAngle) * (
snp - mLorentzAngle)); }
59 GPUd()
float getZCorrCoeffNRC()
const {
return mZCorrCoefNRC; }
62 GPUd() int getPileUpRangeBefore()
const {
return mPileUpRangeBefore; }
63 GPUd() int getPileUpRangeAfter()
const {
return mPileUpRangeAfter; }
67 float mLorentzAngle{0.f};
76 float mCorrYDyA{9e-4f};
77 float mCorrYDyC{1.5e-2f};
79 float mPullA{2.8e-3f};
84 float mOccDyA{2.5e-4f};
87 float mDyExpC{-1.65f};
88 float mDyExpNormA{1.96e-3f};
89 float mDyExpNormC{0.21f};
91 float mZCorrCoefNRC{1.4f};
95 int mPileUpRangeBefore{-130};
96 int mPileUpMaxProb{0};
97 int mPileUpRangeAfter{70};
99 int mPileUpRangeBefore11{-130};
100 int mPileUpMaxProb11{0};
101 int mPileUpRangeAfter11{30};
103 int mPileUpRangeBefore01{-80};
104 int mPileUpMaxProb01{30};
105 int mPileUpRangeAfter01{70};
107 int mPileUpRangeBefore10{-130};
108 int mPileUpMaxProb10{-60};
109 int mPileUpRangeAfter10{30};
111 int mPileUpRangeBefore00{-10};
112 int mPileUpMaxProb00{22};
113 int mPileUpRangeAfter00{40};
125GPUdi() float GPUTRDRecoParam::getRPhiRes(
float snp,
float pull,
int occupancy)
const
128 float tgp = (CAMath::Abs(snp) < 0.99999f) ? CAMath::Abs(snp) / CAMath::Sqrt(1 - snp * snp) : 1e6;
129 float resIdeal = mRPhiA + mRPhiATgp * tgp;
134 float resPull = mPullA * pull * pull + mPullB * pull;
135 float resOccupancy = mOccA * occupancy;
136 return (resIdeal * resIdeal + mRPhiC2 * (snp - mLorentzAngle) * (snp - mLorentzAngle) + resPull * resPull + resOccupancy);
139GPUdi() double GPUTRDRecoParam::getDyLikelihood(
float snp,
float slope,
int occupancy)
const
142 double likelihood = CAMath::Exp(-0.5f * (
slope - GPUTRDRecoParam::convertAngleToDy(snp)) * (
slope - GPUTRDRecoParam::convertAngleToDy(snp)) / GPUTRDRecoParam::getDyRes(snp, occupancy));
145 double expNorm = CAMath::Sqrt(mDyExpNormA + mDyExpNormC * (snp - mLorentzAngle) * (snp - mLorentzAngle));
146 if (
slope < convertAngleToDy(snp)) {
148 likelihood += expNorm * CAMath::Exp((mDyExpA + mDyExpC * (snp - mLorentzAngle)) * (
slope - GPUTRDRecoParam::convertAngleToDy(snp)));
151 likelihood += expNorm * CAMath::Exp(-(mDyExpA - mDyExpC * (snp - mLorentzAngle)) * (
slope - GPUTRDRecoParam::convertAngleToDy(snp)));
155 likelihood /= (1.f + expNorm);
159GPUdi() double GPUTRDRecoParam::getZLikelihood(
float deltaZ,
float padLength,
float sigmaZtrk)
const
163 double lmax = 1.f / (1.f + CAMath::Exp(-0.5f * padLength / 0.5513f / sigmaZtrk)) - 1.f / (1.f + CAMath::Exp(0.5f * padLength / 0.5513f / sigmaZtrk));
164 return 1.f / lmax / (1.f + CAMath::Exp((deltaZ - 0.5f * padLength) / 0.5513f / sigmaZtrk)) - 1.f / lmax / (1.f + CAMath::Exp((deltaZ + 0.5f * padLength) / 0.5513f / sigmaZtrk));
167GPUdi() float GPUTRDRecoParam::getPileUpProbTracklet(
int nBC,
bool withChargeInfo,
bool Q0,
bool Q1)
const
174 int maxBC = mPileUpRangeAfter;
175 int minBC = mPileUpRangeBefore;
176 int maxProbBC = mPileUpMaxProb;
177 if (nBC <= mPileUpRangeBefore || nBC >= mPileUpRangeAfter) {
181 if (withChargeInfo) {
183 maxBC = mPileUpRangeAfter11;
184 minBC = mPileUpRangeBefore11;
185 maxProbBC = mPileUpMaxProb11;
188 maxBC = mPileUpRangeAfter01;
189 minBC = mPileUpRangeBefore01;
190 maxProbBC = mPileUpMaxProb01;
193 maxBC = mPileUpRangeAfter10;
194 minBC = mPileUpRangeBefore10;
195 maxProbBC = mPileUpMaxProb10;
199 if (nBC > maxProbBC && nBC <= 0) {
200 prob += 2. / (maxBC - minBC) / (0 - maxProbBC) * (nBC - maxProbBC);
202 if (nBC > 0 && nBC < maxBC) {
203 prob += 2. / (maxBC - minBC) / (0 - maxBC) * (nBC - maxBC);
207 maxBC = mPileUpRangeAfter00;
208 minBC = mPileUpRangeBefore00;
209 maxProbBC = mPileUpMaxProb00;
214 if (nBC <= minBC || nBC >= maxBC) {
217 float maxProb = 2. / (maxBC - minBC);
218 if (nBC > minBC && nBC <= maxProbBC) {
219 prob += maxProb / (maxProbBC - minBC) * (nBC - minBC);
221 prob += maxProb / (maxProbBC - maxBC) * (nBC - maxBC);
226GPUdi() float GPUTRDRecoParam::getPileUpProbTrack(
int nBC,
std::
array<
int, 6> Q0,
std::
array<
int, 6> Q1)
const
238 float probNoInfo = GPUTRDRecoParam::getPileUpProbTracklet(nBC,
false);
240 float probTrack = probNoInfo;
241 if (probNoInfo < 1e-6f)
245 for (
int i = 0;
i < 6;
i++) {
247 if (Q0[
i] < 0 || Q1[
i] < 0)
249 float probTracklet = GPUTRDRecoParam::getPileUpProbTracklet(nBC,
true, (Q0[
i] != 0), (Q1[
i] != 0));
250 probTrack *= probTracklet / probNoInfo;
void init(float bz, const GPUSettingsRec *rec=nullptr)
Load parameterization for given magnetic field.
GPUTRDRecoParam()=default
const float const float std::array< float, 3 > & cov
GPUd() int getPileUpRangeAfter() const
const float const float rowSize
float float sigmaZtrk const
~GPUTRDRecoParam()=default
GPUd() void recalcTrkltCov(const float tilt
Recalculate tracklet covariance based on phi angle of related track.
GPUTRDRecoParam(const GPUTRDRecoParam &)=default
const float const float std::array< float, 3 > const float pull
const float const float std::array< float, 3 > const float const int occupancy
GPUd() int getPileUpRangeBefore() const
Get BC intervals for pile-up.
GPUd() float getPileUpProbTracklet(int nBC
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...