compile warning fix: fix return values.
[u/mrichter/AliRoot.git] / HLT / global / AliFlatESDTrack.h
CommitLineData
251a2c81 1#ifndef ALIFLATESDTRACK_H
2#define ALIFLATESDTRACK_H
3
4/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice *
6 * Primary Authors : Sergey Gorbunov, Jochen Thaeder, Chiara Zampolli */
7
8/*
9 * See implementation file for documentation
10 */
11
12/*
13Cp - Track parameters constrained to the primary vertex
14Ip - Track parameters estimated at the inner wall of TPC
15TPCInner - Track parameters estimated at the inner wall of TPC using the TPC stand-alone
16Op - Track parameters estimated at the point of maximal radial coordinate reached during the tracking
17*/
18
19#include "Rtypes.h"
1f516476 20#include "AliVMisc.h"
120da37b 21#include "AliVParticle.h"
251a2c81 22#include "AliFlatExternalTrackParam.h"
23
24class AliESDtrack;
251a2c81 25class AliExternalTrackParam;
120da37b 26class AliFlatESDTrack;
251a2c81 27
120da37b 28class AliFlatESDTrack :public AliVTrack {
251a2c81 29 public:
30 // --------------------------------------------------------------------------------
31 // -- Constructor / Destructors
888585e5 32
33 AliFlatESDTrack();
120da37b 34 virtual ~AliFlatESDTrack() {}
251a2c81 35
c2ea967e 36 // constructor and method for reinitialisation of virtual table
1f516476 37 AliFlatESDTrack( AliVConstructorReinitialisationFlag );
38 void Reinitialize() { new (this) AliFlatESDTrack( AliVReinitialize ); }
c2ea967e 39
0d577a2c 40 // --------------------------------------------------------------------------------
41
888585e5 42 // -- Set methods
43
0d577a2c 44 Int_t SetFromESDTrack( const AliESDtrack* track );
888585e5 45
46 Int_t SetExternalTrackParam(
47 const AliExternalTrackParam* refittedParam,
48 const AliExternalTrackParam* innerParam,
49 const AliExternalTrackParam* innerTPC,
50 const AliExternalTrackParam* outerParam,
51 const AliExternalTrackParam* constrainedParam,
52 const AliExternalTrackParam* outerITSParam
53 );
251a2c81 54
c5baab86 55 void SetNumberOfTPCClusters( Int_t nCl ) { fNTPCClusters = nCl; }
251a2c81 56 void SetNumberOfITSClusters( Int_t nCl ) { fNITSClusters = nCl; }
57
251a2c81 58
59 // --------------------------------------------------------------------------------
60 // -- Getter methods
251a2c81 61
0d577a2c 62 const AliFlatExternalTrackParam* GetFlatTrackParam() const { return GetFlatParam( 0x0 ); }
63 const AliFlatExternalTrackParam* GetFlatTrackParamRefitted() const { return GetFlatParam( 0x1 ); }
64 const AliFlatExternalTrackParam* GetFlatTrackParamIp() const { return GetFlatParam( 0x2 ); }
65 const AliFlatExternalTrackParam* GetFlatTrackParamTPCInner() const { return GetFlatParam( 0x4 ); }
66 const AliFlatExternalTrackParam* GetFlatTrackParamOp() const { return GetFlatParam( 0x8 ); }
67 const AliFlatExternalTrackParam* GetFlatTrackParamCp() const { return GetFlatParam( 0x10 ); }
68 const AliFlatExternalTrackParam* GetFlatTrackParamITSOut() const { return GetFlatParam( 0x20 ); }
251a2c81 69
70 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
71
0d577a2c 72 Int_t GetNumberOfTPCClusters() const { return fNTPCClusters; }
73 Int_t GetNumberOfITSClusters() const { return fNITSClusters; }
888585e5 74
251a2c81 75 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
76
c2ea967e 77 const AliFlatESDTrack *GetNextTrack() const { return reinterpret_cast<const AliFlatESDTrack*>(fContent+fContentSize); }
78 AliFlatESDTrack *GetNextTrackNonConst() { return reinterpret_cast<AliFlatESDTrack*>(fContent+fContentSize); }
79
251a2c81 80 // --------------------------------------------------------------------------------
81 // -- Size methods
888585e5 82
83 static size_t EstimateSize(){
84 return sizeof(AliFlatESDTrack) + 6*sizeof(AliFlatExternalTrackParam);
85 }
86
48ec9ee6 87 size_t GetSize() const { return fContent - reinterpret_cast<const Byte_t*>(this) + fContentSize; }
6a33e0e9 88
f377397b 89 // -------------------------------------------------------------------------------
90 // the calibration interface methods:
91 Int_t GetTrackParam ( AliExternalTrackParam &p ) const { return GetExternalTrackParam( p, 0x0 ); }
92 Int_t GetTrackParamRefitted ( AliExternalTrackParam &p ) const { return GetExternalTrackParam( p, 0x1 ); }
93 Int_t GetTrackParamIp ( AliExternalTrackParam &p ) const { return GetExternalTrackParam( p, 0x2 ); }
94 Int_t GetTrackParamTPCInner ( AliExternalTrackParam &p ) const { return GetExternalTrackParam( p, 0x4 ); }
95 Int_t GetTrackParamOp ( AliExternalTrackParam &p ) const { return GetExternalTrackParam( p, 0x8 ); }
96 Int_t GetTrackParamCp ( AliExternalTrackParam &p ) const { return GetExternalTrackParam( p, 0x10 ); }
97 Int_t GetTrackParamITSOut ( AliExternalTrackParam &p ) const { return GetExternalTrackParam( p, 0x20 ); }
98 UShort_t GetTPCNcls() const {return GetNumberOfTPCClusters(); }
99 Double_t GetPt() const {
100 const AliFlatExternalTrackParam *f = GetFlatTrackParam();
101 return (f) ?f->GetPt() : kVeryBig;
102 }
ea12701f 103 virtual Bool_t GetXYZ(Double_t *p) const;
f377397b 104 // -------------------------------------------------------------------------------
105
120da37b 106 // ---------------------------------------------------------------------------------
107 // AliVParticle interface
f377397b 108 virtual Double_t Pt() const {const AliFlatExternalTrackParam* p=GetFlatTrackParam(); return (p)?p->GetPt():kVeryBig;}
3740029a 109 virtual Double_t GetTgl() const {const AliFlatExternalTrackParam* p=GetFlatTrackParam(); return (p)?p->GetTgl():kVeryBig;}
87f1f6c8 110 using AliVTrack::GetImpactParameters;
3740029a 111 virtual void GetImpactParameters(Float_t &xy,Float_t &z) const {xy=0.; z=0.;}
120da37b 112 virtual Double_t Px() const {return 0.;}
113 virtual Double_t Py() const {return 0.;}
114 virtual Double_t Pz() const {return 0.;}
120da37b 115 virtual Double_t P() const {return 0.;}
116 virtual Bool_t PxPyPz(Double_t*) const {return kFALSE;}
117 virtual Double_t Xv() const {return 0.;}
118 virtual Double_t Yv() const {return 0.;}
119 virtual Double_t Zv() const {return 0.;}
120 virtual Bool_t XvYvZv(Double_t*) const {return 0.;}
121 virtual Double_t OneOverPt() const {return 0.;}
122 virtual Double_t Phi() const {return 0.;}
123 virtual Double_t Theta() const {return 0.;}
124 virtual Double_t E() const {return 0.;}
125 virtual Double_t M() const {return 0.;}
126 virtual Double_t Eta() const {return 0.;}
127 virtual Double_t Y() const {return 0.;}
9b84baa9 128 virtual Short_t Charge() const {return 0;}
129 virtual Int_t GetLabel() const {return 0;}
130 virtual Int_t PdgCode() const {return 0;}
120da37b 131 virtual const Double_t* PID() const {return NULL;}
9b84baa9 132 virtual Int_t GetID() const {return 0;}
133 virtual UChar_t GetITSClusterMap() const {return 0;}
134 virtual ULong_t GetStatus() const {return 0;}
a7751eb4 135 virtual Bool_t GetCovarianceXYZPxPyPz(Double_t cv[21]) const {if (cv[0]){}; return kFALSE;}
136 virtual Bool_t PropagateToDCA(const AliVVertex* /*vtx*/, Double_t /*b*/, Double_t /*maxd*/, Double_t dz[2], Double_t covar[3]) {if (dz[0]==covar[3]){}; return kFALSE;}
120da37b 137
251a2c81 138 private:
0d577a2c 139
251a2c81 140 AliFlatESDTrack(const AliFlatESDTrack&);
6a33e0e9 141 AliFlatESDTrack& operator=(const AliFlatESDTrack&);
251a2c81 142
0d577a2c 143 const AliFlatExternalTrackParam* GetFlatParam( UShort_t flag ) const {
144 if( flag==0 ) return ( fTrackParamMask ) ? reinterpret_cast<const AliFlatExternalTrackParam*>(fContent) : NULL;
145 else return (fTrackParamMask & flag) ? reinterpret_cast<const AliFlatExternalTrackParam*>(fContent) + CountBits(fTrackParamMask, flag-1) : NULL;
146 }
147
148 Int_t GetExternalTrackParam( AliExternalTrackParam &p, UShort_t flag ) const;
149
251a2c81 150 Int_t FillExternalTrackParam(const AliExternalTrackParam* param, UShort_t flag);
151
888585e5 152 static UInt_t CountBits(Byte_t field, UInt_t mask = 0xFFFFFFFF);
251a2c81 153
154 // --------------------------------------------------------------------------------
155 // -- Fixed size member objects
156 // -> Try to align in memory
157
158 Byte_t fTrackParamMask; // Bit mask specfifying which ExternalTrackParam are present
159 Int_t fNTPCClusters; // Number of TPC clusters in track
160 Int_t fNITSClusters; // Number of ITS clusters in track
161 // Bool_t fMCLabels;
162
888585e5 163 ULong64_t fContentSize; // Size of this object
251a2c81 164
165 // --------------------------------------------------------------------------------
166 // -- Variable Size Object
167 Byte_t fContent[1]; // Variale size object, which contains all data
168
e3d1b1e2 169 ClassDef(AliFlatESDTrack,0)
170
251a2c81 171};
888585e5 172
48ec9ee6 173// _______________________________________________________________________________________________________
174inline AliFlatESDTrack::AliFlatESDTrack() :
48ec9ee6 175 fTrackParamMask(0),
176 fNTPCClusters(0),
177 fNITSClusters(0),
178 fContentSize(0)
179{
180 // Default constructor
181}
182
bbddf50f 183#pragma GCC diagnostic ignored "-Weffc++"
184inline AliFlatESDTrack::AliFlatESDTrack( AliVConstructorReinitialisationFlag f )
185 :
186 AliVTrack(f)
48ec9ee6 187{
188 // Constructor for reinitialisation of vtable
189}
bbddf50f 190#pragma GCC diagnostic warning "-Weffc++"
48ec9ee6 191
888585e5 192inline UInt_t AliFlatESDTrack::CountBits(Byte_t field, UInt_t mask) {
193 // Count bits in field
194 UInt_t count = 0, reg = field & mask;
195 for (; reg; count++) reg &= reg - 1;
196 return count;
197}
198
0d577a2c 199inline Int_t AliFlatESDTrack::GetExternalTrackParam( AliExternalTrackParam &p, UShort_t flag) const
200{
201 // Get external track parameters
202 const AliFlatExternalTrackParam *f = GetFlatParam ( flag );
48ec9ee6 203 if( !f ) return -1;
204 f->GetExternalTrackParam( p );
0d577a2c 205 return 0;
206}
207
208
251a2c81 209#endif