Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:18:24

0001 // Copyright CERN and copyright holders of ALICE O2. This software is
0002 // distributed under the terms of the GNU General Public License v3 (GPL
0003 // Version 3), copied verbatim in the file "COPYING".
0004 //
0005 // See http://alice-o2.web.cern.ch/license for full licensing information.
0006 //
0007 // In applying this license CERN does not waive the privileges and immunities
0008 // granted to it by virtue of its status as an Intergovernmental Organization
0009 // or submit itself to any jurisdiction.
0010 
0011 /// \file GPUTPCTrackParam.h
0012 /// \author Sergey Gorbunov, Ivan Kisel, David Rohr
0013 
0014 #ifndef GPUTPCTRACKPARAM_H
0015 #define GPUTPCTRACKPARAM_H
0016 
0017 #include "GPUTPCBaseTrackParam.h"
0018 #include <cmath>
0019 
0020 class GPUTPCTrackLinearisation;
0021 /**
0022  * @class GPUTPCTrackParam
0023  *
0024  * GPUTPCTrackParam class describes the track parametrisation
0025  * which is used by the GPUTPCTracker slice tracker.
0026  *
0027  */
0028 class GPUTPCTrackParam
0029 {
0030  public:
0031   struct GPUTPCTrackFitParam {
0032     double bethe, e, theta2, EP2, sigmadE2, k22, k33, k43, k44; // parameters
0033   };
0034 
0035    const GPUTPCBaseTrackParam& GetParam() const { return mParam; }
0036    void SetParam(const GPUTPCBaseTrackParam& v) { mParam = v; }
0037    void InitParam();
0038 
0039    double X() const { return mParam.X(); }
0040    double Y() const { return mParam.Y(); }
0041    double Z() const { return mParam.Z(); }
0042    double SinPhi() const { return mParam.SinPhi(); }
0043    double DzDs() const { return mParam.DzDs(); }
0044    double QPt() const { return mParam.QPt(); }
0045    double ZOffset() const { return mParam.ZOffset(); }
0046    double SignCosPhi() const { return mSignCosPhi; }
0047    double Chi2() const { return mChi2; }
0048    int NDF() const { return mNDF; }
0049 
0050    double Err2Y() const { return mC[0]; }
0051    double Err2Z() const { return mC[2]; }
0052    double Err2SinPhi() const { return mC[5]; }
0053    double Err2DzDs() const { return mC[9]; }
0054    double Err2QPt() const { return mC[14]; }
0055 
0056    double GetX() const { return mParam.GetX(); }
0057    double GetY() const { return mParam.GetY(); }
0058    double GetZ() const { return mParam.GetZ(); }
0059    double GetSinPhi() const { return mParam.GetSinPhi(); }
0060    double GetDzDs() const { return mParam.GetDzDs(); }
0061    double GetQPt() const { return mParam.GetQPt(); }
0062    double GetSignCosPhi() const { return mSignCosPhi; }
0063    double GetChi2() const { return mChi2; }
0064    int GetNDF() const { return mNDF; }
0065 
0066    double GetKappa(double Bz) const { return mParam.GetKappa(Bz); }
0067    double GetCosPhi() const { return mSignCosPhi * sqrt(1 - SinPhi() * SinPhi()); }
0068 
0069    double GetErr2Y() const { return mC[0]; }
0070    double GetErr2Z() const { return mC[2]; }
0071    double GetErr2SinPhi() const { return mC[5]; }
0072    double GetErr2DzDs() const { return mC[9]; }
0073    double GetErr2QPt() const { return mC[14]; }
0074 
0075    const double* Par() const { return mParam.Par(); }
0076    const double* Cov() const { return mC; }
0077 
0078    const double* GetPar() const { return mParam.GetPar(); }
0079    double GetPar(int i) const { return (mParam.GetPar(i)); }
0080    const double* GetCov() const { return mC; }
0081    double GetCov(int i) const { return mC[i]; }
0082 
0083    void SetPar(int i, double v) { mParam.SetPar(i, v); }
0084    void SetCov(int i, double v) { mC[i] = v; }
0085 
0086    void SetX(double v) { mParam.SetX(v); }
0087    void SetY(double v) { mParam.SetY(v); }
0088    void SetZ(double v) { mParam.SetZ(v); }
0089    void SetSinPhi(double v) { mParam.SetSinPhi(v); }
0090    void SetDzDs(double v) { mParam.SetDzDs(v); }
0091    void SetQPt(double v) { mParam.SetQPt(v); }
0092    void SetZOffset(double v) { mParam.SetZOffset(v); }
0093    void SetSignCosPhi(double v) { mSignCosPhi = v >= 0 ? 1 : -1; }
0094    void SetChi2(double v) { mChi2 = v; }
0095    void SetNDF(int v) { mNDF = v; }
0096 
0097    double GetDist2(const GPUTPCTrackParam& t) const;
0098    double GetDistXZ2(const GPUTPCTrackParam& t) const;
0099 
0100    double GetS(double x, double y, double Bz) const;
0101 
0102    void GetDCAPoint(double x, double y, double z, double& px, double& py, double& pz, double Bz) const;
0103 
0104    bool TransportToX(double x, double Bz, double maxSinPhi = GPUCA_MAX_SIN_PHI);
0105    bool TransportToXWithMaterial(double x, double Bz, double maxSinPhi = GPUCA_MAX_SIN_PHI);
0106 
0107    bool TransportToX(double x, GPUTPCTrackLinearisation& t0, double Bz, double maxSinPhi = GPUCA_MAX_SIN_PHI, double* DL = nullptr);
0108 
0109    bool TransportToX(double x, double sinPhi0, double cosPhi0, double Bz, double maxSinPhi = GPUCA_MAX_SIN_PHI);
0110 
0111    bool TransportToXWithMaterial(double x, GPUTPCTrackLinearisation& t0, GPUTPCTrackFitParam& par, double Bz, double maxSinPhi = GPUCA_MAX_SIN_PHI);
0112 
0113    bool TransportToXWithMaterial(double x, GPUTPCTrackFitParam& par, double Bz, double maxSinPhi = GPUCA_MAX_SIN_PHI);
0114 
0115    static double ApproximateBetheBloch(double beta2);
0116    static double BetheBlochGeant(double bg, double kp0 = 2.33f, double kp1 = 0.20f, double kp2 = 3.00f, double kp3 = 173e-9f, double kp4 = 0.49848f);
0117    static double BetheBlochSolid(double bg);
0118    double BetheBlochGas(double bg);
0119 
0120    void CalculateFitParameters(GPUTPCTrackFitParam& par, double mass = 0.13957f);
0121    bool CorrectForMeanMaterial(double xOverX0, double xTimesRho, const GPUTPCTrackFitParam& par);
0122 
0123    bool Rotate(double alpha, double maxSinPhi = GPUCA_MAX_SIN_PHI);
0124    bool Rotate(double alpha, GPUTPCTrackLinearisation& t0, double maxSinPhi = GPUCA_MAX_SIN_PHI);
0125    bool Filter(double y, double z, double err2Y, double err2Z, double maxSinPhi = GPUCA_MAX_SIN_PHI, bool paramOnly = false);
0126 
0127    bool CheckNumericalQuality() const;
0128 
0129    void Print() const;
0130 
0131    void setNeonFraction(double frac) { Ne_frac = frac; };
0132    void setArgonFraction(double frac) { Ar_frac = frac; };
0133    void setCF4Fraction(double frac) { CF4_frac = frac; };
0134    void setNitrogenFraction(double frac) { N2_frac = frac; };
0135    void setIsobutaneFraction(double frac) { isobutane_frac = frac; };
0136 
0137 #ifndef GPUCA_GPUCODE
0138  private:
0139 #endif //! GPUCA_GPUCODE
0140   GPUTPCBaseTrackParam
0141   mParam; // Track Parameters
0142 
0143  private:
0144   // WARNING, Track Param Data is copied in the GPU Tracklet Constructor element by element instead of using copy constructor!!!
0145   // This is neccessary for performance reasons!!!
0146   // Changes to Elements of this class therefore must also be applied to TrackletConstructor!!!
0147   double mC[15];      // the covariance matrix for Y,Z,SinPhi,..
0148   double mSignCosPhi; // sign of cosPhi
0149   double mChi2;       // the chi^2 value
0150   int mNDF;          // the Number of Degrees of Freedom
0151 
0152 
0153   //Gas parameters
0154   //Sources
0155   //https://doi.org/10.1016/0092-640X(84)90002-0
0156   //https://pdg.lbl.gov/2024/AtomicNuclearProperties/index.html
0157   //https://www.slac.stanford.edu/pubs/icfa/summer98/paper3/paper3.pdf
0158 
0159   double Ne_frac = 0.00;
0160   double Ne_Rho = 0.839e-3; // g/cm3, density
0161   double Ne_RadLen = 28.93; // g/cm2, radiation length
0162   double Ne_x0 = 2.0735; // 1st Bethe-Bloch pole
0163   double Ne_x1 = 4.6421; //2nd Bethe-Bloch pole
0164   double Ne_mI = 137; //eV, mean excitation
0165   double Ne_mZA = 0.4955; // Mean atomic number / mass number
0166   double Ne_mA = 20.18; // Mean amass number
0167 
0168   double Ar_frac = 0.75;
0169   double Ar_Rho = 1.662e-3; // g/cm3, density
0170   double Ar_RadLen = 19.55; // g/cm2, radiation length
0171   double Ar_x0 = 1.7635; // 1st Bethe-Bloch pole
0172   double Ar_x1 = 4.4855; //2nd Bethe-Bloch pole
0173   double Ar_mI = 188; //eV, mean excitation
0174   double Ar_mZA = 0.4506; // Mean atomic number / mass number
0175   double Ar_mA = 39.948; // Mean amass number
0176 
0177   double CF4_frac = 0.20;
0178   double CF4_Rho = 3.78e-3; // g/cm3, density
0179   double CF4_RadLen = 33.99; // g/cm2, radiation length
0180   double CF4_x0 = 1.7635; // 1st Bethe-Bloch pole
0181   double CF4_x1 = 4.4855; //2nd Bethe-Bloch pole
0182   double CF4_mI = 115; //eV, mean excitation
0183   double CF4_mZA = 0.4772; // Mean atomic number / mass number
0184   double CF4_mA = 88.013; // Mean amass number
0185 
0186   double N2_frac = 0.00;
0187   double N2_Rho = 1.165e-3; // g/cm3, density
0188   double N2_RadLen = 37.99; // g/cm2, radiation length
0189   double N2_x0 = 1.7378; // 1st Bethe-Bloch pole
0190   double N2_x1 = 4.1323; //2nd Bethe-Bloch pole
0191   double N2_mI = 82; //eV, mean excitation
0192   double N2_mZA = 0.4998; // Mean atomic number / mass number
0193   double N2_mA = 14.007; // Mean amass number
0194 
0195   double isobutane_frac = 0.05;
0196   double isobutane_Rho = 2.59e-3; // g/cm3, density
0197   double isobutane_RadLen = 45.23; // g/cm2, radiation length
0198   double isobutane_x0 = 1.3788; // 1st Bethe-Bloch pole
0199   double isobutane_x1 = 3.7524; //2nd Bethe-Bloch pole
0200   double isobutane_mI = 48.3; //eV, mean excitation
0201   double isobutane_mZA = 0.595; // Mean atomic number / mass number
0202   double isobutane_mA = 57.146; // Mean amass number
0203 };
0204 
0205 inline void GPUTPCTrackParam::InitParam()
0206 {
0207   // Initialize Tracklet Parameters using default values
0208   SetSinPhi(0);
0209   SetDzDs(0);
0210   SetQPt(0);
0211   SetSignCosPhi(1);
0212   SetChi2(0);
0213   SetNDF(-3);
0214   SetCov(0, 1);
0215   SetCov(1, 0);
0216   SetCov(2, 1);
0217   SetCov(3, 0);
0218   SetCov(4, 0);
0219   SetCov(5, 1);
0220   SetCov(6, 0);
0221   SetCov(7, 0);
0222   SetCov(8, 0);
0223   SetCov(9, 1);
0224   SetCov(10, 0);
0225   SetCov(11, 0);
0226   SetCov(12, 0);
0227   SetCov(13, 0);
0228   SetCov(14, 1000.f);
0229   SetZOffset(0);
0230 }
0231 
0232 #endif // GPUTPCTRACKPARAM_H