- Timestamp:
- Mar 2, 2021, 3:38:05 PM (4 years ago)
- Branches:
- master
- Children:
- 4586f8f
- Parents:
- d3165fa (diff), 92b8d11 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - git-author:
- Michele Selvaggi <michele.selvaggi@…> (03/02/21 15:38:05)
- git-committer:
- GitHub <noreply@…> (03/02/21 15:38:05)
- Location:
- external/TrackCovariance
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
external/TrackCovariance/TrkUtil.cc
rd3165fa ra1a25d4 1 1 #include "TrkUtil.h" 2 #include <iostream> 2 3 3 4 // Constructor … … 31 32 Double_t cross = x(0) * p(1) - x(1) * p(0); 32 33 Double_t T = sqrt(pt * pt - 2 * a * cross + a * a * r2); 33 Double_t phi0 = TMath::ATan2((p(1) - a * x(0)) / T, (p(0) + a * x(1)) / T); // Phi034 Double_t phi0 = atan2((p(1) - a * x(0)) / T, (p(0) + a * x(1)) / T); // Phi0 34 35 Double_t D; // Impact parameter D 35 36 if (pt < 10.0) D = (T - pt) / a; … … 41 42 //Longitudinal parameters 42 43 Double_t B = C * sqrt(TMath::Max(r2 - D * D, 0.0) / (1 + 2 * C * D)); 43 Double_t st = TMath::ASin(B) / C;44 Double_t st = asin(B) / C; 44 45 Double_t ct = p(2) / pt; 45 46 Double_t z0 = x(2) - ct * st; … … 68 69 // 69 70 TVector3 Xval; 70 Xval(0) = -D * TMath::Sin(phi0);71 Xval(1) = D * TMath::Cos(phi0);71 Xval(0) = -D * sin(phi0); 72 Xval(1) = D * cos(phi0); 72 73 Xval(2) = z0; 73 74 // … … 76 77 // 77 78 TVector3 TrkUtil::ParToP(TVectorD Par) 79 { 80 if (fBz == 0.0) 81 std::cout << "TrkUtil::ParToP: Warning Bz not set" << std::endl; 82 // 83 return ParToP(Par,fBz); 84 } 85 // 86 TVector3 TrkUtil::ParToP(TVectorD Par, Double_t Bz) 78 87 { 79 88 Double_t C = Par(2); … … 82 91 // 83 92 TVector3 Pval; 84 Double_t pt = fBz * cSpeed() / TMath::Abs(2 * C);85 Pval(0) = pt * TMath::Cos(phi0);86 Pval(1) = pt * TMath::Sin(phi0);93 Double_t pt = Bz * cSpeed() / TMath::Abs(2 * C); 94 Pval(0) = pt * cos(phi0); 95 Pval(1) = pt * sin(phi0); 87 96 Pval(2) = pt * ct; 88 97 // … … 103 112 Double_t b = -cSpeed() * fBz / 2.; 104 113 pACTS(0) = 1000 * Par(0); // D from m to mm 105 pACTS(1) = 1000 * Par(3); // z0 from m to mm114 pACTS(1) = 1000 * Par(3); // z0 from m to mm 106 115 pACTS(2) = Par(1); // Phi0 is unchanged 107 pACTS(3) = TMath::ATan2(1.0, Par(4)); // Theta in [0, pi] range116 pACTS(3) = atan2(1.0, Par(4)); // Theta in [0, pi] range 108 117 pACTS(4) = Par(2) / (b * sqrt(1 + Par(4) * Par(4))); // q/p in GeV 109 118 pACTS(5) = 0.0; // Time: currently undefined -
external/TrackCovariance/TrkUtil.h
rd3165fa ra1a25d4 20 20 void SetBfield(Double_t Bz) { fBz = Bz; } 21 21 TVectorD XPtoPar(TVector3 x, TVector3 p, Double_t Q); 22 TVector3 ParToX(TVectorD Par);23 22 TVector3 ParToP(TVectorD Par); 24 Double_t ParToQ(TVectorD Par);25 23 // 26 24 // Conversion to ACTS parametrization … … 46 44 static Double_t cSpeed() 47 45 { 48 return TMath::C()*1.0e-9; // Reduced speed of light 46 Double_t c = 2.99792458e8; // speed of light m/sec 47 //return TMath::C()*1.0e-9; // Incompatible with root5 48 return c*1.0e-9; // Reduced speed of light 49 49 } 50 50 // … … 52 52 // 53 53 static TVectorD XPtoPar(TVector3 x, TVector3 p, Double_t Q, Double_t Bz); 54 static TVector3 ParToX(TVectorD Par); // position of minimum distance from z axis 55 static TVector3 ParToP(TVectorD Par, Double_t Bz); // Get Momentum from track parameters 56 static Double_t ParToQ(TVectorD Par); // Get track charge 54 57 // 55 58 // Conversion from meters to mm
Note:
See TracChangeset
for help on using the changeset viewer.