3 // Author: Anders Vestbo <mailto:vestbo$fi.uib.no>
4 //*-- Copyright © ALICE HLT Group
6 #include "AliL3StandardIncludes.h"
8 #include "AliL3Logging.h"
9 #include "AliL3ConfMapPoint.h"
10 #include "AliL3SpacePointData.h"
11 #include "AliL3Vertex.h"
12 #include "AliL3ConfMapTrack.h"
16 //_____________________________________________________________
19 // Hit class for conformal mapper
23 ClassImp(AliL3ConfMapPoint)
25 Bool_t AliL3ConfMapPoint::fDontMap=kFALSE;
27 AliL3ConfMapPoint::AliL3ConfMapPoint()
47 SetIntPoint(0., 0., 0., 0., 0., 0.);
52 AliL3ConfMapPoint::~AliL3ConfMapPoint()
55 // Does nothing except destruct.
58 Bool_t AliL3ConfMapPoint::ReadHits(AliL3SpacePointData* hits ){
60 SetHitNumber(hits->fID);
61 SetPadRow(hits->fPadRow);
62 Int_t slice = (hits->fID>>25) & 0x7f;
67 SetXerr(sqrt(hits->fSigmaY2));
68 SetYerr(sqrt(hits->fSigmaY2));
69 SetZerr(sqrt(hits->fSigmaZ2));
73 void AliL3ConfMapPoint::Reset()
83 void AliL3ConfMapPoint::Setup(AliL3Vertex *vertex)
85 //Setup. Sets the vertex, conformal coordinates, and phi and eta of each hit.
87 SetIntPoint(vertex->GetX(), vertex->GetY(), vertex->GetZ(),
88 vertex->GetXErr(), vertex->GetYErr(), vertex->GetZErr());
91 // The angles are set properly if they are set after the interaction point and the shifted coordinates
98 void AliL3ConfMapPoint::SetIntPoint(const Double_t in_x,const Double_t in_y,const Double_t in_z,
99 const Double_t in_x_err,const Double_t in_y_err,const Double_t in_z_err)
101 // Defines a new interaction point. This point is needed to calculate
102 // the conformal coordinates.
114 void AliL3ConfMapPoint::SetAllCoord(const AliL3ConfMapPoint *preceding_hit)
116 // Sets the interaction point, the shifted coordinates, and the conformal mapping coordinates.
117 // These values are calculated from the interaction point of the given cluster which should be a
118 // already found cluster on the same track.
120 if (this == preceding_hit) {
121 SetIntPoint(preceding_hit->GetX(), preceding_hit->GetY(), preceding_hit->GetZ(),
122 preceding_hit->GetXerr(), preceding_hit->GetYerr(), preceding_hit->GetZerr());
126 SetIntPoint(preceding_hit->GetXt(), preceding_hit->GetYt(), preceding_hit->GetZt(),
127 preceding_hit->GetXterr(), preceding_hit->GetYterr(), preceding_hit->GetZterr());
136 void AliL3ConfMapPoint::SetShiftedCoord()
138 // Sets the coordinates with resepct to the given vertex point
144 SetXverr(TMath::Sqrt(GetXerr()*GetXerr() + fXterr*fXterr));
145 SetYverr(TMath::Sqrt(GetYerr()*GetYerr() + fYterr*fYterr));
146 SetZverr(TMath::Sqrt(GetZerr()*GetZerr() + fZterr*fZterr));
151 void AliL3ConfMapPoint::SetConfCoord()
153 // Calculates the conformal coordinates of one cluster.
154 // If the option "vertex_constraint" applies the interaction point is
155 // assumed to be at (0, 0, 0). Otherwise the function will use the
156 // interaction point specified by fXt and fYt.
162 s = 0; //track trajectory
168 Double_t xyErrorScale = 1;
169 Double_t szErrorScale = 1;
171 if ((r2 = fXv*fXv + fYv*fYv))
177 fWxy = r2*r2 / ((xyErrorScale*xyErrorScale)*((xerr*xerr)+(yerr*yerr)));
178 s = 0; //track trajectory
179 fWz = (Double_t)(1./(szErrorScale*zerr*zerr));
193 void AliL3ConfMapPoint::SetAngles()
195 // Calculates the angle phi and the pseudorapidity eta for each cluster.
197 Double_t r = TMath::Sqrt(x*x + y*y);
199 fPhi = TMath::ATan2(y,x);
200 if(fPhi<0) fPhi = fPhi + 2*TMath::Pi();
201 fEta = 3.*z/(TMath::Abs(z)+2.*r);
204 // Double_t r3dim = TMath::Sqrt(fXv*fXv + fYv*fYv + fZv*fZv);
205 Double_t r3dim = sqrt(fXv*fXv + fYv*fYv + fZv*fZv);
206 //Double_t r2dim = TMath::Sqrt(fXv*fXv + fYv*fYv);
209 // If r2dim == 0 the pseudorapidity eta cannot be calculated (division by zero)!
210 // This can only happen if the point is lying on the z-axis and this should never be possible.
211 cerr << "The pseudorapidity eta cannot be calculated (division by zero)! Set to 1.e-10." << endl;
216 fPhi = (fYv > 0.) ? TMath::Pi() / 2. : - TMath::Pi() / 2.;
220 fPhi = (fXv > 0.) ? TMath::ASin(fYv/r2dim) : TMath::Pi() - TMath::ASin(fYv/r2dim);
224 fPhi += 2. * TMath::Pi();
227 //fPhi = TMath::ATan2(y,x);
229 //if(fPhi<0) fPhi = fPhi + 2*TMath::Pi();
231 //fEta = 0.5 * TMath::Log((r3dim + fZv)/(r3dim - fZv));
232 fEta = 0.5 * log((r3dim + fZv)/(r3dim - fZv));
236 AliL3ConfMapTrack *AliL3ConfMapPoint::GetTrack(TClonesArray *tracks) const
238 // Returns the pointer to the track to which this hit belongs.
240 return (AliL3ConfMapTrack*)tracks->At(this->GetTrackNumber());