Line data Source code
1 : #ifndef AliAODTrack_H
2 : #define AliAODTrack_H
3 : /* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
4 : * See cxx source for full Copyright notice */
5 :
6 : /* $Id$ */
7 :
8 : //-------------------------------------------------------------------------
9 : // AOD track implementation of AliVTrack
10 : // Author: Markus Oldenburg, CERN
11 : //-------------------------------------------------------------------------
12 :
13 : #include <TRef.h>
14 : #include <TBits.h>
15 :
16 : #include "AliVTrack.h"
17 : #include "AliAODVertex.h"
18 : #include "AliAODRedCov.h"
19 : #include "AliAODPid.h"
20 : #include "AliExternalTrackParam.h"
21 :
22 :
23 : class AliVVertex;
24 : class AliDetectorPID;
25 : class AliTPCdEdxInfo;
26 : class AliAODEvent;
27 : class AliTOFHeader;
28 :
29 : class AliAODTrack : public AliVTrack {
30 :
31 : public:
32 :
33 : enum AODTrk_t {kUndef = -1,
34 : kPrimary,
35 : kFromDecayVtx,
36 : kOrphan}; // Please note that this flag does not guarantee that the particle is a Physical Primary, it simply identifies the algorithm which was used to filter the track. In general, the following associations are used (check the filter macro to be sure, as this comment may be outdated):
37 : //kPrimary: TPC only tracks, global constrained tracks, primary tracks, kink mothers;
38 : //kFromDecayVtx: bachelor tracks from cascades, tracks from V0, kink daughters;
39 : //kUndef:TRD matched tracks
40 :
41 : enum AODTrkBits_t {
42 : kIsDCA=BIT(14), // set if fPosition is the DCA and not the position of the first point
43 : kUsedForVtxFit=BIT(15), // set if this track was used to fit the vertex it is attached to
44 : kUsedForPrimVtxFit=BIT(16), // set if this track was used to fit the primary vertex
45 : kIsTPCConstrained=BIT(17), // set if this track is a SA TPC track constrained to the SPD vertex, needs to be skipped in any track loop to avoid double counting
46 : kIsHybridTPCCG=BIT(18), // set if this track can be used as a hybrid track i.e. Gbobal tracks with certain slecetion plus the TPC constrained tracks that did not pass the selection
47 : kIsGlobalConstrained=BIT(19), // set if this track is a global track constrained to the vertex, needs to be skipped in any track loop to avoid double counting
48 : kIsHybridGCG=BIT(20)// set if this track can be used as a hybrid track i.e. tracks with certain slecetion plus the global constraint tracks that did not pass the selection
49 : };
50 :
51 :
52 : enum AODTrkFilterBits_t {
53 : kTrkTPCOnly = BIT(0), // Standard TPC only tracks
54 : kTrkITSsa = BIT(1), // ITS standalone
55 : kTrkITSConstrained = BIT(2), // Pixel OR necessary for the electrons
56 : kTrkElectronsPID = BIT(3), // PID for the electrons
57 : kTrkGlobalNoDCA = BIT(4), // standard cuts with very loose DCA
58 : kTrkGlobal = BIT(5), // standard cuts with tight DCA cut
59 : kTrkGlobalSDD = BIT(6), // standard cuts with tight DCA but with requiring the first SDD cluster instead of an SPD cluster tracks selected by this cut are exclusive to those selected by the previous cut
60 : kTrkTPCOnlyConstrained = BIT(7) // TPC only tracks: TPConly information constrained to SPD vertex in the filter below
61 : };
62 :
63 :
64 : enum AODTrkPID_t {
65 : kElectron = 0,
66 : kMuon = 1,
67 : kPion = 2,
68 : kKaon = 3,
69 : kProton = 4,
70 : kDeuteron = 5,
71 : kTriton = 6,
72 : kHelium3 = 7,
73 : kAlpha = 8,
74 : kUnknown = 9,
75 : kMostProbable = -1
76 : };
77 :
78 : AliAODTrack();
79 : AliAODTrack(Short_t id,
80 : Int_t label,
81 : Double_t p[3],
82 : Bool_t cartesian,
83 : Double_t x[3],
84 : Bool_t dca,
85 : Double_t covMatrix[21],
86 : Short_t q,
87 : UChar_t itsClusMap,
88 : AliAODVertex *prodVertex,
89 : Bool_t usedForVtxFit,
90 : Bool_t usedForPrimVtxFit,
91 : AODTrk_t ttype=kUndef,
92 : UInt_t selectInfo=0,
93 : Float_t chi2perNDF = -999.);
94 :
95 :
96 : AliAODTrack(Short_t id,
97 : Int_t label,
98 : Float_t p[3],
99 : Bool_t cartesian,
100 : Float_t x[3],
101 : Bool_t dca,
102 : Float_t covMatrix[21],
103 : Short_t q,
104 : UChar_t itsClusMap,
105 : AliAODVertex *prodVertex,
106 : Bool_t usedForVtxFit,
107 : Bool_t usedForPrimVtxFit,
108 : AODTrk_t ttype=kUndef,
109 : UInt_t selectInfo=0,
110 : Float_t chi2perNDF = -999.);
111 :
112 : virtual ~AliAODTrack();
113 : AliAODTrack(const AliAODTrack& trk);
114 : AliAODTrack& operator=(const AliAODTrack& trk);
115 :
116 : // kinematics
117 0 : virtual Double_t OneOverPt() const { return (fMomentum[0] != 0.) ? 1./fMomentum[0] : -999.; }
118 28 : virtual Double_t Phi() const { return fMomentum[1]; }
119 0 : virtual Double_t Theta() const { return fMomentum[2]; }
120 :
121 0 : virtual Double_t Px() const { return fMomentum[0] * TMath::Cos(fMomentum[1]); }
122 0 : virtual Double_t Py() const { return fMomentum[0] * TMath::Sin(fMomentum[1]); }
123 548 : virtual Double_t Pz() const { return fMomentum[0] / TMath::Tan(fMomentum[2]); }
124 822 : virtual Double_t Pt() const { return fMomentum[0]; }
125 274 : virtual Double_t P() const { return TMath::Sqrt(Pt()*Pt()+Pz()*Pz()); }
126 0 : virtual Bool_t PxPyPz(Double_t p[3]) const { p[0] = Px(); p[1] = Py(); p[2] = Pz(); return kTRUE; }
127 :
128 0 : virtual Double_t Xv() const { return GetProdVertex() ? GetProdVertex()->GetX() : -999.; }
129 0 : virtual Double_t Yv() const { return GetProdVertex() ? GetProdVertex()->GetY() : -999.; }
130 0 : virtual Double_t Zv() const { return GetProdVertex() ? GetProdVertex()->GetZ() : -999.; }
131 0 : virtual Bool_t XvYvZv(Double_t x[3]) const { x[0] = Xv(); x[1] = Yv(); x[2] = Zv(); return kTRUE; }
132 :
133 0 : Double_t Chi2perNDF() const { return fChi2perNDF; }
134 :
135 : UShort_t GetTPCnclsS(Int_t i0=0,Int_t i1=159) const {
136 0 : UShort_t cl = fTPCSharedMap.CountBits(i0)-fTPCSharedMap.CountBits(i1);
137 0 : return cl;
138 : }
139 :
140 : UShort_t GetTPCncls(Int_t i0=0,Int_t i1=159) const {
141 0 : UShort_t cl = fTPCFitMap.CountBits(i0)-fTPCFitMap.CountBits(i1);
142 0 : if(cl==0)cl = fTPCClusterMap.CountBits(i0)-fTPCClusterMap.CountBits(i1);// backward compatibility
143 0 : return cl;
144 : }
145 :
146 0 : UShort_t GetTPCNcls() const { return GetTPCncls(); }
147 :
148 : Int_t GetNcls(Int_t idet) const;
149 :
150 0 : virtual Double_t M() const { return M(GetMostProbablePID()); }
151 : Double_t M(AODTrkPID_t pid) const;
152 0 : virtual Double_t E() const { return E(GetMostProbablePID()); }
153 : Double_t E(AODTrkPID_t pid) const;
154 0 : Double_t E(Double_t m) const { return TMath::Sqrt(P()*P() + m*m); }
155 0 : virtual Double_t Y() const { return Y(GetMostProbablePID()); }
156 : Double_t Y(AODTrkPID_t pid) const;
157 : Double_t Y(Double_t m) const;
158 :
159 28 : virtual Double_t Eta() const { return -TMath::Log(TMath::Tan(0.5 * fMomentum[2])); }
160 :
161 822 : virtual Short_t Charge() const {return fCharge; }
162 :
163 : virtual Bool_t PropagateToDCA(const AliVVertex *vtx,
164 : Double_t b, Double_t maxd, Double_t dz[2], Double_t covar[3]);
165 :
166 : // PID
167 274 : virtual const Double_t *PID() const { return fPID; }
168 : AODTrkPID_t GetMostProbablePID() const;
169 : void ConvertAliPIDtoAODPID();
170 240 : void SetDetPID(AliAODPid *aodpid) {fDetPid = aodpid;}
171 :
172 274 : void SetPIDForTracking(Int_t pid) {fPIDForTracking = pid;}
173 0 : Int_t GetPIDForTracking() const {return fPIDForTracking;}
174 : Double_t GetMassForTracking() const;
175 :
176 : template <typename T> void GetPID(T *pid) const {
177 : for(Int_t i=0; i<10; ++i) pid[i] = fPID ? fPID[i]:0;}
178 :
179 : template <typename T> void SetPID(const T *pid) {
180 0 : if (pid) {
181 0 : if (!fPID) fPID = new Double32_t[10];
182 0 : for(Int_t i=0; i<10; ++i) fPID[i]=pid[i];
183 0 : }
184 0 : else {delete[] fPID; fPID = 0;}
185 0 : }
186 :
187 0 : Bool_t IsOn(Int_t mask) const {return (fFlags&mask)>0;}
188 0 : ULong_t GetStatus() const { return GetFlags(); }
189 0 : ULong_t GetFlags() const { return fFlags; }
190 :
191 0 : Int_t GetID() const { return (Int_t)fID; }
192 260 : Int_t GetLabel() const { return fLabel; }
193 : void GetTOFLabel(Int_t *p) const;
194 :
195 :
196 0 : Char_t GetType() const { return fType;}
197 : Bool_t IsPrimaryCandidate() const;
198 0 : Bool_t GetUsedForVtxFit() const { return TestBit(kUsedForVtxFit); }
199 0 : Bool_t GetUsedForPrimVtxFit() const { return TestBit(kUsedForPrimVtxFit); }
200 :
201 0 : Bool_t IsHybridGlobalConstrainedGlobal() const { return TestBit(kIsHybridGCG); }
202 0 : Bool_t IsHybridTPCConstrainedGlobal() const { return TestBit(kIsHybridTPCCG); }
203 0 : Bool_t IsTPCOnly() const { return IsTPCConstrained(); } // obsolete bad naming
204 0 : Bool_t IsTPCConstrained() const { return TestBit(kIsTPCConstrained); }
205 0 : Bool_t IsGlobalConstrained() const { return TestBit(kIsGlobalConstrained); }
206 : //
207 : Int_t GetTOFBunchCrossing(Double_t b=0, Bool_t tpcPIDonly=kFALSE) const;
208 : //
209 : using AliVTrack::GetP;
210 : template <typename T> void GetP(T *p) const {
211 0 : p[0]=fMomentum[0]; p[1]=fMomentum[1]; p[2]=fMomentum[2];}
212 :
213 : // template <typename T> void GetPxPyPz(T *p) const {
214 : // p[0] = Px(); p[1] = Py(); p[2] = Pz();}
215 : Bool_t GetPxPyPz(Double_t *p) const;
216 :
217 : template <typename T> Bool_t GetPosition(T *x) const {
218 0 : x[0]=fPosition[0]; x[1]=fPosition[1]; x[2]=fPosition[2];
219 0 : return TestBit(kIsDCA);}
220 :
221 : template <typename T> void SetCovMatrix(const T *covMatrix) {
222 484 : if(!fCovMatrix) fCovMatrix=new AliAODRedCov<6>();
223 121 : fCovMatrix->SetCovMatrix(covMatrix);}
224 :
225 : template <typename T> Bool_t GetCovMatrix(T *covMatrix) const {
226 0 : if(!fCovMatrix) return kFALSE;
227 0 : fCovMatrix->GetCovMatrix(covMatrix); return kTRUE;}
228 :
229 : Bool_t GetXYZ(Double_t *p) const {
230 0 : return GetPosition(p); }
231 :
232 : Bool_t GetXYZAt(Double_t x, Double_t b, Double_t *r) const;
233 : Bool_t GetXYZatR(Double_t xr,Double_t bz, Double_t *xyz=0, Double_t* alpSect=0) const;
234 :
235 : Bool_t GetCovarianceXYZPxPyPz(Double_t cv[21]) const {
236 0 : return GetCovMatrix(cv);}
237 :
238 0 : void RemoveCovMatrix() {delete fCovMatrix; fCovMatrix=NULL;}
239 :
240 0 : Double_t XAtDCA() const { return fPositionAtDCA[0]; } //makes sense only for constrained tracks, returns dummy values for all other tracks
241 0 : Double_t YAtDCA() const { return fPositionAtDCA[1]; } //makes sense only for constrained tracks, returns dummy values for all other tracks
242 : Double_t ZAtDCA() const {
243 0 : if (IsMuonTrack()) return fPosition[2];
244 0 : else if (TestBit(kIsDCA)) return fPosition[1];
245 0 : else return -999.; } //makes sense only for constrained tracks, returns dummy values for all other tracks
246 0 : Bool_t XYZAtDCA(Double_t x[3]) const { x[0] = XAtDCA(); x[1] = YAtDCA(); x[2] = ZAtDCA(); return kTRUE; }
247 :
248 : Double_t DCA() const {
249 0 : if (IsMuonTrack()) return TMath::Sqrt(XAtDCA()*XAtDCA() + YAtDCA()*YAtDCA());
250 0 : else if (TestBit(kIsDCA)) return fPosition[0];
251 0 : else return -999.; }
252 :
253 0 : Double_t PxAtDCA() const { return fMomentumAtDCA[0]; } //makes sense only for constrained tracks, returns dummy values for all other tracks
254 0 : Double_t PyAtDCA() const { return fMomentumAtDCA[1]; } //makes sense only for constrained tracks, returns dummy values for all other tracks
255 0 : Double_t PzAtDCA() const { return fMomentumAtDCA[2]; } //makes sense only for constrained tracks, returns dummy values for all other tracks
256 0 : Double_t PAtDCA() const { return TMath::Sqrt(PxAtDCA()*PxAtDCA() + PyAtDCA()*PyAtDCA() + PzAtDCA()*PzAtDCA()); }
257 0 : Bool_t PxPyPzAtDCA(Double_t p[3]) const { p[0] = PxAtDCA(); p[1] = PyAtDCA(); p[2] = PzAtDCA(); return kTRUE; }
258 :
259 0 : Double_t GetRAtAbsorberEnd() const { return fRAtAbsorberEnd; }
260 :
261 0 : Double_t GetITSchi2() const {return fITSchi2;}
262 0 : UChar_t GetITSClusterMap() const { return (UChar_t)(fITSMuonClusterMap&0xff); }
263 0 : UChar_t GetITSSharedClusterMap() const { return (UChar_t)((fITSMuonClusterMap&0xff00)>>8); }
264 : Int_t GetITSNcls() const;
265 0 : Bool_t HasPointOnITSLayer(Int_t i) const { return TESTBIT(GetITSClusterMap(),i); }
266 0 : Bool_t HasSharedPointOnITSLayer(Int_t i) const { return TESTBIT(GetITSSharedClusterMap(),i); }
267 274 : UInt_t GetMUONClusterMap() const { return (fITSMuonClusterMap&0x3ff0000)>>16; }
268 0 : UInt_t GetITSMUONClusterMap() const { return fITSMuonClusterMap; }
269 :
270 0 : Bool_t TestFilterBit(UInt_t filterBit) const {return (Bool_t) ((filterBit & fFilterMap) != 0);}
271 0 : Bool_t TestFilterMask(UInt_t filterMask) const {return (Bool_t) ((filterMask & fFilterMap) == filterMask);}
272 0 : void SetFilterMap(UInt_t i){fFilterMap = i;}
273 0 : UInt_t GetFilterMap() const {return fFilterMap;}
274 :
275 0 : const TBits& GetTPCClusterMap() const {return fTPCClusterMap;}
276 0 : const TBits* GetTPCClusterMapPtr() const {return &fTPCClusterMap;}
277 0 : const TBits& GetTPCFitMap() const {return fTPCFitMap;}
278 0 : const TBits* GetTPCFitMapPtr() const {return &fTPCFitMap;}
279 : Float_t GetTPCClusterInfo(Int_t nNeighbours=3, Int_t type=0, Int_t row0=0, Int_t row1=159, Int_t /*type*/=0) const;
280 :
281 0 : const TBits& GetTPCSharedMap() const {return fTPCSharedMap;}
282 0 : const TBits* GetTPCSharedMapPtr() const {return &fTPCSharedMap;}
283 242 : void SetTPCClusterMap(const TBits amap) {fTPCClusterMap = amap;}
284 242 : void SetTPCSharedMap(const TBits amap) {fTPCSharedMap = amap;}
285 242 : void SetTPCFitMap(const TBits amap) {fTPCFitMap = amap;}
286 242 : void SetTPCPointsF(UShort_t findable){fTPCnclsF = findable;}
287 242 : void SetTPCNCrossedRows(UInt_t n) {fTPCNCrossedRows = n;}
288 :
289 0 : virtual const AliExternalTrackParam * GetInnerParam() const { return NULL; }
290 0 : virtual const AliExternalTrackParam * GetOuterParam() const { return NULL; }
291 :
292 0 : UShort_t GetTPCNclsF() const { return fTPCnclsF;}
293 0 : UShort_t GetTPCNCrossedRows() const { return fTPCNCrossedRows;}
294 0 : Float_t GetTPCCrossedRows() const {return (Float_t) GetTPCNCrossedRows();}
295 0 : Float_t GetTPCFoundFraction() const { return fTPCNCrossedRows>0 ? float(GetTPCNcls())/fTPCNCrossedRows : 0;}
296 :
297 : // Calorimeter Cluster
298 0 : Int_t GetEMCALcluster() const {return fCaloIndex;}
299 36 : void SetEMCALcluster(Int_t index) {fCaloIndex=index;}
300 0 : Bool_t IsEMCAL() const {return fFlags&kEMCALmatch;}
301 :
302 0 : Double_t GetTrackPhiOnEMCal() const {return fTrackPhiOnEMCal;}
303 0 : Double_t GetTrackEtaOnEMCal() const {return fTrackEtaOnEMCal;}
304 0 : Double_t GetTrackPtOnEMCal() const {return fTrackPtOnEMCal;}
305 0 : Double_t GetTrackPOnEMCal() const {return TMath::Abs(fTrackEtaOnEMCal) < 1 ? fTrackPtOnEMCal*TMath::CosH(fTrackEtaOnEMCal) : -999;}
306 242 : void SetTrackPhiEtaPtOnEMCal(Double_t phi,Double_t eta,Double_t pt) {fTrackPhiOnEMCal=phi;fTrackEtaOnEMCal=eta;fTrackPtOnEMCal=pt;}
307 :
308 0 : Int_t GetPHOScluster() const {return fCaloIndex;}
309 8 : void SetPHOScluster(Int_t index) {fCaloIndex=index;}
310 0 : Bool_t IsPHOS() const {return fFlags&kPHOSmatch;}
311 :
312 : //pid signal interface
313 0 : Double_t GetITSsignal() const { return fDetPid?fDetPid->GetITSsignal():0.; }
314 : void GetITSdEdxSamples(Double_t s[4]) const;
315 0 : Double_t GetITSsignalTunedOnData() const {return fITSsignalTuned ;}
316 0 : void SetITSsignalTunedOnData(Double_t signal) {fITSsignalTuned = signal;}
317 0 : Double_t GetTPCsignal() const { return fDetPid?fDetPid->GetTPCsignal():0.; }
318 0 : Double_t GetTPCsignalTunedOnData() const { return fTPCsignalTuned;}
319 0 : void SetTPCsignalTunedOnData(Double_t signal) {fTPCsignalTuned = signal;}
320 0 : UShort_t GetTPCsignalN() const { return fDetPid?fDetPid->GetTPCsignalN():0; }
321 0 : virtual AliTPCdEdxInfo* GetTPCdEdxInfo() const {return fDetPid?fDetPid->GetTPCdEdxInfo():0;}
322 0 : Double_t GetTPCmomentum() const { return fDetPid?fDetPid->GetTPCmomentum():0.; }
323 0 : Double_t GetTPCTgl() const { return fDetPid?fDetPid->GetTPCTgl():0.; }
324 0 : Double_t GetTOFsignal() const { return fDetPid?fDetPid->GetTOFsignal():0.; }
325 0 : Double_t GetIntegratedLength() const { return fTrackLength;}
326 242 : void SetIntegratedLength(Double_t l) {fTrackLength = l;}
327 0 : Double_t GetTOFsignalTunedOnData() const { return fTOFsignalTuned;}
328 0 : void SetTOFsignalTunedOnData(Double_t signal) {fTOFsignalTuned = signal;}
329 : Double_t GetHMPIDsignal() const;
330 : Double_t GetHMPIDoccupancy() const;
331 :
332 : Int_t GetHMPIDcluIdx() const;
333 :
334 : void GetHMPIDtrk(Float_t &x, Float_t &y, Float_t &th, Float_t &ph) const;
335 : void GetHMPIDmip(Float_t &x,Float_t &y,Int_t &q,Int_t &nph) const;
336 :
337 : Bool_t GetOuterHmpPxPyPz(Double_t *p) const;
338 :
339 0 : void GetIntegratedTimes(Double_t *times, Int_t nspec=AliPID::kSPECIES) const {if (fDetPid) fDetPid->GetIntegratedTimes(times, nspec);}
340 : Double_t GetTRDslice(Int_t plane, Int_t slice) const;
341 0 : Double_t GetTRDsignal() const {return fDetPid ? fDetPid->GetTRDsignal() : 0;}
342 : Double_t GetTRDmomentum(Int_t plane, Double_t */*sp*/=0x0) const;
343 0 : Double_t GetTRDchi2() const {return fDetPid ? fDetPid->GetTRDChi2() : -1;}
344 : UChar_t GetTRDncls(Int_t layer) const;
345 0 : UChar_t GetTRDncls() const {return GetTRDncls(-1);}
346 : UChar_t GetTRDntrackletsPID() const;
347 0 : Int_t GetNumberOfTRDslices() const { return fDetPid?fDetPid->GetTRDnSlices():0; }
348 0 : void GetHMPIDpid(Double_t */*p*/) const { return; } // TODO: To be implemented properly with the new HMPID object
349 :
350 0 : void SetMFTClusterPattern(ULong_t mftClusterPattern) { fMFTClusterPattern = mftClusterPattern; } // AU
351 0 : ULong_t GetMFTClusterPattern() { return fMFTClusterPattern; } // AU
352 :
353 0 : const AliAODEvent* GetAODEvent() const {return fAODEvent;}
354 0 : virtual const AliVEvent* GetEvent() const {return (AliVEvent*)fAODEvent;}
355 242 : void SetAODEvent(const AliAODEvent* ptr){fAODEvent = ptr;}
356 : const AliTOFHeader* GetTOFHeader() const;
357 :
358 240 : AliAODPid *GetDetPid() const { return fDetPid; }
359 0 : AliAODVertex *GetProdVertex() const { return (AliAODVertex*)fProdVertex.GetObject(); }
360 :
361 : // print
362 : void Print(const Option_t *opt = "") const;
363 :
364 : // setters
365 242 : void SetFlags(ULong_t flags) { fFlags = flags; }
366 0 : void SetStatus(ULong_t flags) { fFlags|=flags; }
367 0 : void ResetStatus(ULong_t flags) { fFlags&=~flags; }
368 :
369 0 : void SetID(Short_t id) { fID = id; }
370 122 : void SetLabel(Int_t label) { fLabel = label; }
371 : void SetTOFLabel(const Int_t* p);
372 : template <typename T> void SetPosition(const T *x, Bool_t isDCA = kFALSE);
373 : template <typename T> void SetP(const T *p, const Bool_t cartesian);
374 : void SetDCA(Double_t d, Double_t z);
375 411 : void SetUsedForVtxFit(Bool_t used = kTRUE) { used ? SetBit(kUsedForVtxFit) : ResetBit(kUsedForVtxFit); }
376 411 : void SetUsedForPrimVtxFit(Bool_t used = kTRUE) { used ? SetBit(kUsedForPrimVtxFit) : ResetBit(kUsedForPrimVtxFit); }
377 :
378 0 : void SetIsTPCOnly(Bool_t b = kTRUE) { SetIsTPCConstrained(b); }// obsolete bad naming
379 :
380 0 : void SetIsTPCConstrained(Bool_t b = kTRUE) { b ? SetBit(kIsTPCConstrained) : ResetBit(kIsTPCConstrained); }
381 0 : void SetIsHybridTPCConstrainedGlobal(Bool_t hybrid = kTRUE) { hybrid ? SetBit(kIsHybridTPCCG) : ResetBit(kIsHybridTPCCG); }
382 :
383 0 : void SetIsGlobalConstrained(Bool_t b = kTRUE) { b ? SetBit(kIsGlobalConstrained) : ResetBit(kIsGlobalConstrained); }
384 0 : void SetIsHybridGlobalConstrainedGlobal(Bool_t hybrid = kTRUE) { hybrid ? SetBit(kIsHybridGCG) : ResetBit(kIsHybridGCG); }
385 :
386 :
387 :
388 0 : void SetOneOverPt(Double_t oneOverPt) { fMomentum[0] = 1. / oneOverPt; }
389 0 : void SetPt(Double_t pt) { fMomentum[0] = pt; };
390 0 : void SetPhi(Double_t phi) { fMomentum[1] = phi; }
391 0 : void SetTheta(Double_t theta) { fMomentum[2] = theta; }
392 4 : void SetP() {fMomentum[0]=fMomentum[1]=fMomentum[2]=-999.;}
393 :
394 278 : void SetXYAtDCA(Double_t x, Double_t y) {fPositionAtDCA[0] = x; fPositionAtDCA[1] = y;}
395 278 : void SetPxPyPzAtDCA(Double_t pX, Double_t pY, Double_t pZ) {fMomentumAtDCA[0] = pX; fMomentumAtDCA[1] = pY; fMomentumAtDCA[2] = pZ;}
396 :
397 0 : void SetRAtAbsorberEnd(Double_t r) { fRAtAbsorberEnd = r; }
398 :
399 0 : void SetCharge(Short_t q) { fCharge = q; }
400 238 : void SetChi2perNDF(Double_t chi2perNDF) { fChi2perNDF = chi2perNDF; }
401 :
402 242 : void SetITSchi2(Double_t ITSchi2) {fITSchi2 = ITSchi2;}
403 274 : void SetITSClusterMap(UChar_t itsClusMap) { fITSMuonClusterMap = (fITSMuonClusterMap&0xffffff00)|(((UInt_t)itsClusMap)&0xff); }
404 242 : void SetITSSharedMap(UChar_t map) { fITSMuonClusterMap = (fITSMuonClusterMap&0xffff00ff)|((((UInt_t)map)&0xff)<<8); }
405 0 : void SetMuonClusterMap(UInt_t muonClusMap) { fITSMuonClusterMap = (fITSMuonClusterMap&0xfc00ffff)|((muonClusMap&0x3ff)<<16); }
406 0 : void SetITSMuonClusterMap(UInt_t itsMuonClusMap) { fITSMuonClusterMap = itsMuonClusMap; }
407 0 : void SetMUONtrigHitsMapTrg(UInt_t muonTrigHitsMap) { fMUONtrigHitsMapTrg = muonTrigHitsMap; }
408 0 : UInt_t GetMUONTrigHitsMapTrg() const { return fMUONtrigHitsMapTrg; }
409 0 : void SetMUONtrigHitsMapTrk(UInt_t muonTrigHitsMap) { fMUONtrigHitsMapTrk = muonTrigHitsMap; }
410 0 : UInt_t GetMUONTrigHitsMapTrk() const { return fMUONtrigHitsMapTrk; }
411 : Int_t GetMuonTrigDevSign() const;
412 :
413 0 : Int_t GetMatchTrigger() const {return fITSMuonClusterMap>>30;}
414 : // 0 Muon track does not match trigger
415 : // 1 Muon track match but does not pass pt cut
416 : // 2 Muon track match Low pt cut
417 : // 3 Muon track match High pt cut
418 : void SetMatchTrigger(Int_t MatchTrigger);
419 0 : Bool_t MatchTrigger() const { return (GetMatchTrigger()>0); } // Muon track matches trigger track
420 0 : Bool_t MatchTriggerLowPt() const { return (GetMatchTrigger()>1); } // Muon track matches trigger track and passes Low pt cut
421 0 : Bool_t MatchTriggerHighPt() const { return (GetMatchTrigger()>2); } // Muon track matches trigger track and passes High pt cut
422 : Bool_t MatchTriggerDigits() const; // Muon track matches trigger digits
423 0 : Double_t GetChi2MatchTrigger() const { return fChi2MatchTrigger;}
424 0 : void SetChi2MatchTrigger(Double_t Chi2MatchTrigger) {fChi2MatchTrigger = Chi2MatchTrigger; }
425 : Bool_t HitsMuonChamber(Int_t MuonChamber, Int_t cathode = -1) const; // Check if track hits Muon chambers
426 427 : Bool_t IsMuonTrack() const { return ( (GetMUONClusterMap()>0) && !fIsMuonGlobalTrack ) ? kTRUE : kFALSE; }
427 :
428 0 : Bool_t IsMuonGlobalTrack() const { return fIsMuonGlobalTrack; } // AU
429 0 : void SetIsMuonGlobalTrack(Bool_t isMuonGlobalTrack) { fIsMuonGlobalTrack = isMuonGlobalTrack; } // AU
430 :
431 0 : void Connected(Bool_t flag) {flag ? SETBIT(fITSMuonClusterMap,26) : CLRBIT(fITSMuonClusterMap,26);}
432 0 : Bool_t IsConnected() const {return TESTBIT(fITSMuonClusterMap,26);}
433 :
434 0 : void SetProdVertex(TObject *vertex) { fProdVertex = vertex; }
435 0 : void SetType(AODTrk_t ttype) { fType=ttype; }
436 :
437 : // Trasient PID object, is owned by the track
438 : virtual void SetDetectorPID(const AliDetectorPID *pid);
439 0 : virtual const AliDetectorPID* GetDetectorPID() const { return fDetectorPID; }
440 :
441 : // Dummy
442 0 : Int_t PdgCode() const {return 0;}
443 :
444 : private :
445 :
446 : // Momentum & position
447 : Double32_t fMomentum[3]; // momemtum stored in pt, phi, theta
448 : Double32_t fPosition[3]; // position of first point on track or dca
449 :
450 : Double32_t fMomentumAtDCA[3]; // momentum (px,py,pz) at DCA
451 : Double32_t fPositionAtDCA[2]; // trasverse position (x,y) at DCA
452 :
453 : Double32_t fRAtAbsorberEnd; // transverse position r at the end of the muon absorber
454 :
455 : Double32_t fChi2perNDF; // chi2/NDF of momentum fit
456 : Double32_t fChi2MatchTrigger; // chi2 of trigger/track matching
457 : Double32_t* fPID; //! [0.,1.,8] pointer to PID object
458 :
459 : Double32_t fITSchi2; // ITS chi2
460 :
461 : ULong_t fFlags; // reconstruction status flags
462 : Int_t fLabel; // track label, points back to MC track
463 : Int_t fTOFLabel[3]; // TOF label
464 : Double32_t fTrackLength; // Track length
465 : UInt_t fITSMuonClusterMap; // map of ITS and muon clusters, one bit per layer
466 : // (ITS: bit 1-8, muon trigger or ITS shared: bit 9-16, muon tracker: bit 17-26, muon match trigger: bit 31-32)
467 : UInt_t fMUONtrigHitsMapTrg; // Muon trigger hits map from trigger
468 : UInt_t fMUONtrigHitsMapTrk; // Muon trigger hits map from tracker track extrapolation
469 : UInt_t fFilterMap; // filter information, one bit per set of cuts
470 :
471 : TBits fTPCFitMap; // Map of clusters, one bit per padrow; if has a cluster on given padrow which is used in the fit
472 : TBits fTPCClusterMap; // Map of clusters, one bit per padrow; 1 if has a cluster on given padrow
473 : TBits fTPCSharedMap; // Map of clusters, one bit per padrow; 1 if has a shared cluster on given padrow
474 :
475 : UShort_t fTPCnclsF; // findable clusters
476 : UShort_t fTPCNCrossedRows; // n crossed rows
477 :
478 : Short_t fID; // unique track ID, points back to the ESD track
479 :
480 : Char_t fCharge; // particle charge
481 : Char_t fType; // Track Type, explanation close to the enum AODTrk_t
482 :
483 : Char_t fPIDForTracking; // pid using for tracking of ESD track
484 :
485 : Int_t fCaloIndex; // index of associated EMCAL/PHOS cluster (AliAODCaloCluster)
486 :
487 :
488 : AliAODRedCov<6> *fCovMatrix; // covariance matrix (x, y, z, px, py, pz)
489 : AliAODPid *fDetPid; // more detailed or detector specific raw pid information
490 : mutable const AliDetectorPID* fDetectorPID; //! transient object to cache calibrated PID information
491 : TRef fProdVertex; // vertex of origin
492 :
493 : Double32_t fTrackPhiOnEMCal; // phi of track after being propagated to the EMCal surface (default r = 440 cm)
494 : Double32_t fTrackEtaOnEMCal; // eta of track after being propagated to the EMCal surface (default r = 440 cm)
495 : Double32_t fTrackPtOnEMCal; // pt of track after being propagated to the EMCal surface (default r = 440 cm)
496 :
497 : Bool_t fIsMuonGlobalTrack; // True if the track is built from the combination of MUON and MFT clusters // AU
498 :
499 : Double32_t fITSsignalTuned; //! ITS signal tuned on data when using MC
500 : Double32_t fTPCsignalTuned; //! TPC signal tuned on data when using MC
501 : Double32_t fTOFsignalTuned; //! TOF signal tuned on data when using MC
502 :
503 : ULong_t fMFTClusterPattern; // Tells us which MFT clusters are contained in the track, and which one is a good one (if MC) // AU
504 :
505 : const AliAODEvent* fAODEvent; //! pointer back to the event the track belongs to
506 :
507 : //---------------------------------------------------------------------------
508 : //--the calibration interface--
509 : //--to be used in online calibration/QA
510 : //--should also be implemented in ESD so it works offline as well
511 : //-----------
512 : virtual Int_t GetTrackParam ( AliExternalTrackParam &p ) const;
513 : virtual Int_t GetTrackParamRefitted ( AliExternalTrackParam &p ) const;
514 : virtual Int_t GetTrackParamIp ( AliExternalTrackParam &p ) const;
515 : virtual Int_t GetTrackParamTPCInner ( AliExternalTrackParam &p ) const;
516 : virtual Int_t GetTrackParamOp ( AliExternalTrackParam &p ) const;
517 : virtual Int_t GetTrackParamCp ( AliExternalTrackParam &p ) const;
518 : virtual Int_t GetTrackParamITSOut ( AliExternalTrackParam &p ) const;
519 0 : Int_t GetNumberOfITSClusters() const { return GetITSNcls();}
520 0 : Int_t GetNumberOfTPCClusters() const { return GetTPCncls();}
521 0 : Int_t GetNumberOfTRDClusters() const { return GetTRDncls();}
522 :
523 212 : ClassDef(AliAODTrack, 25);
524 : };
525 :
526 : inline Bool_t AliAODTrack::IsPrimaryCandidate() const
527 : {
528 : // True of track passes primary particle selection (independent of type)
529 : //
530 0 : if (fFilterMap) {
531 0 : return kTRUE;
532 : } else {
533 0 : return kFALSE;
534 : }
535 0 : }
536 :
537 : inline Int_t AliAODTrack::GetITSNcls() const
538 : {
539 : // Number of points in ITS
540 : Int_t n=0;
541 0 : for(Int_t i=0;i<6;i++) if(HasPointOnITSLayer(i)) n++;
542 0 : return n;
543 : }
544 :
545 : //______________________________________________________________________________
546 : template <typename T>
547 : void AliAODTrack::SetPosition(const T *x, const Bool_t dca)
548 : {
549 : // set the position
550 :
551 139 : if (x) {
552 274 : if (!dca) {
553 137 : ResetBit(kIsDCA);
554 :
555 137 : fPosition[0] = x[0];
556 137 : fPosition[1] = x[1];
557 137 : fPosition[2] = x[2];
558 137 : } else {
559 137 : SetBit(kIsDCA);
560 : // don't know any better yet
561 0 : fPosition[0] = -999.;
562 0 : fPosition[1] = -999.;
563 0 : fPosition[2] = -999.;
564 : }
565 : } else {
566 2 : ResetBit(kIsDCA);
567 :
568 2 : fPosition[0] = -999.;
569 2 : fPosition[1] = -999.;
570 2 : fPosition[2] = -999.;
571 : }
572 139 : }
573 :
574 :
575 : //______________________________________________________________________________
576 : template <typename T> void AliAODTrack::SetP(const T *p, const Bool_t cartesian)
577 : {
578 : // Set the momentum
579 :
580 137 : if (p) {
581 137 : if (cartesian) {
582 137 : Double_t pt2 = p[0]*p[0] + p[1]*p[1];
583 137 : Double_t pp = TMath::Sqrt(pt2 + p[2]*p[2]);
584 :
585 137 : fMomentum[0] = TMath::Sqrt(pt2); // pt
586 411 : fMomentum[1] = (pt2 != 0.) ? TMath::Pi()+TMath::ATan2(-p[1], -p[0]) : -999; // phi
587 411 : fMomentum[2] = (pp != 0.) ? TMath::ACos(p[2] / pp) : -999.; // theta
588 137 : } else {
589 0 : fMomentum[0] = p[0]; // pt
590 0 : fMomentum[1] = p[1]; // phi
591 0 : fMomentum[2] = p[2]; // theta
592 : }
593 : } else {
594 0 : fMomentum[0] = -999.;
595 0 : fMomentum[1] = -999.;
596 0 : fMomentum[2] = -999.;
597 : }
598 137 : }
599 :
600 :
601 : //template<> void AliAODTrack::SetPosition(const double *, Bool_t);
602 :
603 : #endif
|