]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/src/AliL3ConfMapPoint.cxx
Added two pass tracking for confmapper.
[u/mrichter/AliRoot.git] / HLT / src / AliL3ConfMapPoint.cxx
1 // @(#) $Id$
2
3 // Author: Anders Vestbo <mailto:vestbo$fi.uib.no>
4 //*-- Copyright &copy ALICE HLT Group
5
6 #include "AliL3StandardIncludes.h"
7
8 #include "AliL3Logging.h"
9 #include "AliL3ConfMapPoint.h"
10 #include "AliL3SpacePointData.h"
11 #include "AliL3Vertex.h"
12 #include "AliL3ConfMapTrack.h"
13
14 /**
15 <pre>
16 //_____________________________________________________________
17 // AliL3ConfMapPoint
18 //
19 // Hit class for conformal mapper
20 </pre
21 */
22
23 ClassImp(AliL3ConfMapPoint)
24
25 Bool_t AliL3ConfMapPoint::fDontMap=kFALSE;
26
27 AliL3ConfMapPoint::AliL3ConfMapPoint()
28 {
29   //Constructor
30   
31   SetUsage(false);
32   SetHitNumber(-1);
33   SetX(0);
34   SetY(0);
35   SetZ(0);
36   SetXerr(0);
37   SetYerr(0);
38   SetZerr(0);
39
40   SetPhi(0.);
41   SetEta(0.);
42   
43   SetXprime(0.);
44   SetYprime(0.);
45   SetXprimeerr(0.);
46   SetYprimeerr(0.);
47   SetIntPoint(0., 0., 0., 0., 0., 0.);
48   SetShiftedCoord();
49   SetMCTrackID(0,0,0);
50 }
51
52 AliL3ConfMapPoint::~AliL3ConfMapPoint()
53 {
54   // Destructor.
55   // Does nothing except destruct. 
56 }
57
58 Bool_t AliL3ConfMapPoint::ReadHits(AliL3SpacePointData* hits ){
59   
60   SetHitNumber(hits->fID);
61   SetPadRow(hits->fPadRow);
62   Int_t slice = (hits->fID>>25) & 0x7f;
63   SetSector(slice);
64   SetX(hits->fX);
65   SetY(hits->fY);
66   SetZ(hits->fZ);
67   SetXerr(sqrt(hits->fSigmaY2));
68   SetYerr(sqrt(hits->fSigmaY2));
69   SetZerr(sqrt(hits->fSigmaZ2));
70   return kTRUE;
71 }
72
73 void AliL3ConfMapPoint::Reset()
74 {
75   //Reset this point.
76   SetUsage(kFALSE);
77   SetS(0);
78   nextRowHit = 0;
79   nextVolumeHit=0;
80   nextTrackHit=0;
81 }
82
83 void AliL3ConfMapPoint::Setup(AliL3Vertex *vertex)
84 {
85   //Setup. Sets the vertex, conformal coordinates, and phi and eta of each hit.
86   
87   SetIntPoint(vertex->GetX(),    vertex->GetY(),    vertex->GetZ(),
88               vertex->GetXErr(), vertex->GetYErr(), vertex->GetZErr());
89   SetShiftedCoord();
90   SetConfCoord();
91   // The angles are set properly if they are set after the interaction point and the shifted coordinates
92   SetAngles();
93   //SetDist(0., 0.);
94   
95   return;
96 }
97
98 void AliL3ConfMapPoint::SetIntPoint(const Double_t in_x,const Double_t in_y,const Double_t in_z,
99                                     const Double_t in_x_err,const Double_t in_y_err,const Double_t in_z_err)
100 {
101   // Defines a new interaction point. This point is needed to calculate
102   // the conformal coordinates.
103
104   SetXt(in_x);
105   SetYt(in_y);
106   SetZt(in_z);
107   SetXterr(in_x_err);
108   SetYterr(in_y_err);
109   SetZterr(in_z_err);
110
111   return;
112 }
113
114 void AliL3ConfMapPoint::SetAllCoord(const AliL3ConfMapPoint *preceding_hit)
115 {
116   // Sets the interaction point, the shifted coordinates, and the conformal mapping coordinates.
117   // These values are calculated from the interaction point of the given cluster which should be a
118   // already found cluster on the same track.
119
120   if (this == preceding_hit) {
121     SetIntPoint(preceding_hit->GetX(),    preceding_hit->GetY(),    preceding_hit->GetZ(),
122                 preceding_hit->GetXerr(), preceding_hit->GetYerr(), preceding_hit->GetZerr());
123   }
124
125   else {
126     SetIntPoint(preceding_hit->GetXt(),    preceding_hit->GetYt(),    preceding_hit->GetZt(),
127                 preceding_hit->GetXterr(), preceding_hit->GetYterr(), preceding_hit->GetZterr());
128   }
129
130   SetShiftedCoord();
131   SetConfCoord();
132
133   return;
134 }
135
136 void AliL3ConfMapPoint::SetShiftedCoord()
137 {
138   // Sets the coordinates with resepct to the given vertex point
139
140   SetXv(GetX() - fXt);
141   SetYv(GetY() - fYt);
142   SetZv(GetZ() - fZt);
143   /*
144   SetXverr(TMath::Sqrt(GetXerr()*GetXerr() + fXterr*fXterr));
145   SetYverr(TMath::Sqrt(GetYerr()*GetYerr() + fYterr*fYterr));
146   SetZverr(TMath::Sqrt(GetZerr()*GetZerr() + fZterr*fZterr));
147   */
148   return;
149 }
150
151 void AliL3ConfMapPoint::SetConfCoord()
152 {
153   // Calculates the conformal coordinates of one cluster.
154   // If the option "vertex_constraint" applies the interaction point is
155   // assumed to be at (0, 0, 0). Otherwise the function will use the
156   // interaction point specified by fXt and fYt.
157
158   if(fDontMap){
159     fXprime = x;
160     fYprime = y;
161     fWxy = 0;
162     s = 0; //track trajectory
163     fWz = 0;
164     return;
165   }
166
167   Double_t r2;
168   Double_t xyErrorScale = 1;
169   Double_t szErrorScale = 1;
170
171   if ((r2 = fXv*fXv + fYv*fYv)) 
172     {
173       fXprime =  fXv / r2;
174       fYprime = -fYv / r2;
175       
176       //set weights:
177       fWxy = r2*r2 / ((xyErrorScale*xyErrorScale)*((xerr*xerr)+(yerr*yerr)));
178       s = 0; //track trajectory
179       fWz = (Double_t)(1./(szErrorScale*zerr*zerr));
180     } else {
181     fXprime    = 0.;
182     fYprime    = 0.;
183     fXprimeerr = 0.;
184     fYprimeerr = 0.;
185     fWxy = 0;
186     fWz = 0;
187     s = 0;
188   }
189
190   return;
191 }
192
193 void AliL3ConfMapPoint::SetAngles()
194 {
195   // Calculates the angle phi and the pseudorapidity eta for each cluster.
196   /*
197   Double_t r = TMath::Sqrt(x*x + y*y);
198
199   fPhi = TMath::ATan2(y,x);
200   if(fPhi<0) fPhi = fPhi + 2*TMath::Pi();
201   fEta = 3.*z/(TMath::Abs(z)+2.*r);
202   return;
203   */
204   //  Double_t r3dim = TMath::Sqrt(fXv*fXv + fYv*fYv + fZv*fZv);
205   Double_t r3dim = sqrt(fXv*fXv + fYv*fYv + fZv*fZv);
206   //Double_t r2dim = TMath::Sqrt(fXv*fXv + fYv*fYv);
207
208   /*if (r2dim == 0.) {
209   // If r2dim == 0 the pseudorapidity eta cannot be calculated (division by zero)!
210   // This can only happen if the point is lying on the z-axis and this should never be possible.
211     cerr << "The pseudorapidity eta cannot be calculated (division by zero)! Set to 1.e-10." << endl;
212     r2dim = 1.e-10;
213   }
214
215   if (fXv == 0.) {
216     fPhi = (fYv > 0.) ? TMath::Pi() / 2. : - TMath::Pi() / 2.;
217   }
218
219   else {
220     fPhi = (fXv > 0.) ? TMath::ASin(fYv/r2dim) : TMath::Pi() - TMath::ASin(fYv/r2dim);
221   }
222
223   if (fPhi < 0.) {
224     fPhi += 2. * TMath::Pi();
225   }
226   */
227   //fPhi = TMath::ATan2(y,x);
228   fPhi = atan2(y,x);
229   //if(fPhi<0) fPhi = fPhi + 2*TMath::Pi();
230   
231   //fEta = 0.5 * TMath::Log((r3dim + fZv)/(r3dim - fZv));
232   fEta = 0.5 * log((r3dim + fZv)/(r3dim - fZv));
233   return;
234 }
235 /*
236 AliL3ConfMapTrack *AliL3ConfMapPoint::GetTrack(TClonesArray *tracks) const
237 {
238   // Returns the pointer to the track to which this hit belongs.
239   
240   return (AliL3ConfMapTrack*)tracks->At(this->GetTrackNumber());
241 }
242 */