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