]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/src/AliHLTConfMapPoint.cxx
L3 becomes HLT
[u/mrichter/AliRoot.git] / HLT / src / AliHLTConfMapPoint.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
4aa41877 6#include "AliHLTStandardIncludes.h"
108615fc 7
4aa41877 8#include "AliHLTLogging.h"
9#include "AliHLTConfMapPoint.h"
10#include "AliHLTSpacePointData.h"
11#include "AliHLTVertex.h"
12#include "AliHLTConfMapTrack.h"
108615fc 13
3e87ef69 14/**
15<pre>
b661165c 16//_____________________________________________________________
4aa41877 17// AliHLTConfMapPoint
b661165c 18//
19// Hit class for conformal mapper
3e87ef69 20</pre
21*/
b661165c 22
4aa41877 23ClassImp(AliHLTConfMapPoint)
108615fc 24
4aa41877 25Bool_t AliHLTConfMapPoint::fgDontMap=kFALSE;
02f030e3 26
4aa41877 27AliHLTConfMapPoint::AliHLTConfMapPoint()
108615fc 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
4aa41877 52AliHLTConfMapPoint::~AliHLTConfMapPoint()
108615fc 53{
54 // Destructor.
b1ed0288 55 ;
108615fc 56}
57
4aa41877 58Bool_t AliHLTConfMapPoint::ReadHits(AliHLTSpacePointData* hits )
b1ed0288 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
4aa41877 74void AliHLTConfMapPoint::Reset()
355debe1 75{
76 //Reset this point.
77 SetUsage(kFALSE);
78 SetS(0);
47e75a3e 79 fNextRowHit = 0;
80 fNextVolumeHit=0;
81 fNextTrackHit=0;
355debe1 82}
83
4aa41877 84void AliHLTConfMapPoint::Setup(AliHLTVertex *vertex)
108615fc 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
4aa41877 100void AliHLTConfMapPoint::SetIntPoint(Double_t inx, Double_t iny, Double_t inz,
e33f3609 101 Double_t inxerr, Double_t inyerr, Double_t inzerr)
108615fc 102{
103 // Defines a new interaction point. This point is needed to calculate
104 // the conformal coordinates.
105
47e75a3e 106 SetXt(inx);
107 SetYt(iny);
108 SetZt(inz);
109 SetXterr(inxerr);
110 SetYterr(inyerr);
111 SetZterr(inzerr);
108615fc 112
113 return;
114}
115
4aa41877 116void AliHLTConfMapPoint::SetAllCoord(const AliHLTConfMapPoint *precedinghit)
108615fc 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
47e75a3e 122 if (this == precedinghit) {
123 SetIntPoint(precedinghit->GetX(), precedinghit->GetY(), precedinghit->GetZ(),
124 precedinghit->GetXerr(), precedinghit->GetYerr(), precedinghit->GetZerr());
108615fc 125 }
126
127 else {
47e75a3e 128 SetIntPoint(precedinghit->GetXt(), precedinghit->GetYt(), precedinghit->GetZt(),
129 precedinghit->GetXterr(), precedinghit->GetYterr(), precedinghit->GetZterr());
108615fc 130 }
131
132 SetShiftedCoord();
133 SetConfCoord();
134
135 return;
136}
137
4aa41877 138void AliHLTConfMapPoint::SetShiftedCoord()
108615fc 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
4aa41877 153void AliHLTConfMapPoint::SetConfCoord()
108615fc 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
4aa41877 195void AliHLTConfMapPoint::SetAngles()
108615fc 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/*
4aa41877 239AliHLTConfMapTrack *AliHLTConfMapPoint::GetTrack(TClonesArray *tracks) const
108615fc 240{
241 // Returns the pointer to the track to which this hit belongs.
242
4aa41877 243 return (AliHLTConfMapTrack*)tracks->At(this->GetTrackNumber());
108615fc 244}
245*/