2 // Original: AliHLTConfMapPoint.cxx,v 1.10 2005/06/23 17:46:55 hristov
4 /**************************************************************************
5 * This file is property of and copyright by the ALICE HLT Project *
6 * ALICE Experiment at CERN, All rights reserved. *
8 * Primary Authors: Anders Vestbo, maintained by *
9 * Matthias Richter <Matthias.Richter@ift.uib.no> *
10 * for The ALICE HLT Project. *
12 * Permission to use, copy, modify and distribute this software and its *
13 * documentation strictly for non-commercial purposes is hereby granted *
14 * without fee, provided that the above copyright notice appears in all *
15 * copies and that both the copyright notice and this permission notice *
16 * appear in the supporting documentation. The authors make no claims *
17 * about the suitability of this software for any purpose. It is *
18 * provided "as is" without express or implied warranty. *
19 **************************************************************************/
21 /** @file AliHLTTPCConfMapPoint.cxx
22 @author Anders Vestbo, maintained by Matthias Richter
24 @brief Hit class for conformal mapper
27 #include "AliHLTTPCLogging.h"
28 #include "AliHLTTPCConfMapPoint.h"
29 #include "AliHLTTPCSpacePointData.h"
30 #include "AliHLTTPCVertex.h"
31 #include "AliHLTTPCConfMapTrack.h"
35 //_____________________________________________________________
36 // AliHLTTPCConfMapPoint
38 // Hit class for conformal mapper
42 /** ROOT macro for the implementation of ROOT specific class methods */
43 ClassImp(AliHLTTPCConfMapPoint);
45 Bool_t AliHLTTPCConfMapPoint::fgDontMap=kFALSE;
47 AliHLTTPCConfMapPoint::AliHLTTPCConfMapPoint()
67 SetIntPoint(0., 0., 0., 0., 0., 0.);
72 AliHLTTPCConfMapPoint::AliHLTTPCConfMapPoint(const AliHLTTPCConfMapPoint&)
74 // dummy copy constructor
75 //HLTFatal("copy constructor untested");
78 AliHLTTPCConfMapPoint& AliHLTTPCConfMapPoint::operator=(const AliHLTTPCConfMapPoint&)
80 // dummy assignment operator
81 //HLTFatal("assignment operator untested");
85 AliHLTTPCConfMapPoint::~AliHLTTPCConfMapPoint()
90 Bool_t AliHLTTPCConfMapPoint::ReadHits(AliHLTTPCSpacePointData* hits )
93 SetHitNumber(hits->fID);
94 SetPadRow(hits->fPadRow);
95 Int_t slice = (hits->fID>>25) & 0x7f;
100 SetXerr(sqrt(hits->fSigmaY2));
101 SetYerr(sqrt(hits->fSigmaY2));
102 SetZerr(sqrt(hits->fSigmaZ2));
106 void AliHLTTPCConfMapPoint::Reset()
116 void AliHLTTPCConfMapPoint::Setup(AliHLTTPCVertex *vertex)
118 //Setup. Sets the vertex, conformal coordinates,
119 //and phi and eta of each hit.
121 SetIntPoint(vertex->GetX(), vertex->GetY(), vertex->GetZ(),
122 vertex->GetXErr(), vertex->GetYErr(), vertex->GetZErr());
125 // The angles are set properly if they are set after
126 // the interaction point and the shifted coordinates
132 void AliHLTTPCConfMapPoint::SetIntPoint(Double_t inx, Double_t iny, Double_t inz,
133 Double_t inxerr, Double_t inyerr, Double_t inzerr)
135 // Defines a new interaction point. This point is needed to calculate
136 // the conformal coordinates.
148 void AliHLTTPCConfMapPoint::SetAllCoord(const AliHLTTPCConfMapPoint *precedinghit)
150 // Sets the interaction point, the shifted coordinates, and the conformal mapping coordinates.
151 // These values are calculated from the interaction point of the given cluster which should be a
152 // already found cluster on the same track.
154 if (this == precedinghit) {
155 SetIntPoint(precedinghit->GetX(), precedinghit->GetY(), precedinghit->GetZ(),
156 precedinghit->GetXerr(), precedinghit->GetYerr(), precedinghit->GetZerr());
160 SetIntPoint(precedinghit->GetXt(), precedinghit->GetYt(), precedinghit->GetZt(),
161 precedinghit->GetXterr(), precedinghit->GetYterr(), precedinghit->GetZterr());
170 void AliHLTTPCConfMapPoint::SetShiftedCoord()
172 // Sets the coordinates with resepct to the given vertex point
178 SetXverr(TMath::Sqrt(GetXerr()*GetXerr() + fXterr*fXterr));
179 SetYverr(TMath::Sqrt(GetYerr()*GetYerr() + fYterr*fYterr));
180 SetZverr(TMath::Sqrt(GetZerr()*GetZerr() + fZterr*fZterr));
185 void AliHLTTPCConfMapPoint::SetConfCoord()
187 // Calculates the conformal coordinates of one cluster.
188 // If the option "vertex_constraint" applies the interaction point is
189 // assumed to be at (0, 0, 0). Otherwise the function will use the
190 // interaction point specified by fXt and fYt.
196 fs = 0; //track trajectory
202 Double_t xyErrorScale = 1;
203 Double_t szErrorScale = 1;
205 if ((r2 = fXv*fXv + fYv*fYv))
211 fWxy = r2*r2 / ((xyErrorScale*xyErrorScale)*((fxerr*fxerr)+(fyerr*fyerr)));
212 fs = 0; //track trajectory
213 fWz = (Double_t)(1./(szErrorScale*fzerr*fzerr));
227 void AliHLTTPCConfMapPoint::SetAngles()
229 // Calculates the angle phi and the pseudorapidity eta for each cluster.
231 Double_t r = TMath::Sqrt(x*x + y*y);
233 fPhi = TMath::ATan2(y,x);
234 if(fPhi<0) fPhi = fPhi + 2*TMath::Pi();
235 fEta = 3.*z/(TMath::Abs(z)+2.*r);
238 // Double_t r3dim = TMath::Sqrt(fXv*fXv + fYv*fYv + fZv*fZv);
239 Double_t r3dim = sqrt(fXv*fXv + fYv*fYv + fZv*fZv);
240 //Double_t r2dim = TMath::Sqrt(fXv*fXv + fYv*fYv);
243 // If r2dim == 0 the pseudorapidity eta cannot be calculated (division by zero)!
244 // This can only happen if the point is lying on the z-axis and this should never be possible.
245 cerr << "The pseudorapidity eta cannot be calculated (division by zero)! Set to 1.e-10." << endl;
250 fPhi = (fYv > 0.) ? TMath::Pi() / 2. : - TMath::Pi() / 2.;
254 fPhi = (fXv > 0.) ? TMath::ASin(fYv/r2dim) : TMath::Pi() - TMath::ASin(fYv/r2dim);
258 fPhi += 2. * TMath::Pi();
261 //fPhi = TMath::ATan2(y,x);
263 //if(fPhi<0) fPhi = fPhi + 2*TMath::Pi();
265 //fEta = 0.5 * TMath::Log((r3dim + fZv)/(r3dim - fZv));
266 fEta = 0.5 * log((r3dim + fZv)/(r3dim - fZv));
271 AliHLTTPCConfMapTrack *AliHLTTPCConfMapPoint::GetTrack(TClonesArray *tracks) const
273 // Returns the pointer to the track to which this hit belongs.
275 return (AliHLTTPCConfMapTrack*)tracks->At(this->GetTrackNumber());