1 // Author: Anders Vestbo <mailto:vestbo$fi.uib.no>
2 //*-- Copyright © ASV
4 #include "AliL3StandardIncludes.h"
6 #include "AliL3Logging.h"
7 #include "AliL3ConfMapPoint.h"
8 #include "AliL3SpacePointData.h"
9 #include "AliL3Vertex.h"
10 #include "AliL3ConfMapTrack.h"
12 //_____________________________________________________________
15 // Hit class for conformal mapper
17 ClassImp(AliL3ConfMapPoint)
19 AliL3ConfMapPoint::AliL3ConfMapPoint()
39 SetIntPoint(0., 0., 0., 0., 0., 0.);
44 AliL3ConfMapPoint::~AliL3ConfMapPoint()
47 // Does nothing except destruct.
50 Bool_t AliL3ConfMapPoint::ReadHits(AliL3SpacePointData* hits ){
52 SetHitNumber(hits->fID);
53 SetPadRow(hits->fPadRow);
54 Int_t slice = (hits->fID>>25) & 0x7f;
59 SetXerr(sqrt(hits->fXYErr));
60 SetYerr(sqrt(hits->fXYErr));
61 SetZerr(sqrt(hits->fZErr));
65 void AliL3ConfMapPoint::Reset()
75 void AliL3ConfMapPoint::Setup(AliL3Vertex *vertex)
77 //Setup. Sets the vertex, conformal coordinates, and phi and eta of each hit.
79 SetIntPoint(vertex->GetX(), vertex->GetY(), vertex->GetZ(),
80 vertex->GetXErr(), vertex->GetYErr(), vertex->GetZErr());
83 // The angles are set properly if they are set after the interaction point and the shifted coordinates
90 void AliL3ConfMapPoint::SetIntPoint(const Double_t in_x,const Double_t in_y,
92 const Double_t in_x_err, const Double_t in_y_err,
93 const Double_t in_z_err)
95 // Defines a new interaction point. This point is needed to calculate
96 // the conformal coordinates.
108 void AliL3ConfMapPoint::SetAllCoord(const AliL3ConfMapPoint *preceding_hit)
110 // Sets the interaction point, the shifted coordinates, and the conformal mapping coordinates.
111 // These values are calculated from the interaction point of the given cluster which should be a
112 // already found cluster on the same track.
114 if (this == preceding_hit) {
115 SetIntPoint(preceding_hit->GetX(), preceding_hit->GetY(), preceding_hit->GetZ(),
116 preceding_hit->GetXerr(), preceding_hit->GetYerr(), preceding_hit->GetZerr());
120 SetIntPoint(preceding_hit->GetXt(), preceding_hit->GetYt(), preceding_hit->GetZt(),
121 preceding_hit->GetXterr(), preceding_hit->GetYterr(), preceding_hit->GetZterr());
130 void AliL3ConfMapPoint::SetShiftedCoord()
132 // Sets the coordinates with resepct to the given vertex point
138 SetXverr(TMath::Sqrt(GetXerr()*GetXerr() + fXterr*fXterr));
139 SetYverr(TMath::Sqrt(GetYerr()*GetYerr() + fYterr*fYterr));
140 SetZverr(TMath::Sqrt(GetZerr()*GetZerr() + fZterr*fZterr));
145 void AliL3ConfMapPoint::SetConfCoord()
147 // Calculates the conformal coordinates of one cluster.
148 // If the option "vertex_constraint" applies the interaction point is
149 // assumed to be at (0, 0, 0). Otherwise the function will use the
150 // interaction point specified by fXt and fYt.
153 Double_t xyErrorScale = 1;
154 Double_t szErrorScale = 1;
156 if ((r2 = fXv*fXv + fYv*fYv))
160 // 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);
161 // 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);
165 //fWxy = r2*r2 / (TMath::Power(xyErrorScale,2)*(TMath::Power(xerr,2)+TMath::Power(yerr,2)));
166 fWxy = r2*r2 / ((xyErrorScale*xyErrorScale)*((xerr*xerr)+(yerr*yerr)));
167 s = 0; //track trajectory
168 //fWz = (Double_t)(1./TMath::Power(szErrorScale*zerr,2));
169 fWz = (Double_t)(1./(szErrorScale*zerr*zerr));
185 void AliL3ConfMapPoint::SetAngles()
187 // Calculates the angle phi and the pseudorapidity eta for each cluster.
189 Double_t r = TMath::Sqrt(x*x + y*y);
191 fPhi = TMath::ATan2(y,x);
192 if(fPhi<0) fPhi = fPhi + 2*TMath::Pi();
193 fEta = 3.*z/(TMath::Abs(z)+2.*r);
196 // Double_t r3dim = TMath::Sqrt(fXv*fXv + fYv*fYv + fZv*fZv);
197 Double_t r3dim = sqrt(fXv*fXv + fYv*fYv + fZv*fZv);
198 //Double_t r2dim = TMath::Sqrt(fXv*fXv + fYv*fYv);
201 // If r2dim == 0 the pseudorapidity eta cannot be calculated (division by zero)!
202 // This can only happen if the point is lying on the z-axis and this should never be possible.
203 cerr << "The pseudorapidity eta cannot be calculated (division by zero)! Set to 1.e-10." << endl;
208 fPhi = (fYv > 0.) ? TMath::Pi() / 2. : - TMath::Pi() / 2.;
212 fPhi = (fXv > 0.) ? TMath::ASin(fYv/r2dim) : TMath::Pi() - TMath::ASin(fYv/r2dim);
216 fPhi += 2. * TMath::Pi();
219 //fPhi = TMath::ATan2(y,x);
221 //if(fPhi<0) fPhi = fPhi + 2*TMath::Pi();
223 //fEta = 0.5 * TMath::Log((r3dim + fZv)/(r3dim - fZv));
224 fEta = 0.5 * log((r3dim + fZv)/(r3dim - fZv));
228 AliL3ConfMapTrack *AliL3ConfMapPoint::GetTrack(TClonesArray *tracks) const
230 // Returns the pointer to the track to which this hit belongs.
232 return (AliL3ConfMapTrack*)tracks->At(this->GetTrackNumber());