[a617744] | 1 | //
|
---|
| 2 | #ifndef G__TRKUTIL_H
|
---|
| 3 | #define G__TRKUTIL_H
|
---|
| 4 | //
|
---|
| 5 | #include <TVector3.h>
|
---|
| 6 | #include <TVectorD.h>
|
---|
| 7 | #include <TMatrixDSym.h>
|
---|
[82db145] | 8 | #include <TRandom.h>
|
---|
[a617744] | 9 | //
|
---|
| 10 | //
|
---|
| 11 | // Class test
|
---|
| 12 |
|
---|
| 13 | class TrkUtil {
|
---|
| 14 | //
|
---|
| 15 | //
|
---|
| 16 | protected:
|
---|
| 17 | Double_t fBz; // Solenoid magnetic field
|
---|
| 18 | //
|
---|
[82db145] | 19 | Int_t fGasSel; // Gas selection: 0: He-Iso, 1: He, 2:Ar-Eth, 3: Ar
|
---|
| 20 | Double_t fRmin; // Lower DCH radius
|
---|
| 21 | Double_t fRmax; // Higher DCH radius
|
---|
| 22 | Double_t fZmin; // Lower DCH z
|
---|
| 23 | Double_t fZmax; // Higher DCH z
|
---|
| 24 | //
|
---|
[a617744] | 25 | // Service routines
|
---|
| 26 | //
|
---|
[65776c0] | 27 | void SetB(Double_t Bz) { fBz = Bz; }
|
---|
[a617744] | 28 | TVectorD XPtoPar(TVector3 x, TVector3 p, Double_t Q);
|
---|
| 29 | TVector3 ParToP(TVectorD Par);
|
---|
[ebf40fd] | 30 | TMatrixDSym RegInv(TMatrixDSym& Min);
|
---|
| 31 | //
|
---|
| 32 | // Track trajectory derivatives
|
---|
| 33 | TMatrixD derXdPar(TVectorD par, Double_t s); // derivatives of position wrt parameters
|
---|
| 34 | TVectorD derXds(TVectorD par, Double_t s); // derivatives of position wrt phase
|
---|
| 35 | TVectorD dsdPar_R(TVectorD par, Double_t R); // derivatives of phase at constant R
|
---|
| 36 | TVectorD dsdPar_z(TVectorD par, Double_t z); // derivatives of phase at constant z
|
---|
[a617744] | 37 | //
|
---|
| 38 | // Conversion to ACTS parametrization
|
---|
| 39 | //
|
---|
| 40 | TVectorD ParToACTS(TVectorD Par); // Parameter conversion
|
---|
| 41 | TMatrixDSym CovToACTS(TVectorD Par, TMatrixDSym Cov); // Covariance conversion
|
---|
| 42 | //
|
---|
| 43 | // Conversion to ILC parametrization
|
---|
| 44 | //
|
---|
| 45 | TVectorD ParToILC(TVectorD Par); // Parameter conversion
|
---|
| 46 | TMatrixDSym CovToILC(TMatrixDSym Cov); // Covariance conversion
|
---|
[82db145] | 47 | //
|
---|
[a617744] | 48 |
|
---|
| 49 | public:
|
---|
| 50 | //
|
---|
| 51 | // Constructors
|
---|
| 52 | TrkUtil();
|
---|
| 53 | TrkUtil(Double_t Bz);
|
---|
| 54 | // Destructor
|
---|
| 55 | ~TrkUtil();
|
---|
| 56 | //
|
---|
| 57 | // Overload methods to allow call without instantiating class
|
---|
| 58 | //
|
---|
| 59 | static Double_t cSpeed()
|
---|
| 60 | {
|
---|
[df408d2] | 61 | Double_t c = 2.99792458e8; // speed of light m/sec
|
---|
| 62 | //return TMath::C()*1.0e-9; // Incompatible with root5
|
---|
[ebf40fd] | 63 | return c*1.0e-9; // Reduced speed of light
|
---|
[a617744] | 64 | }
|
---|
| 65 | //
|
---|
| 66 | // Service routines
|
---|
| 67 | //
|
---|
| 68 | static TVectorD XPtoPar(TVector3 x, TVector3 p, Double_t Q, Double_t Bz);
|
---|
[df408d2] | 69 | static TVector3 ParToX(TVectorD Par); // position of minimum distance from z axis
|
---|
| 70 | static TVector3 ParToP(TVectorD Par, Double_t Bz); // Get Momentum from track parameters
|
---|
| 71 | static Double_t ParToQ(TVectorD Par); // Get track charge
|
---|
[ebf40fd] | 72 | static void LineDistance(TVector3 x0, TVector3 y0, TVector3 dirx, TVector3 diry, Double_t &sx, Double_t &sy, Double_t &distance);
|
---|
| 73 | //
|
---|
| 74 | // Track trajectory
|
---|
| 75 | //
|
---|
| 76 | static TVector3 Xtrack(TVectorD par, Double_t s); // Parametric track trajectory
|
---|
| 77 | TVectorD derRphi_R(TVectorD par, Double_t R); // Derivatives of R-phi at constant R
|
---|
| 78 | TVectorD derZ_R(TVectorD par, Double_t R); // Derivatives of z at constant R
|
---|
| 79 | TVectorD derRphi_Z(TVectorD par, Double_t z); // Derivatives of R-phi at constant z
|
---|
| 80 | TVectorD derR_Z(TVectorD par, Double_t z); // Derivatives of R at constant z
|
---|
| 81 | //
|
---|
| 82 | // Smear with given covariance matrix
|
---|
| 83 | //
|
---|
| 84 | static TVectorD CovSmear(TVectorD x, TMatrixDSym C);
|
---|
[a617744] | 85 | //
|
---|
| 86 | // Conversion from meters to mm
|
---|
| 87 | //
|
---|
| 88 | static TVectorD ParToMm(TVectorD Par); // Parameter conversion
|
---|
| 89 | static TMatrixDSym CovToMm(TMatrixDSym Cov); // Covariance conversion
|
---|
[82db145] | 90 | //
|
---|
[ebf40fd] | 91 | // Inside cylindrical volume
|
---|
| 92 | //
|
---|
| 93 | static Bool_t IsInside(TVector3 x, Double_t Rout, Double_t Zmin, Double_t Zmax)
|
---|
| 94 | {
|
---|
| 95 | Bool_t Is = kFALSE;
|
---|
| 96 | if (x.Pt() <= Rout && x.z() >= Zmin && x.z() <= Zmax)Is = kTRUE;
|
---|
| 97 | return Is;
|
---|
| 98 | }
|
---|
| 99 | //
|
---|
[82db145] | 100 | // Cluster counting in gas
|
---|
| 101 | //
|
---|
[65776c0] | 102 | void SetBfield(Double_t Bz) { fBz = Bz; }
|
---|
| 103 | // Define gas volume (units = meters)
|
---|
[82db145] | 104 | void SetDchBoundaries(Double_t Rmin, Double_t Rmax, Double_t Zmin, Double_t Zmax);
|
---|
| 105 | // Gas mixture selection
|
---|
| 106 | void SetGasMix(Int_t Opt);
|
---|
| 107 | // Get number of ionization clusters
|
---|
| 108 | Bool_t IonClusters(Double_t &Ncl, Double_t mass, TVectorD Par);
|
---|
| 109 | Double_t Nclusters(Double_t bgam); // mean clusters/meter vs beta*gamma
|
---|
| 110 | static Double_t Nclusters(Double_t bgam, Int_t Opt); // mean clusters/meter vs beta*gamma
|
---|
| 111 | Double_t funcNcl(Double_t *xp, Double_t *par);
|
---|
| 112 | Double_t TrkLen(TVectorD Par); // Track length inside chamber
|
---|
[a617744] | 113 | };
|
---|
| 114 |
|
---|
| 115 | #endif
|
---|