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