]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/global/AliFlatESDTrack.h
8e76ad1211516894ea637e7cd85b648c9f0a9625
[u/mrichter/AliRoot.git] / HLT / global / AliFlatESDTrack.h
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 /*
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
17 */
18
19 #include "Rtypes.h"
20
21 #include "AliFlatTPCCluster.h"
22 #include "AliFlatExternalTrackParam.h"
23 #include "AliVVtrack.h"
24
25 class AliESDtrack;
26 class AliESDfriendTrack;
27 class AliExternalTrackParam;
28
29 class AliFlatESDTrack: public AliVVtrack {
30 //class AliFlatESDTrack {
31  public:
32   // --------------------------------------------------------------------------------
33   // -- Constructor / Destructors
34   AliFlatESDTrack();   
35   AliFlatESDTrack(Bool_t){}   
36   AliFlatESDTrack(const AliESDtrack* track, AliESDfriendTrack* friendTrack); 
37   ~AliFlatESDTrack();  
38
39   // --------------------------------------------------------------------------------
40   // -- Fill / Set methods
41   Int_t FillExternalTrackParam( 
42                                const AliExternalTrackParam* refittedParam,
43                                const AliExternalTrackParam* innerParam,
44                                const AliExternalTrackParam* innerTPC,
45                                const AliExternalTrackParam* outerParam,
46                                const AliExternalTrackParam* constrainedParam,
47                                const AliExternalTrackParam* outerITSParam
48                              );
49
50   AliFlatTPCCluster *GetNextTPCClusterPointer(){ return GetTPCCluster(fNTPCClusters); }
51
52   void StoreLastTPCCluster(){  
53      ++fNTPCClusters;
54      fSize += sizeof(AliFlatTPCCluster);
55   }
56
57   void SetNumberOfITSClusters( Int_t nCl ) { fNITSClusters = nCl; } 
58
59   Int_t Fill( const AliESDtrack* track, AliESDfriendTrack* friendTrack);
60   
61   // --------------------------------------------------------------------------------
62   // -- Getter methods
63   AliFlatExternalTrackParam* GetTrackParamRefitted(){
64     return (fTrackParamMask & 0x1) ? reinterpret_cast<AliFlatExternalTrackParam*>(fContent) : NULL;
65   } 
66
67   AliFlatExternalTrackParam* GetTrackParamIp() { 
68     return (fTrackParamMask & 0x2) ? reinterpret_cast<AliFlatExternalTrackParam*>(fContent) + CountBits(fTrackParamMask, 0x1) : NULL;
69   } 
70
71   AliFlatExternalTrackParam* GetTrackParamTPCInner() { 
72     return (fTrackParamMask & 0x4) ? reinterpret_cast<AliFlatExternalTrackParam*>(fContent) + CountBits(fTrackParamMask, 0x3) : NULL;
73   } 
74
75   AliFlatExternalTrackParam* GetTrackParamOp() {      
76     return (fTrackParamMask & 0x8) ? reinterpret_cast<AliFlatExternalTrackParam*>(fContent) + CountBits(fTrackParamMask, 0x7) : NULL;
77   } 
78
79   AliFlatExternalTrackParam* GetTrackParamCp() {
80     return (fTrackParamMask & 0x10) ? reinterpret_cast<AliFlatExternalTrackParam*>(fContent) + CountBits(fTrackParamMask, 0xF) : NULL;
81   } 
82
83   AliFlatExternalTrackParam* GetTrackParamITSOut() {
84     return (fTrackParamMask & 0x20) ? reinterpret_cast<AliFlatExternalTrackParam*>(fContent) + CountBits(fTrackParamMask, 0x1F) : NULL;
85   } 
86
87   // --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  
88
89   Int_t GetNumberOfTPCClusters() {
90     return fNTPCClusters;
91   } 
92   
93   AliFlatTPCCluster *GetTPCClusters() {
94     return reinterpret_cast< AliFlatTPCCluster*>(fContent + sizeof(AliFlatExternalTrackParam)*CountBits(fTrackParamMask));
95   } 
96
97
98   
99   AliFlatTPCCluster *GetTPCCluster(Int_t ind) {
100     return  reinterpret_cast< AliFlatTPCCluster*>( GetTPCClusters() ) + ind ;
101   }
102
103   Int_t GetNumberOfITSClusters() {
104     return fNITSClusters;
105   } 
106   
107   
108   // --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  
109   
110   AliFlatESDTrack *GetNextTrack() 
111 {       
112         
113         AliFlatESDTrack * t = reinterpret_cast<AliFlatESDTrack*> (fContent + fSize);
114         new(t)  AliFlatESDTrack(kTRUE);
115         return t;
116 }
117   
118   // --------------------------------------------------------------------------------
119   // -- Size methods
120   static ULong64_t EstimateSize(Bool_t useESDFriends = kTRUE, Int_t nTPCClusters = 160 );
121          ULong64_t GetSize()  {return fContent -  reinterpret_cast<Byte_t*>(this) + fSize;}
122     
123
124  private:
125   AliFlatESDTrack(const AliFlatESDTrack&);
126   AliFlatESDTrack& operator=(const AliFlatESDTrack&);
127
128   Int_t FillExternalTrackParam(const AliExternalTrackParam* param, UShort_t flag);
129
130   UInt_t CountBits(Byte_t field, UInt_t mask = 0xFFFFFFFF);
131  
132   // --------------------------------------------------------------------------------
133   // -- Fixed size member objects
134   //    -> Try to align in memory
135
136   Byte_t   fTrackParamMask;            // Bit mask specfifying which ExternalTrackParam are present
137   Int_t    fNTPCClusters;                 // Number of TPC clusters in track
138   Int_t    fNITSClusters;                 // Number of ITS clusters in track
139   // Bool_t   fMCLabels;
140
141   ULong64_t fSize;                      // Size of this object
142   
143   // --------------------------------------------------------------------------------
144   // -- Variable Size Object
145   Byte_t fContent[1];                  // Variale size object, which contains all data
146
147 };
148 #endif