]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/global/AliFlatESDEvent.h
AliVVexternalTrackParam removed
[u/mrichter/AliRoot.git] / HLT / global / AliFlatESDEvent.h
1 #ifndef ALIFLATESDEVENT_H
2 #define ALIFLATESDEVENT_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 #include "Rtypes.h"
13 #include "AliFlatESDTrack.h"
14 #include "AliFlatESDV0.h"
15 #include "AliVVevent.h"
16 #include "AliFlatESDVertex.h"
17 #include "AliFlatESDMisc.h"
18
19 class AliESDEvent;
20 class AliESDVertex;
21 class AliESDV0;
22 class TString;
23
24 class AliFlatESDEvent: public AliVVevent {
25 //class AliFlatESDEvent {
26  public:
27   // --------------------------------------------------------------------------------
28   // -- Constructor / Destructors
29   AliFlatESDEvent();   
30
31
32   AliFlatESDEvent(AliESDEvent *esd);   
33   AliFlatESDEvent(AliESDEvent *esd, Bool_t useESDFriends);   
34   virtual ~AliFlatESDEvent();  
35
36   // --------------------------------------------------------------------------------
37   // -- Fill / Set methods
38   void Reset();
39
40   Int_t Fill( const AliESDEvent *esd, const Bool_t useESDFriends = kTRUE, const Bool_t fillV0s=kTRUE );
41
42   void FillPrimaryVertices( const AliESDVertex *vertexSPD,
43                             const AliESDVertex *vertexTracks );
44
45  
46   AliFlatESDTrack *GetNextTrackPointer(){ 
47     return reinterpret_cast<AliFlatESDTrack*> (fContent + fSize);
48   }
49
50   void StoreLastTrack(){ 
51     fNTracks++;
52     fSize+= GetNextTrackPointer()->GetSize();
53     fV0Pointer = fSize;
54   }
55
56   AliFlatESDV0 *GetNextV0Pointer(){
57                 return reinterpret_cast<AliFlatESDV0*> (fContent + fSize);
58 }
59
60   void StoreLastV0(){ 
61     fNV0s++;
62     fSize+= sizeof(AliFlatESDV0);
63   }
64
65   // --------------------------------------------------------------------------------
66   // -- Getter methods
67
68    const AliFlatESDVertex* GetPrimaryVertexSPD() const {
69     if (fPrimaryVertexMask & 0x1){
70                  return reinterpret_cast< AliFlatESDVertex*> (const_cast<Byte_t*>(fContent));
71         }
72         else return NULL;
73   } 
74
75   const  AliFlatESDVertex* GetPrimaryVertexTracks() const { 
76     if (fPrimaryVertexMask & 0x2){
77                  return reinterpret_cast< AliFlatESDVertex*> (const_cast<Byte_t*>(fContent)) + CountBits(fPrimaryVertexMask, 0x1);
78         }
79         else return NULL;
80    } 
81
82   Int_t GetNumberOfV0s() const {return fNV0s;}
83
84   Int_t GetNumberOfTracks() const {return fNTracks;}
85   
86   AliFlatESDV0* GetV0stmp() {
87         return reinterpret_cast<AliFlatESDV0*> (fContent + fV0Pointer);
88   }
89   
90   AliFlatESDTrack *GetTracks() {
91                 return reinterpret_cast<AliFlatESDTrack*> (fContent + fTracksPointer);
92   }
93
94   //const AliVVvertex* GetPrimaryVertex() const {return NULL;}
95   //const AliVVvertex* GetPrimaryVertexTPC() const {return NULL;}
96   AliFlatESDTrack* GetTrack(Int_t /*i*/) const {return NULL;}
97   AliVVkink* GetKink(Int_t /*i*/) const {return NULL;}
98   //AliFlatESDV0* GetV0(Int_t /*i*/) const {return NULL;}
99   Int_t GetNumberOfKinks() const {return 0;}
100   Int_t GetEventNumberInFile() const {return -1;}
101   const AliMultiplicity* GetMultiplicity() const {return NULL;} //by default SPDmult
102   Int_t GetRunNumber() const {return -1;}
103   TString GetFiredTriggerClasses() const {TString string; return string;}
104   TObject* FindListObject(const char* /*name*/) const {return NULL;}
105   ULong64_t GetTriggerMask() const {return 0;}
106   Double_t GetMagneticField() const {return 0;}
107   UInt_t GetTimeStamp() const { return 0;}
108   UInt_t GetEventSpecie() const { return 0;}
109   void ReadFromTree(TTree* /*tree*/, Option_t* /*opt*/) {};
110   
111   // --------------------------------------------------------------------------------
112   // -- Size methods
113   static ULong64_t EstimateSize(AliESDEvent*esd, Bool_t useESDFriends = kTRUE, Bool_t fillV0s=kTRUE);
114          ULong64_t GetSize()    {return fContent - reinterpret_cast<Byte_t*>(this) + fSize;}
115
116
117 //
118 // Initializing function
119 //
120 // to be called after event is received via reinterpret_cast from memory
121
122 void Reinitialize();
123
124  private:
125   AliFlatESDEvent(const AliFlatESDEvent&);
126   AliFlatESDEvent& operator=(const AliFlatESDEvent&);
127   
128 // special constructor, to be called by placement new,
129 // when accessing information after reinterpret_cast
130 // so that vtable is generated, but values are not overwritten
131         AliFlatESDEvent(AliFlatESDSpecialConstructorFlag){}
132
133   void FillPrimaryVertex(const AliESDVertex *v, Byte_t flag);
134   Int_t FillNextTrack( const AliESDtrack* esdTrack,  AliESDfriendTrack* friendTrack);
135   Int_t FillNextV0( const AliESDV0 *v0);
136   UInt_t CountBits(Byte_t field, UInt_t mask) const;
137
138   // --------------------------------------------------------------------------------
139   // -- Fixed size member objects
140   //    -> Try to align in memory
141
142   Byte_t   fPrimaryVertexMask;            // Bit mask specfifying which primary vertices are present
143   Int_t    fNTracks;                   // Number of tracks in vector
144   ULong64_t fTracksPointer;            // position of the first track in fContent
145   Int_t fNV0s; // Number of v0's
146   ULong64_t fV0Pointer;            // position of the first V0 in fContent
147
148
149   ULong64_t fSize;                      // Size of this object
150   
151   // --------------------------------------------------------------------------------
152   // -- Variable Size Object
153   Byte_t fContent[1];                  // Variale size object, which contains all data
154   
155 };
156 #endif