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