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,
58 Bool_t usedForPrimVtxFit,
65 fProdVertex(prodVertex),
67 fITSClusterMap(itsClusMap),
73 SetPosition(x, isDCA);
74 SetUsedForPrimVtxFit(usedForPrimVtxFit);
75 if(covMatrix) SetCovMatrix(covMatrix);
80 //______________________________________________________________________________
81 AliAODTrack::AliAODTrack(Int_t id,
87 Float_t covMatrix[21],
91 AliAODVertex *prodVertex,
92 Bool_t usedForPrimVtxFit,
99 fProdVertex(prodVertex),
101 fITSClusterMap(itsClusMap),
107 SetPosition(x, isDCA);
108 SetUsedForPrimVtxFit(usedForPrimVtxFit);
109 if(covMatrix) SetCovMatrix(covMatrix);
114 //______________________________________________________________________________
115 AliAODTrack::~AliAODTrack()
122 //______________________________________________________________________________
123 AliAODTrack::AliAODTrack(const AliAODTrack& trk) :
124 AliVirtualParticle(trk),
129 fProdVertex(trk.fProdVertex),
130 fCharge(trk.fCharge),
131 fITSClusterMap(trk.fITSClusterMap),
137 trk.GetPosition(fPosition);
138 SetUsedForPrimVtxFit(trk.GetUsedForPrimVtxFit());
139 if(trk.fCovMatrix) fCovMatrix=new AliAODRedCov<6>(*trk.fCovMatrix);
144 //______________________________________________________________________________
145 AliAODTrack& AliAODTrack::operator=(const AliAODTrack& trk)
147 // Assignment operator
150 AliVirtualParticle::operator=(trk);
153 trk.GetPosition(fPosition);
162 if(trk.fCovMatrix) fCovMatrix=new AliAODRedCov<6>(*trk.fCovMatrix);
163 else fCovMatrix=NULL;
164 fProdVertex = trk.fProdVertex;
166 fCharge = trk.fCharge;
167 fITSClusterMap = trk.fITSClusterMap;
168 SetUsedForPrimVtxFit(trk.GetUsedForPrimVtxFit());
175 //______________________________________________________________________________
176 template <class T> void AliAODTrack::SetP(const T *p, const Bool_t cartesian)
182 Double_t pt = TMath::Sqrt(p[0]*p[0] + p[1]*p[1]);
183 Double_t P = TMath::Sqrt(pt*pt + p[2]*p[2]);
185 fMomentum[0] = 1./pt;
186 fMomentum[1] = TMath::ACos(p[2]/P);
187 fMomentum[2] = TMath::ATan2(p[1], p[0]);
189 fMomentum[0] = p[0]; // 1/pt
190 fMomentum[1] = p[1]; // phi
191 fMomentum[2] = p[2]; // theta
194 fMomentum[0] = -999.;
195 fMomentum[1] = -999.;
196 fMomentum[2] = -999.;
200 //______________________________________________________________________________
201 template <class T> void AliAODTrack::SetPosition(const T *x, const Bool_t dca)
214 // don't know any better yet
215 fPosition[0] = -999.;
216 fPosition[1] = -999.;
217 fPosition[2] = -999.;
222 fPosition[0] = -999.;
223 fPosition[1] = -999.;
224 fPosition[2] = -999.;
228 //______________________________________________________________________________
229 void AliAODTrack::SetDCA(Double_t d, Double_t z)
238 //______________________________________________________________________________
239 void AliAODTrack::Print(Option_t* /* option */) const
241 // prints information about AliAODTrack
243 printf("Object name: %s Track type: %s\n", GetName(), GetTitle());
244 printf(" px = %f\n", Px());
245 printf(" py = %f\n", Py());
246 printf(" pz = %f\n", Pz());
247 printf(" pt = %f\n", Pt());
248 printf(" 1/pt = %f\n", OneOverPt());
249 printf(" theta = %f\n", Theta());
250 printf(" phi = %f\n", Phi());
251 printf(" chi2 = %f\n", Chi2());
252 printf(" charge = %d\n", Charge());
253 printf(" PID object: %p\n", PID());