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 ){
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::Setup(AliL3Vertex *vertex)
67 //Setup. Sets the vertex, conformal coordinates, and phi and eta of each hit.
69 SetIntPoint(vertex->GetX(), vertex->GetY(), vertex->GetZ(),
70 vertex->GetXErr(), vertex->GetYErr(), vertex->GetZErr());
73 // The angles are set properly if they are set after the interaction point and the shifted coordinates
80 void AliL3ConfMapPoint::SetIntPoint(const Double_t in_x,const Double_t in_y,
82 const Double_t in_x_err, const Double_t in_y_err,
83 const Double_t in_z_err)
85 // Defines a new interaction point. This point is needed to calculate
86 // the conformal coordinates.
98 void AliL3ConfMapPoint::SetAllCoord(const AliL3ConfMapPoint *preceding_hit)
100 // Sets the interaction point, the shifted coordinates, and the conformal mapping coordinates.
101 // These values are calculated from the interaction point of the given cluster which should be a
102 // already found cluster on the same track.
104 if (this == preceding_hit) {
105 SetIntPoint(preceding_hit->GetX(), preceding_hit->GetY(), preceding_hit->GetZ(),
106 preceding_hit->GetXerr(), preceding_hit->GetYerr(), preceding_hit->GetZerr());
110 SetIntPoint(preceding_hit->GetXt(), preceding_hit->GetYt(), preceding_hit->GetZt(),
111 preceding_hit->GetXterr(), preceding_hit->GetYterr(), preceding_hit->GetZterr());
120 void AliL3ConfMapPoint::SetShiftedCoord()
122 // Sets the coordinates with resepct to the given vertex point
128 SetXverr(TMath::Sqrt(GetXerr()*GetXerr() + fXterr*fXterr));
129 SetYverr(TMath::Sqrt(GetYerr()*GetYerr() + fYterr*fYterr));
130 SetZverr(TMath::Sqrt(GetZerr()*GetZerr() + fZterr*fZterr));
135 void AliL3ConfMapPoint::SetConfCoord()
137 // Calculates the conformal coordinates of one cluster.
138 // If the option "vertex_constraint" applies the interaction point is
139 // assumed to be at (0, 0, 0). Otherwise the function will use the
140 // interaction point specified by fXt and fYt.
143 Double_t xyErrorScale = 1;
144 Double_t szErrorScale = 1;
146 if ((r2 = fXv*fXv + fYv*fYv))
150 // 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);
151 // 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);
155 //fWxy = r2*r2 / (TMath::Power(xyErrorScale,2)*(TMath::Power(xerr,2)+TMath::Power(yerr,2)));
156 fWxy = r2*r2 / ((xyErrorScale*xyErrorScale)*((xerr*xerr)+(yerr*yerr)));
157 s = 0; //track trajectory
158 //fWz = (Double_t)(1./TMath::Power(szErrorScale*zerr,2));
159 fWz = (Double_t)(1./(szErrorScale*zerr*zerr));
175 void AliL3ConfMapPoint::SetAngles()
177 // Calculates the angle phi and the pseudorapidity eta for each cluster.
179 Double_t r = TMath::Sqrt(x*x + y*y);
181 fPhi = TMath::ATan2(y,x);
182 if(fPhi<0) fPhi = fPhi + 2*TMath::Pi();
183 fEta = 3.*z/(TMath::Abs(z)+2.*r);
186 // Double_t r3dim = TMath::Sqrt(fXv*fXv + fYv*fYv + fZv*fZv);
187 Double_t r3dim = sqrt(fXv*fXv + fYv*fYv + fZv*fZv);
188 //Double_t r2dim = TMath::Sqrt(fXv*fXv + fYv*fYv);
191 // If r2dim == 0 the pseudorapidity eta cannot be calculated (division by zero)!
192 // This can only happen if the point is lying on the z-axis and this should never be possible.
193 cerr << "The pseudorapidity eta cannot be calculated (division by zero)! Set to 1.e-10." << endl;
198 fPhi = (fYv > 0.) ? TMath::Pi() / 2. : - TMath::Pi() / 2.;
202 fPhi = (fXv > 0.) ? TMath::ASin(fYv/r2dim) : TMath::Pi() - TMath::ASin(fYv/r2dim);
206 fPhi += 2. * TMath::Pi();
209 //fPhi = TMath::ATan2(y,x);
211 //if(fPhi<0) fPhi = fPhi + 2*TMath::Pi();
213 //fEta = 0.5 * TMath::Log((r3dim + fZv)/(r3dim - fZv));
214 fEta = 0.5 * log((r3dim + fZv)/(r3dim - fZv));
218 AliL3ConfMapTrack *AliL3ConfMapPoint::GetTrack(TClonesArray *tracks) const
220 // Returns the pointer to the track to which this hit belongs.
222 return (AliL3ConfMapTrack*)tracks->At(this->GetTrackNumber());