1 //Author: Anders Strand Vestbo
3 //________________________________
6 // Hit class for conformal mapper
10 #include "AliL3Logging.h"
12 #include "AliL3ConfMapPoint.h"
13 #include "AliL3SpacePointData.h"
14 #include "AliL3Vertex.h"
15 #include "AliL3ConfMapTrack.h"
17 //ClassImp(AliL3ConfMapPoint)
19 AliL3ConfMapPoint::AliL3ConfMapPoint()
39 SetIntPoint(0., 0., 0., 0., 0., 0.);
41 SetMCTrackID(0.,0.,0.);
44 AliL3ConfMapPoint::~AliL3ConfMapPoint()
47 // Does nothing except destruct.
50 Bool_t AliL3ConfMapPoint::ReadHits(AliL3SpacePointData* hits ){
51 SetHitNumber(hits->fID);
52 SetPadRow(hits->fPadRow);
53 Int_t slice = (hits->fID>>25) & 0x7f;
58 SetXerr(sqrt(hits->fXYErr));
59 SetYerr(sqrt(hits->fXYErr));
60 SetZerr(sqrt(hits->fZErr));
64 void AliL3ConfMapPoint::Setup(AliL3Vertex *vertex)
66 //Setup. Sets the vertex, conformal coordinates, and phi and eta of each hit.
68 SetIntPoint(vertex->GetX(), vertex->GetY(), vertex->GetZ(),
69 vertex->GetXErr(), vertex->GetYErr(), vertex->GetZErr());
72 // The angles are set properly if they are set after the interaction point and the shifted coordinates
79 void AliL3ConfMapPoint::SetIntPoint(const Double_t in_x,const Double_t in_y,
81 const Double_t in_x_err, const Double_t in_y_err,
82 const Double_t in_z_err)
84 // Defines a new interaction point. This point is needed to calculate
85 // the conformal coordinates.
97 void AliL3ConfMapPoint::SetAllCoord(const AliL3ConfMapPoint *preceding_hit)
99 // Sets the interaction point, the shifted coordinates, and the conformal mapping coordinates.
100 // These values are calculated from the interaction point of the given cluster which should be a
101 // already found cluster on the same track.
103 if (this == preceding_hit) {
104 SetIntPoint(preceding_hit->GetX(), preceding_hit->GetY(), preceding_hit->GetZ(),
105 preceding_hit->GetXerr(), preceding_hit->GetYerr(), preceding_hit->GetZerr());
109 SetIntPoint(preceding_hit->GetXt(), preceding_hit->GetYt(), preceding_hit->GetZt(),
110 preceding_hit->GetXterr(), preceding_hit->GetYterr(), preceding_hit->GetZterr());
119 void AliL3ConfMapPoint::SetShiftedCoord()
121 // Sets the coordinates with resepct to the given vertex point
127 SetXverr(TMath::Sqrt(GetXerr()*GetXerr() + fXterr*fXterr));
128 SetYverr(TMath::Sqrt(GetYerr()*GetYerr() + fYterr*fYterr));
129 SetZverr(TMath::Sqrt(GetZerr()*GetZerr() + fZterr*fZterr));
134 void AliL3ConfMapPoint::SetConfCoord()
136 // Calculates the conformal coordinates of one cluster.
137 // If the option "vertex_constraint" applies the interaction point is
138 // assumed to be at (0, 0, 0). Otherwise the function will use the
139 // interaction point specified by fXt and fYt.
142 Double_t xyErrorScale = 1;
143 Double_t szErrorScale = 1;
145 if ((r2 = fXv*fXv + fYv*fYv))
149 // 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);
150 // 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);
154 //fWxy = r2*r2 / (TMath::Power(xyErrorScale,2)*(TMath::Power(xerr,2)+TMath::Power(yerr,2)));
155 fWxy = r2*r2 / ((xyErrorScale*xyErrorScale)*((xerr*xerr)+(yerr*yerr)));
156 s = 0; //track trajectory
157 //fWz = (Double_t)(1./TMath::Power(szErrorScale*zerr,2));
158 fWz = (Double_t)(1./(szErrorScale*zerr*zerr));
174 void AliL3ConfMapPoint::SetAngles()
176 // Calculates the angle phi and the pseudorapidity eta for each cluster.
178 Double_t r = TMath::Sqrt(x*x + y*y);
180 fPhi = TMath::ATan2(y,x);
181 if(fPhi<0) fPhi = fPhi + 2*TMath::Pi();
182 fEta = 3.*z/(TMath::Abs(z)+2.*r);
185 // Double_t r3dim = TMath::Sqrt(fXv*fXv + fYv*fYv + fZv*fZv);
186 Double_t r3dim = sqrt(fXv*fXv + fYv*fYv + fZv*fZv);
187 //Double_t r2dim = TMath::Sqrt(fXv*fXv + fYv*fYv);
190 // If r2dim == 0 the pseudorapidity eta cannot be calculated (division by zero)!
191 // This can only happen if the point is lying on the z-axis and this should never be possible.
192 cerr << "The pseudorapidity eta cannot be calculated (division by zero)! Set to 1.e-10." << endl;
197 fPhi = (fYv > 0.) ? TMath::Pi() / 2. : - TMath::Pi() / 2.;
201 fPhi = (fXv > 0.) ? TMath::ASin(fYv/r2dim) : TMath::Pi() - TMath::ASin(fYv/r2dim);
205 fPhi += 2. * TMath::Pi();
208 //fPhi = TMath::ATan2(y,x);
210 //if(fPhi<0) fPhi = fPhi + 2*TMath::Pi();
212 //fEta = 0.5 * TMath::Log((r3dim + fZv)/(r3dim - fZv));
213 fEta = 0.5 * log((r3dim + fZv)/(r3dim - fZv));
217 AliL3ConfMapTrack *AliL3ConfMapPoint::GetTrack(TClonesArray *tracks) const
219 // Returns the pointer to the track to which this hit belongs.
221 return (AliL3ConfMapTrack*)tracks->At(this->GetTrackNumber());