1 /**************************************************************************
2 * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 //-------------------------------------------------------------------------
19 // AOD track base class
20 // Author: Markus Oldenburg, CERN
21 //-------------------------------------------------------------------------
23 #include "AliAODTrack.h"
27 //______________________________________________________________________________
28 AliAODTrack::AliAODTrack() :
39 // default constructor
42 SetPosition((Float_t*)NULL);
43 SetPID((Float_t*)NULL);
46 //______________________________________________________________________________
47 AliAODTrack::AliAODTrack(Int_t id,
53 Double_t covMatrix[21],
57 AliAODVertex *prodVertex,
64 fProdVertex(prodVertex),
66 fITSClusterMap(itsClusMap),
72 SetPosition(x, isDCA);
73 if(covMatrix) SetCovMatrix(covMatrix);
78 //______________________________________________________________________________
79 AliAODTrack::AliAODTrack(Int_t id,
85 Float_t covMatrix[21],
89 AliAODVertex *prodVertex,
96 fProdVertex(prodVertex),
98 fITSClusterMap(itsClusMap),
104 SetPosition(x, isDCA);
105 if(covMatrix) SetCovMatrix(covMatrix);
110 //______________________________________________________________________________
111 AliAODTrack::~AliAODTrack()
118 //______________________________________________________________________________
119 AliAODTrack::AliAODTrack(const AliAODTrack& trk) :
120 AliVirtualParticle(trk),
125 fProdVertex(trk.fProdVertex),
126 fCharge(trk.fCharge),
127 fITSClusterMap(trk.fITSClusterMap),
133 trk.GetPosition(fPosition);
134 if(trk.fCovMatrix) fCovMatrix=new AliAODRedCov<6>(*trk.fCovMatrix);
139 //______________________________________________________________________________
140 AliAODTrack& AliAODTrack::operator=(const AliAODTrack& trk)
142 // Assignment operator
145 AliVirtualParticle::operator=(trk);
148 trk.GetPosition(fPosition);
157 if(trk.fCovMatrix) fCovMatrix=new AliAODRedCov<6>(*trk.fCovMatrix);
158 else fCovMatrix=NULL;
159 fProdVertex = trk.fProdVertex;
161 fCharge = trk.fCharge;
162 fITSClusterMap = trk.fITSClusterMap;
169 //______________________________________________________________________________
170 template <class T> void AliAODTrack::SetP(const T *p, const Bool_t cartesian)
176 Double_t pt = TMath::Sqrt(p[0]*p[0] + p[1]*p[1]);
177 Double_t P = TMath::Sqrt(pt*pt + p[2]*p[2]);
179 fMomentum[0] = 1./pt;
180 fMomentum[1] = TMath::ACos(p[2]/P);
181 fMomentum[2] = TMath::ATan2(p[1], p[0]);
183 fMomentum[0] = p[0]; // 1/pt
184 fMomentum[1] = p[1]; // phi
185 fMomentum[2] = p[2]; // theta
188 fMomentum[0] = -999.;
189 fMomentum[1] = -999.;
190 fMomentum[2] = -999.;
194 //______________________________________________________________________________
195 template <class T> void AliAODTrack::SetPosition(const T *x, const Bool_t dca)
208 // don't know any better yet
209 fPosition[0] = -999.;
210 fPosition[1] = -999.;
211 fPosition[2] = -999.;
216 fPosition[0] = -999.;
217 fPosition[1] = -999.;
218 fPosition[2] = -999.;
222 //______________________________________________________________________________
223 void AliAODTrack::SetDCA(Double_t d, Double_t z)
232 //______________________________________________________________________________
233 void AliAODTrack::Print(Option_t* /* option */) const
235 // prints information about AliAODTrack
237 printf("Object name: %s Track type: %s\n", GetName(), GetTitle());
238 printf(" px = %f\n", Px());
239 printf(" py = %f\n", Py());
240 printf(" pz = %f\n", Pz());
241 printf(" pt = %f\n", Pt());
242 printf(" 1/pt = %f\n", OneOverPt());
243 printf(" theta = %f\n", Theta());
244 printf(" phi = %f\n", Phi());
245 printf(" chi2 = %f\n", Chi2());
246 printf(" charge = %d\n", Charge());
247 printf(" PID object: %p\n", PID());