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