]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RICH/AliRICHHelix.h
Remove De-digitizing of raw data and digitizing the raw data fit
[u/mrichter/AliRoot.git] / RICH / AliRICHHelix.h
CommitLineData
998b831f 1#ifndef AliRICHHelix_h
2#define AliRICHHelix_h
3
4#include <TObject.h>
5#include <TVector3.h>
6#include "AliRICHParam.h"
7#include "AliRICHChamber.h"
8
9class AliRICHHelix: public TObject
10{
11public:
d3eb6079 12 AliRICHHelix():TObject() {;}
13 AliRICHHelix(const TVector3 &x0,const TVector3 &p0,Int_t q=1,Double_t b=0.2):TObject(),fX0(x0),fP0(p0),fX(x0),fP(p0),
14 fLen(0),fQ(q),fBz(b) {;}
15 virtual ~AliRICHHelix() {;}
16
17 inline void Propagate(Double_t len); //propogate helix by length len along it
18 inline Int_t RichIntersect(AliRICHParam *pParam); //search intersection with any RICH chamber
19 inline Bool_t Intersection(TVector3 planePnt,TVector3 planeNorm); //intersection with plane given by point and normal vector
20 Bool_t Intersection(TVector3 pl) {return Intersection(pl,pl.Unit());} // special plane given by point only
21 TVector2 PosRad() const{return fPosRad;} //returns position of intersection with radiator (local system)
22 TVector2 PosAnod() const{return fPosAnod;} //returns position of intersection with anod wires plane (local system)
23 TVector2 PosPc() const{return fPosPc;} //returns position of intersection with PC (local system)
24 TVector3 Ploc() const{return fPloc;} //returns momentum at the position of intersection with radiator
fab9e039 25 Double_t Length() const{return fLen;} //returns length of the track from initial point to RICH
d3eb6079 26 void Print(Option_t *sOption)const; //virtual interface from TObject
998b831f 27protected:
28 TVector3 fX0; //helix position in parametrised point, cm in MRS
29 TVector3 fP0; //helix momentum in parametrised point, GeV/c in MRS
30 TVector3 fX; //helix position in point of interest, cm in MRS
31 TVector3 fP; //helix momentum in point of interest, GeV/c in MRS
d3eb6079 32 Double_t fLen; //helix length in point of interest
998b831f 33 Int_t fQ; //sign of track charge (value not provided by current ESD)
34 Double_t fBz; //magnetic field along z value in Tesla under assumption of uniformity
d3eb6079 35 TVector2 fPosRad; //track intersection with radiator (local system)
36 TVector2 fPosAnod; //track intersection with anod wires plane (local system)
37 TVector2 fPosPc; //track intersection with PC (local system)
998b831f 38 TVector3 fPloc; //momentum in local system
39 ClassDef(AliRICHHelix,0) //General helix
40};//class AliRICHHelix
41//__________________________________________________________________________________________________
d3eb6079 42void AliRICHHelix::Propagate(Double_t len)
998b831f 43{
44// Propogates the helix to the position of interest defined by helix length s
45// Assumes uniform magnetic field along z direction.
46 const Double_t c = 0.00299792458;//this value provides that coordinates are in cm momentum in GeV/c
47 Double_t a = -c*fBz*fQ;
48
49 Double_t rho = a/fP0.Mag();
d3eb6079 50 fX.SetX( fX0.X()+fP0.X()*TMath::Sin(rho*len)/a-fP0.Y()*(1-TMath::Cos(rho*len))/a );
51 fX.SetY( fX0.Y()+fP0.Y()*TMath::Sin(rho*len)/a+fP0.X()*(1-TMath::Cos(rho*len))/a );
52 fX.SetZ( fX0.Z()+fP0.Z()*len/fP0.Mag() );
53 fP.SetX( fP0.X()*TMath::Cos(rho*len)-fP0.Y()*TMath::Sin(rho*len) );
54 fP.SetY( fP0.Y()*TMath::Cos(rho*len)+fP0.X()*TMath::Sin(rho*len) );
55 fP.SetZ( fP0.Z() );
56 fLen=len;
998b831f 57}
58//__________________________________________________________________________________________________
59Bool_t AliRICHHelix::Intersection(TVector3 planePoint,TVector3 planeNorm)
60{
61// Finds point of intersection (if exists) of the helix to the plane given by point and normal vector.
62// Returns kTrue if helix intersects the plane, kFALSE otherwise.
63// Stores result in current helix fields fX and fP.
64
d3eb6079 65 Double_t s=(planePoint-fX0)*planeNorm,dist=99999,distPrev=dist;//estimates initial distance to plane
998b831f 66
d3eb6079 67 while(TMath::Abs(dist)>0.00001){
998b831f 68 Propagate(s); //calculates helix at the distance s from x0 ALONG the helix
69 dist=(fX-planePoint)*planeNorm; //distance between current helix position and plane
e84e7c82 70 if(TMath::Abs(dist) >= TMath::Abs(distPrev)) { return kFALSE;}
998b831f 71 distPrev=dist;
72 s-=dist;
73 }
74 return kTRUE;
75}
76//__________________________________________________________________________________________________
77Int_t AliRICHHelix::RichIntersect(AliRICHParam *pParam)
78{
79// Searchs for intersection of this helix with all RICH chambers, returns chamber number or 0 if no intersection
80// On exit fPosRad contain position of intersection in Local System with radiator
81// fPosPc contains the same for photocathode
82 for(Int_t iChamberN=1;iChamberN<=kNchambers;iChamberN++){//chamber loop
83 if(Intersection(pParam->C(iChamberN)->Rad())){//there is intersection with radiator plane
84 fPosRad=pParam->C(iChamberN)->Mrs2Rad(fX);//position on radiator plane
85 if(pParam->IsAccepted(fPosRad)){//intersection within radiator (even if in dead zone)
d3eb6079 86
998b831f 87 if(Intersection(pParam->C(iChamberN)->Pc())){//there is intersection with photocathode
88 fPosPc=pParam->C(iChamberN)->Mrs2Pc(fX);//position on photcathode plane
89 if(pParam->IsAccepted(fPosPc)){//intersection within pc (even if in dead zone)
d3eb6079 90
91 Intersection(pParam->C(iChamberN)->Anod()); //search for anod intersection position
92 fPosAnod=pParam->C(iChamberN)->Mrs2Anod(fX);
93
94 fPloc=pParam->C(iChamberN)->PMrs2Loc(fP);//trasform p to local system
998b831f 95 return iChamberN;
96 }//if inside PC
d3eb6079 97 }//if intersects PC
98
998b831f 99 }//if inside radiator
100 }//if for radiator
101 }//chamber loop
102 return 0;
103}
104//__________________________________________________________________________________________________
105#endif