]>
Commit | Line | Data |
---|---|---|
998b831f | 1 | #ifndef AliRICHHelix_h |
2 | #define AliRICHHelix_h | |
3 | ||
db910db9 | 4 | #include <TObject.h> //base class |
5 | #include <TVector3.h> //used extensively | |
998b831f | 6 | |
7 | class AliRICHHelix: public TObject | |
8 | { | |
9 | public: | |
e30ca504 | 10 | AliRICHHelix( ):TObject(),fX0(TVector3(0,0,0)),fP0(TVector3(0,0,0)),fQ(0),fBz(0 ) {} |
11 | AliRICHHelix(const TVector3 &x0,const TVector3 &p0,Int_t q=1,Double_t b=2):TObject(),fX0(x0 ),fP0(p0 ),fQ(q),fBz(b ) {} | |
12 | AliRICHHelix(Double_t p,Double_t theta,Double_t phi,Double_t bz=2 ):TObject(),fX0(TVector3(0,0,0)),fP0(TVector3(0,0,0)),fQ(0),fBz(bz) | |
13 | {fP0.SetMagThetaPhi(p,theta*TMath::DegToRad(),phi*TMath::DegToRad());} //p [GeV], theta,phi [deg], Bz [Tesla]; | |
db910db9 | 14 | virtual ~AliRICHHelix() {} |
d3eb6079 | 15 | |
db910db9 | 16 | void Draw (const Option_t *opt="" ); //from TObject, draw helix |
e30ca504 | 17 | void Print (const Option_t *opt="" )const; //from TObject, print status |
db910db9 | 18 | //private part++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
e30ca504 | 19 | inline Bool_t Intersect( TVector3 &pnt,TVector3 &norm ); //intersection with plane given by point and normal vector |
20 | inline void Propagate(Float_t len,TVector3 &x, TVector3 &p ); //propogate helix by given length along it | |
998b831f | 21 | protected: |
db910db9 | 22 | TVector3 fX0; //helix position in point of definition, [cm] in MARS |
23 | TVector3 fP0; //helix momentum in point of definition, [GeV/c] in MARS | |
e30ca504 | 24 | Int_t fQ; //sign of track charge |
25 | Float_t fBz; //magnetic field along z, [kGaus] | |
998b831f | 26 | ClassDef(AliRICHHelix,0) //General helix |
27 | };//class AliRICHHelix | |
db910db9 | 28 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
e30ca504 | 29 | void AliRICHHelix::Propagate(Float_t len,TVector3 &x,TVector3 &p) |
998b831f | 30 | { |
db910db9 | 31 | // Propogates the helix from inintial point by a given distance along helix. Assumes uniform magnetic field along z direction. |
32 | // Arguments: len - distance to propagate by, [cm] | |
33 | // Returns: none | |
34 | if(fBz==0){//no magnetic field->straight line | |
e30ca504 | 35 | x=fX0+fP0.Unit()*len; |
36 | p=fP0; | |
db910db9 | 37 | }else{ |
e30ca504 | 38 | const Float_t c = 0.000299792458;//this speed of light value provides that coordinates are in [cm] momentum in [GeV/c] field in [kGaus] |
39 | Float_t a = -c*fBz*fQ; | |
40 | Float_t rho = a/fP0.Mag(); | |
41 | x.SetX( fX0.X()+fP0.X()*TMath::Sin(rho*len)/a-fP0.Y()*(1-TMath::Cos(rho*len))/a ); | |
42 | x.SetY( fX0.Y()+fP0.Y()*TMath::Sin(rho*len)/a+fP0.X()*(1-TMath::Cos(rho*len))/a ); | |
43 | x.SetZ( fX0.Z()+fP0.Z()*len/fP0.Mag() ); | |
44 | x.SetX( fP0.X()*TMath::Cos(rho*len)-fP0.Y()*TMath::Sin(rho*len) ); | |
45 | p.SetY( fP0.Y()*TMath::Cos(rho*len)+fP0.X()*TMath::Sin(rho*len) ); | |
46 | p.SetZ( fP0.Z() ); | |
db910db9 | 47 | } |
e30ca504 | 48 | }//Propagate() |
db910db9 | 49 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
e30ca504 | 50 | Bool_t AliRICHHelix::Intersect(TVector3 &pnt,TVector3 &norm) |
998b831f | 51 | { |
db910db9 | 52 | // Finds point of intersection (if exists) of the helix with the plane. Stores result in fX and fP. |
e30ca504 | 53 | // Arguments: pnt - arbitrary point of the plane, [cm] in MARS |
54 | // norm - vector, normal to the plane, [cm] in MARS | |
55 | // Returns: - kTrue if helix intersects the plane, kFALSE otherwise. | |
56 | // - pnt contains the point of intersection, [cm] in MARS | |
57 | TVector3 x,p; //current helix position and momentum | |
58 | Double_t s=(pnt-fX0)*norm,dist=99999,distPrev=dist; //estimates initial distance to plane | |
59 | while(TMath::Abs(dist)>0.00001){ //loop while the distance is less then precision | |
60 | Propagate(s,x,p); //calculates helix at the distance s from x0 ALONG the helix | |
61 | dist=(x-pnt)*norm; //distance between current helix position and plane | |
62 | if(TMath::Abs(dist) >= TMath::Abs(distPrev)) { return kFALSE;} //if distance increases then no intersection | |
998b831f | 63 | distPrev=dist; |
64 | s-=dist; | |
e30ca504 | 65 | } |
66 | norm=p; | |
67 | pnt=x; | |
998b831f | 68 | return kTRUE; |
e30ca504 | 69 | }//Intersect() |
db910db9 | 70 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
998b831f | 71 | #endif |