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