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