1 #ifndef ALIFLATESDTRACK_H
2 #define ALIFLATESDTRACK_H
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 */
9 * See implementation file for documentation
13 Cp - Track parameters constrained to the primary vertex
14 Ip - Track parameters estimated at the inner wall of TPC
15 TPCInner - Track parameters estimated at the inner wall of TPC using the TPC stand-alone
16 Op - Track parameters estimated at the point of maximal radial coordinate reached during the tracking
21 #include "AliVVtrack.h"
22 #include "AliFlatExternalTrackParam.h"
25 class AliExternalTrackParam;
27 class AliFlatESDTrack :public AliVVtrack {
29 // --------------------------------------------------------------------------------
30 // -- Constructor / Destructors
35 // constructor and method for reinitialisation of virtual table
36 AliFlatESDTrack( AliVConstructorReinitialisationFlag );
37 void Reinitialize() { new (this) AliFlatESDTrack( AliVReinitialize ); }
39 // -------------------- AliVVtrack interface ---------------------------------
41 Int_t GetTrackParam ( AliExternalTrackParam &p ) const { return GetExternalTrackParam( p, 0x0 ); }
42 Int_t GetTrackParamRefitted ( AliExternalTrackParam &p ) const { return GetExternalTrackParam( p, 0x1 ); }
43 Int_t GetTrackParamIp ( AliExternalTrackParam &p ) const { return GetExternalTrackParam( p, 0x2 ); }
44 Int_t GetTrackParamTPCInner ( AliExternalTrackParam &p ) const { return GetExternalTrackParam( p, 0x4 ); }
45 Int_t GetTrackParamOp ( AliExternalTrackParam &p ) const { return GetExternalTrackParam( p, 0x8 ); }
46 Int_t GetTrackParamCp ( AliExternalTrackParam &p ) const { return GetExternalTrackParam( p, 0x10 ); }
47 Int_t GetTrackParamITSOut ( AliExternalTrackParam &p ) const { return GetExternalTrackParam( p, 0x20 ); }
49 UShort_t GetTPCNcls() const {return GetNumberOfTPCClusters(); }
50 Double_t GetPt() const {
51 const AliFlatExternalTrackParam *f = GetFlatTrackParam();
52 return (f) ?f->GetPt() : kVeryBig;
56 // --------------------------------------------------------------------------------
60 Int_t SetFromESDTrack( const AliESDtrack* track );
62 Int_t SetExternalTrackParam(
63 const AliExternalTrackParam* refittedParam,
64 const AliExternalTrackParam* innerParam,
65 const AliExternalTrackParam* innerTPC,
66 const AliExternalTrackParam* outerParam,
67 const AliExternalTrackParam* constrainedParam,
68 const AliExternalTrackParam* outerITSParam
71 void SetNumberOfTPCClusters( Int_t nCl ) { fNTPCClusters = nCl; }
72 void SetNumberOfITSClusters( Int_t nCl ) { fNITSClusters = nCl; }
75 // --------------------------------------------------------------------------------
78 const AliFlatExternalTrackParam* GetFlatTrackParam() const { return GetFlatParam( 0x0 ); }
79 const AliFlatExternalTrackParam* GetFlatTrackParamRefitted() const { return GetFlatParam( 0x1 ); }
80 const AliFlatExternalTrackParam* GetFlatTrackParamIp() const { return GetFlatParam( 0x2 ); }
81 const AliFlatExternalTrackParam* GetFlatTrackParamTPCInner() const { return GetFlatParam( 0x4 ); }
82 const AliFlatExternalTrackParam* GetFlatTrackParamOp() const { return GetFlatParam( 0x8 ); }
83 const AliFlatExternalTrackParam* GetFlatTrackParamCp() const { return GetFlatParam( 0x10 ); }
84 const AliFlatExternalTrackParam* GetFlatTrackParamITSOut() const { return GetFlatParam( 0x20 ); }
86 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
88 Int_t GetNumberOfTPCClusters() const { return fNTPCClusters; }
89 Int_t GetNumberOfITSClusters() const { return fNITSClusters; }
91 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
93 const AliFlatESDTrack *GetNextTrack() const { return reinterpret_cast<const AliFlatESDTrack*>(fContent+fContentSize); }
94 AliFlatESDTrack *GetNextTrackNonConst() { return reinterpret_cast<AliFlatESDTrack*>(fContent+fContentSize); }
96 // --------------------------------------------------------------------------------
99 static size_t EstimateSize(){
100 return sizeof(AliFlatESDTrack) + 6*sizeof(AliFlatExternalTrackParam);
103 size_t GetSize() { return fContent - reinterpret_cast<Byte_t*>(this) + fContentSize; }
107 AliFlatESDTrack(const AliFlatESDTrack&);
108 AliFlatESDTrack& operator=(const AliFlatESDTrack&);
110 const AliFlatExternalTrackParam* GetFlatParam( UShort_t flag ) const {
111 if( flag==0 ) return ( fTrackParamMask ) ? reinterpret_cast<const AliFlatExternalTrackParam*>(fContent) : NULL;
112 else return (fTrackParamMask & flag) ? reinterpret_cast<const AliFlatExternalTrackParam*>(fContent) + CountBits(fTrackParamMask, flag-1) : NULL;
115 Int_t GetExternalTrackParam( AliExternalTrackParam &p, UShort_t flag ) const;
117 Int_t FillExternalTrackParam(const AliExternalTrackParam* param, UShort_t flag);
119 static UInt_t CountBits(Byte_t field, UInt_t mask = 0xFFFFFFFF);
121 // --------------------------------------------------------------------------------
122 // -- Fixed size member objects
123 // -> Try to align in memory
125 Byte_t fTrackParamMask; // Bit mask specfifying which ExternalTrackParam are present
126 Int_t fNTPCClusters; // Number of TPC clusters in track
127 Int_t fNITSClusters; // Number of ITS clusters in track
130 ULong64_t fContentSize; // Size of this object
132 // --------------------------------------------------------------------------------
133 // -- Variable Size Object
134 Byte_t fContent[1]; // Variale size object, which contains all data
138 inline UInt_t AliFlatESDTrack::CountBits(Byte_t field, UInt_t mask) {
139 // Count bits in field
140 UInt_t count = 0, reg = field & mask;
141 for (; reg; count++) reg &= reg - 1;
145 inline Int_t AliFlatESDTrack::GetExternalTrackParam( AliExternalTrackParam &p, UShort_t flag) const
147 // Get external track parameters
148 const AliFlatExternalTrackParam *f = GetFlatParam ( flag );
150 Float_t par[5] = { f->GetY(), f->GetZ(), f->GetSnp(), f->GetTgl(), f->GetSigned1Pt() };
151 p.Set( f->GetX(), f->GetAlpha(), par, f->GetCov() );