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