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
28 #include "AliHLTTPCLogging.h"
29 #include "AliHLTTPCConfMapPoint.h"
30 #include "AliHLTTPCSpacePointData.h"
31 #include "AliHLTTPCVertex.h"
32 #include "AliHLTTPCConfMapTrack.h"
36 //_____________________________________________________________
37 // AliHLTTPCConfMapPoint
39 // Hit class for conformal mapper
43 /** ROOT macro for the implementation of ROOT specific class methods */
44 ClassImp(AliHLTTPCConfMapPoint);
46 Bool_t AliHLTTPCConfMapPoint::fgDontMap=kFALSE;
48 AliHLTTPCConfMapPoint::AliHLTTPCConfMapPoint()
97 AliHLTTPCConfMapPoint::AliHLTTPCConfMapPoint(const AliHLTTPCConfMapPoint& src)
99 fHitNumber(src.fHitNumber),
100 fTrackNumber(src.fTrackNumber),
101 fNextHitNumber(src.fNextHitNumber),
103 fPadrow(src.fPadrow),
104 fSector(src.fSector),
120 fXprime(src.fXprime),
121 fYprime(src.fYprime),
122 fXprimeerr(src.fXprimeerr),
123 fYprimeerr(src.fYprimeerr),
132 fNextVolumeHit(src.fNextVolumeHit),
133 fNextRowHit(src.fNextRowHit),
134 fNextTrackHit(src.fNextTrackHit),
135 fPhiIndex(src.fPhiIndex),
136 fEtaIndex(src.fEtaIndex),
137 fXYChi2(src.fXYChi2),
141 fMCTrackID[0]=src.fMCTrackID[0];
142 fMCTrackID[1]=src.fMCTrackID[1];
143 fMCTrackID[2]=src.fMCTrackID[2];
146 AliHLTTPCConfMapPoint& AliHLTTPCConfMapPoint::operator=(const AliHLTTPCConfMapPoint& src)
148 fHitNumber=src.fHitNumber;
149 fTrackNumber=src.fTrackNumber;
150 fNextHitNumber=src.fNextHitNumber;
171 fXprimeerr=src.fXprimeerr;
172 fYprimeerr=src.fYprimeerr;
181 fNextVolumeHit=src.fNextVolumeHit;
182 fNextRowHit=src.fNextRowHit;
183 fNextTrackHit=src.fNextTrackHit;
184 fPhiIndex=src.fPhiIndex;
185 fEtaIndex=src.fEtaIndex;
188 fMCTrackID[0]=src.fMCTrackID[0];
189 fMCTrackID[1]=src.fMCTrackID[1];
190 fMCTrackID[2]=src.fMCTrackID[2];
195 AliHLTTPCConfMapPoint::~AliHLTTPCConfMapPoint()
200 Bool_t AliHLTTPCConfMapPoint::Read(const AliHLTTPCSpacePointData& hit)
203 SetHitNumber(hit.fID);
204 SetPadRow(hit.fPadRow);
205 Int_t slice = (hit.fID>>25) & 0x7f;
210 SetXerr(sqrt(hit.fSigmaY2));
211 SetYerr(sqrt(hit.fSigmaY2));
212 SetZerr(sqrt(hit.fSigmaZ2));
216 void AliHLTTPCConfMapPoint::Reset()
226 void AliHLTTPCConfMapPoint::Setup(AliHLTTPCVertex *vertex)
228 //Setup. Sets the vertex, conformal coordinates,
229 //and phi and eta of each hit.
231 SetIntPoint(vertex->GetX(), vertex->GetY(), vertex->GetZ(),
232 vertex->GetXErr(), vertex->GetYErr(), vertex->GetZErr());
235 // The angles are set properly if they are set after
236 // the interaction point and the shifted coordinates
242 void AliHLTTPCConfMapPoint::SetIntPoint(Double_t inx, Double_t iny, Double_t inz,
243 Double_t inxerr, Double_t inyerr, Double_t inzerr)
245 // Defines a new interaction point. This point is needed to calculate
246 // the conformal coordinates.
258 void AliHLTTPCConfMapPoint::SetAllCoord(const AliHLTTPCConfMapPoint *precedinghit)
260 // Sets the interaction point, the shifted coordinates, and the conformal mapping coordinates.
261 // These values are calculated from the interaction point of the given cluster which should be a
262 // already found cluster on the same track.
264 if (this == precedinghit) {
265 SetIntPoint(precedinghit->GetX(), precedinghit->GetY(), precedinghit->GetZ(),
266 precedinghit->GetXerr(), precedinghit->GetYerr(), precedinghit->GetZerr());
270 SetIntPoint(precedinghit->GetXt(), precedinghit->GetYt(), precedinghit->GetZt(),
271 precedinghit->GetXterr(), precedinghit->GetYterr(), precedinghit->GetZterr());
280 void AliHLTTPCConfMapPoint::SetShiftedCoord()
282 // Sets the coordinates with resepct to the given vertex point
288 SetXverr(TMath::Sqrt(GetXerr()*GetXerr() + fXterr*fXterr));
289 SetYverr(TMath::Sqrt(GetYerr()*GetYerr() + fYterr*fYterr));
290 SetZverr(TMath::Sqrt(GetZerr()*GetZerr() + fZterr*fZterr));
295 void AliHLTTPCConfMapPoint::SetConfCoord()
297 // Calculates the conformal coordinates of one cluster.
298 // If the option "vertex_constraint" applies the interaction point is
299 // assumed to be at (0, 0, 0). Otherwise the function will use the
300 // interaction point specified by fXt and fYt.
306 fs = 0; //track trajectory
312 Double_t xyErrorScale = 1;
313 Double_t szErrorScale = 1;
315 if ((r2 = fXv*fXv + fYv*fYv))
321 fWxy = r2*r2 / ((xyErrorScale*xyErrorScale)*((fxerr*fxerr)+(fyerr*fyerr)));
322 fs = 0; //track trajectory
323 fWz = (Double_t)(1./(szErrorScale*fzerr*fzerr));
337 void AliHLTTPCConfMapPoint::SetAngles()
339 // Calculates the angle phi and the pseudorapidity eta for each cluster.
341 Double_t r = TMath::Sqrt(x*x + y*y);
343 fPhi = TMath::ATan2(y,x);
344 if(fPhi<0) fPhi = fPhi + 2*TMath::Pi();
345 fEta = 3.*z/(TMath::Abs(z)+2.*r);
348 // Double_t r3dim = TMath::Sqrt(fXv*fXv + fYv*fYv + fZv*fZv);
349 Double_t r3dim = sqrt(fXv*fXv + fYv*fYv + fZv*fZv);
350 //Double_t r2dim = TMath::Sqrt(fXv*fXv + fYv*fYv);
353 // If r2dim == 0 the pseudorapidity eta cannot be calculated (division by zero)!
354 // This can only happen if the point is lying on the z-axis and this should never be possible.
355 cerr << "The pseudorapidity eta cannot be calculated (division by zero)! Set to 1.e-10." << endl;
360 fPhi = (fYv > 0.) ? TMath::Pi() / 2. : - TMath::Pi() / 2.;
364 fPhi = (fXv > 0.) ? TMath::ASin(fYv/r2dim) : TMath::Pi() - TMath::ASin(fYv/r2dim);
368 fPhi += 2. * TMath::Pi();
371 //fPhi = TMath::ATan2(y,x);
373 //if(fPhi<0) fPhi = fPhi + 2*TMath::Pi();
375 //fEta = 0.5 * TMath::Log((r3dim + fZv)/(r3dim - fZv));
376 fEta = 0.5 * log((r3dim + fZv)/(r3dim - fZv));
381 AliHLTTPCConfMapTrack *AliHLTTPCConfMapPoint::GetTrack(TClonesArray *tracks) const
383 // Returns the pointer to the track to which this hit belongs.
385 return (AliHLTTPCConfMapTrack*)tracks->At(this->GetTrackNumber());