]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliAODTrack.cxx
Bit added to indicate if this track was used to fit the primary vertex.
[u/mrichter/AliRoot.git] / STEER / AliAODTrack.cxx
CommitLineData
df9db588 1/**************************************************************************
2 * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16/* $Id$ */
17
18//-------------------------------------------------------------------------
19// AOD track base class
20// Author: Markus Oldenburg, CERN
21//-------------------------------------------------------------------------
22
23#include "AliAODTrack.h"
24
25ClassImp(AliAODTrack)
26
27//______________________________________________________________________________
28AliAODTrack::AliAODTrack() :
29 AliVirtualParticle(),
30 fChi2(-999.),
31 fID(-999),
32 fLabel(-999),
33 fCovMatrix(NULL),
34 fProdVertex(0x0),
14b34be5 35 fCharge(-99),
df9db588 36 fITSClusterMap(0),
37 fType(kUndef)
38{
39 // default constructor
40
41 SetP();
42 SetPosition((Float_t*)NULL);
43 SetPID((Float_t*)NULL);
44}
45
46//______________________________________________________________________________
47AliAODTrack::AliAODTrack(Int_t id,
48 Int_t label,
49 Double_t p[3],
50 Bool_t cartesian,
51 Double_t x[3],
52 Bool_t isDCA,
53 Double_t covMatrix[21],
54 Short_t charge,
55 UChar_t itsClusMap,
56 Double_t pid[10],
57 AliAODVertex *prodVertex,
dc825b15 58 Bool_t usedForPrimVtxFit,
df9db588 59 AODTrk_t ttype) :
60 AliVirtualParticle(),
61 fChi2(-999.),
62 fID(id),
63 fLabel(label),
64 fCovMatrix(NULL),
65 fProdVertex(prodVertex),
66 fCharge(charge),
67 fITSClusterMap(itsClusMap),
68 fType(ttype)
69{
70 // constructor
71
72 SetP(p, cartesian);
73 SetPosition(x, isDCA);
dc825b15 74 SetUsedForPrimVtxFit(usedForPrimVtxFit);
df9db588 75 if(covMatrix) SetCovMatrix(covMatrix);
76 SetPID(pid);
77
78}
79
80//______________________________________________________________________________
81AliAODTrack::AliAODTrack(Int_t id,
82 Int_t label,
83 Float_t p[3],
84 Bool_t cartesian,
85 Float_t x[3],
86 Bool_t isDCA,
87 Float_t covMatrix[21],
88 Short_t charge,
89 UChar_t itsClusMap,
90 Float_t pid[10],
91 AliAODVertex *prodVertex,
dc825b15 92 Bool_t usedForPrimVtxFit,
df9db588 93 AODTrk_t ttype) :
94 AliVirtualParticle(),
95 fChi2(-999.),
96 fID(id),
97 fLabel(label),
98 fCovMatrix(NULL),
99 fProdVertex(prodVertex),
100 fCharge(charge),
101 fITSClusterMap(itsClusMap),
102 fType(ttype)
103{
104 // constructor
105
106 SetP(p, cartesian);
107 SetPosition(x, isDCA);
dc825b15 108 SetUsedForPrimVtxFit(usedForPrimVtxFit);
df9db588 109 if(covMatrix) SetCovMatrix(covMatrix);
110 SetPID(pid);
111
112}
113
df9db588 114//______________________________________________________________________________
115AliAODTrack::~AliAODTrack()
116{
117 // destructor
118 delete fCovMatrix;
119}
120
121
122//______________________________________________________________________________
123AliAODTrack::AliAODTrack(const AliAODTrack& trk) :
124 AliVirtualParticle(trk),
125 fChi2(trk.fChi2),
126 fID(trk.fID),
127 fLabel(trk.fLabel),
128 fCovMatrix(NULL),
129 fProdVertex(trk.fProdVertex),
130 fCharge(trk.fCharge),
131 fITSClusterMap(trk.fITSClusterMap),
132 fType(trk.fType)
133{
134 // Copy constructor
135
136 trk.GetP(fMomentum);
137 trk.GetPosition(fPosition);
dc825b15 138 SetUsedForPrimVtxFit(trk.GetUsedForPrimVtxFit());
5d62ce04 139 if(trk.fCovMatrix) fCovMatrix=new AliAODRedCov<6>(*trk.fCovMatrix);
df9db588 140 SetPID(trk.fPID);
141
142}
143
144//______________________________________________________________________________
145AliAODTrack& AliAODTrack::operator=(const AliAODTrack& trk)
146{
147 // Assignment operator
148 if(this!=&trk) {
149
150 AliVirtualParticle::operator=(trk);
151
152 trk.GetP(fMomentum);
153 trk.GetPosition(fPosition);
154 trk.GetPID(fPID);
155
156 fChi2 = trk.fChi2;
157
158 fID = trk.fID;
159 fLabel = trk.fLabel;
160
161 delete fCovMatrix;
5d62ce04 162 if(trk.fCovMatrix) fCovMatrix=new AliAODRedCov<6>(*trk.fCovMatrix);
df9db588 163 else fCovMatrix=NULL;
164 fProdVertex = trk.fProdVertex;
165
166 fCharge = trk.fCharge;
167 fITSClusterMap = trk.fITSClusterMap;
dc825b15 168 SetUsedForPrimVtxFit(trk.GetUsedForPrimVtxFit());
df9db588 169 fType = trk.fType;
170 }
171
172 return *this;
173}
174
175//______________________________________________________________________________
176template <class T> void AliAODTrack::SetP(const T *p, const Bool_t cartesian)
177{
178 // set the momentum
179
180 if (p) {
181 if (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]);
184
185 fMomentum[0] = 1./pt;
186 fMomentum[1] = TMath::ACos(p[2]/P);
187 fMomentum[2] = TMath::ATan2(p[1], p[0]);
188 } else {
189 fMomentum[0] = p[0]; // 1/pt
190 fMomentum[1] = p[1]; // phi
191 fMomentum[2] = p[2]; // theta
192 }
193 } else {
194 fMomentum[0] = -999.;
195 fMomentum[1] = -999.;
196 fMomentum[2] = -999.;
197 }
198}
199
200//______________________________________________________________________________
201template <class T> void AliAODTrack::SetPosition(const T *x, const Bool_t dca)
202{
203 // set the position
204
205 if (x) {
206 if (!dca) {
207 ResetBit(kIsDCA);
208
209 fPosition[0] = x[0];
210 fPosition[1] = x[1];
211 fPosition[2] = x[2];
212 } else {
213 SetBit(kIsDCA);
214 // don't know any better yet
215 fPosition[0] = -999.;
216 fPosition[1] = -999.;
217 fPosition[2] = -999.;
218 }
219 } else {
220 ResetBit(kIsDCA);
221
222 fPosition[0] = -999.;
223 fPosition[1] = -999.;
224 fPosition[2] = -999.;
225 }
226}
227
228//______________________________________________________________________________
229void AliAODTrack::SetDCA(Double_t d, Double_t z)
230{
231 // set the dca
232 fPosition[0] = d;
233 fPosition[1] = z;
234 fPosition[2] = 0.;
235 SetBit(kIsDCA);
236}
237
238//______________________________________________________________________________
239void AliAODTrack::Print(Option_t* /* option */) const
240{
241 // prints information about AliAODTrack
242
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());
254}
255