FairRoot/PandaRoot
PndLinTrack.cxx
Go to the documentation of this file.
1 // -------------------------------------------------------------------------
2 // ----- PndLinTrack source file -----
3 // ----- -----
4 // -------------------------------------------------------------------------
5 
6 #include "PndLinTrack.h"
7 #include <cmath>
8 #include <iostream>
9 #include "TGeoManager.h"
10 #include "TGeoMatrix.h"
11 #include "TGeoNode.h"
12 #include "TGeoVolume.h"
13 #include "TMath.h"
14 #include "stdlib.h"
15 
16 // ----- Default constructor -------------------------------------------
18  // std::cout<<"/lmd/LmdTrack/PndLinTrack()"<<std::endl;
19  // fCovMatrix = new TMatrixDSym(6);
20 }
21 // -------------------------------------------------------------------------
22 
23 // ----- Standard constructor ------------------------------------------
25  Double_t p3, Double_t p4, Double_t p5, Double_t chi,
26  Int_t first, Int_t last, Int_t cand) {
27  fDetName = detName;
28  fP0 = p0;
29  fP1 = p1;
30  fP2 = p2;
31  fP3 = p3;
32  fP4 = p4;
33  fP5 = p5;
34  fChiSq = chi;
35  fFirst = first;
36  fLast = last;
37  fCandId = cand;
38  // fP0err = p0err; fP1err = p1err; fP2err = p2err; fP3err = p3err;
39  // fz0 = z0;
40  // fCovMatrix = NULL;
41  fCovMatrix.ResizeTo(6, 6);
42  // fCovMatrix = TMatrixDSym(6);
43 }
44 
45 // TVector3 PndLinTrack::GetStartVec(){
46 // return TVector3(fP0,fP2,fP4);
47 // // return TVector3(fP0,fP2,fP4-0.0075);//go out middle of the plane
48 // }
49 
50 // TVector3 PndLinTrack::GetDirectionVec(){
51 // // double l = 1./sqrt(1+fP1*fP1+fP3*fP3);
52 // // double l = 1./sqrt(fP1*fP1+fP3*fP3+fP5*fP5);
53 // // return TVector3(fP1*l,fP3*l,fP5*l);
54 // // double l = sqrt(1-fP1*fP1-fP3*fP3);
55 // // double l = sqrt(1-hypot(fP1,fP3));
56 // // std::cout<<"fP1 = "<<fP1<<" fP3 = "<<fP3<<" l = "<<l<<std::endl;
57 // // TVector3 res = TVector3(fP1,fP3,l);
58 // TVector3 res = TVector3(fP1,fP3,fP5);
59 // // res *= 1./res.Mag();
60 // return res;
61 // }
62 
64  return TVector3(TMath::Sqrt((fCovMatrix)(0, 0)),
65  TMath::Sqrt((fCovMatrix)(2, 2)),
66  TMath::Sqrt((fCovMatrix)(4, 4)));
67 }
68 
70  // double err_dx = sqrt((fCovMatrix)(1,1));
71  // double err_dy = sqrt((fCovMatrix)(3,3));
72  // double l = sqrt(1-fP1*fP1-fP3*fP3);
73  // double err_dz = sqrt(pow(fP1/l,2)*((fCovMatrix)(1,1))+
74  // pow(fP3/l,2)*((fCovMatrix)(3,3))
75  // +2*fP1*fP3/(l*l)*((fCovMatrix)(1,3)));
76  // return TVector3(err_dx,err_dy,err_dz);
77  // double l = 1./sqrt(1+fP1*fP1+fP3*fP3);
78  // // std::cout<<"l = "<<l<<" pow(l,3) = "<<pow(l,3)<<" p1="<<fP1<<"
79  // p3="<<fP3<<std::endl;
80  // double ddx_dp1=(1+fP3*fP3);
81  // double ddx_dp3=fP1*fP3;
82  // double err_dx =
83  // pow(l,3)*sqrt(ddx_dp1*ddx_dp1*((fCovMatrix)(1,1))+ddx_dp3*ddx_dp3*((fCovMatrix)(3,3))
84  // +(2*ddx_dp1*ddx_dp3*((fCovMatrix)(1,3))));
85  // std::cout<<"err_dx = "<<ddx_dp1*ddx_dp1*((fCovMatrix)(1,1))<<" +
86  // "<<ddx_dp3*ddx_dp3*((fCovMatrix)(3,3))
87  // <<" + "<<2*ddx_dp1*ddx_dp3*((fCovMatrix)(1,3))<<" =
88  // "<<err_dx<<std::endl;
89 
90  // double ddy_dp1=fP1*fP3;
91  // double ddy_dp3=(1+fP1*fP1);
92  // double err_dy =
93  // pow(l,3)*sqrt(ddy_dp1*ddy_dp1*((fCovMatrix)(1,1))+ddy_dp3*ddy_dp3*((fCovMatrix)(3,3))
94  // +(2*ddy_dp1*ddy_dp3*fabs((fCovMatrix)(1,3))));
95 
96  // double ddz_dp1=fP1;
97  // double ddz_dp3=fP3;
98  // double err_dz
99  // =pow(l,3)*sqrt(ddz_dp1*ddz_dp1*((fCovMatrix)(1,1))+ddz_dp3*ddz_dp3*((fCovMatrix)(3,3))
100  // +(2*ddz_dp1*ddz_dp3*fabs((fCovMatrix)(1,3))));
101  // return TVector3(err_dx,err_dy,err_dz);
102 
103  // double l = pow(fP1*fP1+fP3*fP3+fP5*fP5,-0.5);
104  // double l3 = pow(l,3);
105  // double p12 = pow(fP1,2);
106  // double p32 = pow(fP3,2);
107  // double p52 = pow(fP5,2);
108  // double p1p3 = fP1*fP3;
109  // double p1p5 = fP1*fP5;
110  // double p3p5 = fP3*fP5;
111 
112  // double err_dx =
113  // sqrt(pow((l-p12*l3),2)*((fCovMatrix)(1,1))+pow((p1p3*l3),2)*((fCovMatrix)(3,3))+pow((p1p5*l3),2)*((fCovMatrix)(5,5))+2*((l-p12*l3)*(-fP1*fP3*l3)*((fCovMatrix)(1,3))+(l-p12*l3)*(-fP1*fP5*l3)*((fCovMatrix)(1,5))+p12*fP3*fP5*l3*l3*((fCovMatrix)(3,5))));
114  // double err_dy =
115  // sqrt(pow((l-p32*l3),2)*((fCovMatrix)(3,3))+pow((p1p3*l3),2)*((fCovMatrix)(1,1))+pow((p3p5*l3),2)*((fCovMatrix)(5,5))+2*((l-p32*l3)*(-fP1*fP3*l3)*((fCovMatrix)(1,3))+(l-p32*l3)*(-fP3*fP5*l3)*((fCovMatrix)(3,5))+p32*fP1*fP5*l3*l3*((fCovMatrix)(1,5))));
116  // double err_dz =
117  // sqrt(pow((l-p52*l3),2)*((fCovMatrix)(5,5))+pow((p3p5*l3),2)*((fCovMatrix)(3,3))+pow((p1p5*l3),2)*((fCovMatrix)(1,1))+2*((l-p52*l3)*(-fP1*fP5*l3)*((fCovMatrix)(1,5))+(l-p52*l3)*(-fP3*fP5*l3)*((fCovMatrix)(3,5))+p52*fP1*fP3*l3*l3*((fCovMatrix)(1,3))));
118  // return TVector3(err_dx,err_dy,err_dz);
119  return TVector3(TMath::Sqrt((fCovMatrix)(1, 1)),
120  TMath::Sqrt((fCovMatrix)(3, 3)),
121  TMath::Sqrt((fCovMatrix)(5, 5)));
122 }
123 
125  errpar[0] = TMath::Sqrt((fCovMatrix)(0, 0));
126  errpar[1] = TMath::Sqrt((fCovMatrix)(1, 1));
127  errpar[2] = TMath::Sqrt((fCovMatrix)(2, 2));
128  errpar[3] = TMath::Sqrt((fCovMatrix)(3, 3));
129  errpar[4] = TMath::Sqrt((fCovMatrix)(4, 4));
130  errpar[5] = TMath::Sqrt((fCovMatrix)(5, 5));
131 }
132 
133 // ----- Destructor ----------------------------------------------------
135 
136 // -------------------------------------------------------------------------
Int_t fFirst
Definition: PndLinTrack.h:96
Double_t fP1
Definition: PndLinTrack.h:91
static T Sqrt(const T &x)
Definition: PndCAMath.h:37
TString fDetName
Definition: PndLinTrack.h:89
ClassImp(PndLinTrack)
Int_t fCandId
Definition: PndLinTrack.h:97
void GetParErr(Double_t *errpar)
Double_t fP2
Definition: PndLinTrack.h:91
Double_t fP0
Definition: PndLinTrack.h:91
Int_t fLast
Definition: PndLinTrack.h:96
Double_t fP3
Definition: PndLinTrack.h:91
TMatrixDSym fCovMatrix
Definition: PndLinTrack.h:93
Double_t
Double_t fP5
Definition: PndLinTrack.h:91
virtual ~PndLinTrack()
Double_t fChiSq
Definition: PndLinTrack.h:95
TPad * p2
Definition: hist-t7.C:117
TPad * p1
Definition: hist-t7.C:116
Double_t fP4
Definition: PndLinTrack.h:91
TVector3 GetStartErrVec()
Definition: PndLinTrack.cxx:63
TVector3 GetDirectionErrVec()
Definition: PndLinTrack.cxx:69