1 // Author: Anders Vestbo <mailto:vestbo$fi.uib.no>
2 //*-- Copyright © ASV
6 #include "AliL3Logging.h"
8 #include "AliL3ConfMapPoint.h"
9 #include "AliL3SpacePointData.h"
10 #include "AliL3Vertex.h"
11 #include "AliL3ConfMapTrack.h"
13 //_____________________________________________________________
16 // Hit class for conformal mapper
18 ClassImp(AliL3ConfMapPoint)
20 AliL3ConfMapPoint::AliL3ConfMapPoint()
40 SetIntPoint(0., 0., 0., 0., 0., 0.);
45 AliL3ConfMapPoint::~AliL3ConfMapPoint()
48 // Does nothing except destruct.
51 Bool_t AliL3ConfMapPoint::ReadHits(AliL3SpacePointData* hits ){
53 SetHitNumber(hits->fID);
54 SetPadRow(hits->fPadRow);
55 Int_t slice = (hits->fID>>25) & 0x7f;
60 SetXerr(sqrt(hits->fXYErr));
61 SetYerr(sqrt(hits->fXYErr));
62 SetZerr(sqrt(hits->fZErr));
66 void AliL3ConfMapPoint::Reset()
76 void AliL3ConfMapPoint::Setup(AliL3Vertex *vertex)
78 //Setup. Sets the vertex, conformal coordinates, and phi and eta of each hit.
80 SetIntPoint(vertex->GetX(), vertex->GetY(), vertex->GetZ(),
81 vertex->GetXErr(), vertex->GetYErr(), vertex->GetZErr());
84 // The angles are set properly if they are set after the interaction point and the shifted coordinates
91 void AliL3ConfMapPoint::SetIntPoint(const Double_t in_x,const Double_t in_y,
93 const Double_t in_x_err, const Double_t in_y_err,
94 const Double_t in_z_err)
96 // Defines a new interaction point. This point is needed to calculate
97 // the conformal coordinates.
109 void AliL3ConfMapPoint::SetAllCoord(const AliL3ConfMapPoint *preceding_hit)
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.
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());
121 SetIntPoint(preceding_hit->GetXt(), preceding_hit->GetYt(), preceding_hit->GetZt(),
122 preceding_hit->GetXterr(), preceding_hit->GetYterr(), preceding_hit->GetZterr());
131 void AliL3ConfMapPoint::SetShiftedCoord()
133 // Sets the coordinates with resepct to the given vertex point
139 SetXverr(TMath::Sqrt(GetXerr()*GetXerr() + fXterr*fXterr));
140 SetYverr(TMath::Sqrt(GetYerr()*GetYerr() + fYterr*fYterr));
141 SetZverr(TMath::Sqrt(GetZerr()*GetZerr() + fZterr*fZterr));
146 void AliL3ConfMapPoint::SetConfCoord()
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.
154 Double_t xyErrorScale = 1;
155 Double_t szErrorScale = 1;
157 if ((r2 = fXv*fXv + fYv*fYv))
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);
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));
186 void AliL3ConfMapPoint::SetAngles()
188 // Calculates the angle phi and the pseudorapidity eta for each cluster.
190 Double_t r = TMath::Sqrt(x*x + y*y);
192 fPhi = TMath::ATan2(y,x);
193 if(fPhi<0) fPhi = fPhi + 2*TMath::Pi();
194 fEta = 3.*z/(TMath::Abs(z)+2.*r);
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);
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;
209 fPhi = (fYv > 0.) ? TMath::Pi() / 2. : - TMath::Pi() / 2.;
213 fPhi = (fXv > 0.) ? TMath::ASin(fYv/r2dim) : TMath::Pi() - TMath::ASin(fYv/r2dim);
217 fPhi += 2. * TMath::Pi();
220 //fPhi = TMath::ATan2(y,x);
222 //if(fPhi<0) fPhi = fPhi + 2*TMath::Pi();
224 //fEta = 0.5 * TMath::Log((r3dim + fZv)/(r3dim - fZv));
225 fEta = 0.5 * log((r3dim + fZv)/(r3dim - fZv));
229 AliL3ConfMapTrack *AliL3ConfMapPoint::GetTrack(TClonesArray *tracks) const
231 // Returns the pointer to the track to which this hit belongs.
233 return (AliL3ConfMapTrack*)tracks->At(this->GetTrackNumber());