]>
Commit | Line | Data |
---|---|---|
251a2c81 | 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 | ||
16 | class AliESDEvent; | |
17 | struct AliFlatESDVertex; | |
18 | class AliESDVertex; | |
19 | class AliESDV0; | |
20 | ||
21 | class AliFlatESDEvent { | |
22 | public: | |
23 | // -------------------------------------------------------------------------------- | |
24 | // -- Constructor / Destructors | |
25 | AliFlatESDEvent(); | |
26 | AliFlatESDEvent(AliESDEvent *esd); | |
27 | AliFlatESDEvent(AliESDEvent *esd, Bool_t useESDFriends); | |
28 | ~AliFlatESDEvent(); | |
29 | ||
30 | // -------------------------------------------------------------------------------- | |
31 | // -- Fill / Set methods | |
32 | void Reset(); | |
33 | ||
34 | Int_t Fill( const AliESDEvent *esd, const Bool_t useESDFriends = kTRUE, const Bool_t fillV0s=kTRUE ); | |
35 | ||
36 | void FillPrimaryVertices( const AliESDVertex *vertexSPD, | |
37 | const AliESDVertex *vertexTracks ); | |
38 | ||
39 | ||
40 | AliFlatESDTrack *GetNextTrackPointer(){ return reinterpret_cast<AliFlatESDTrack*>(fContent + fSize); } | |
41 | ||
42 | void StoreLastTrack(){ | |
43 | fNTracks++; | |
44 | fSize+= GetNextTrackPointer()->GetSize(); | |
45 | fV0Pointer = fSize; | |
46 | } | |
47 | ||
48 | AliFlatESDV0 *GetNextV0Pointer(){ return reinterpret_cast<AliFlatESDV0*>(fContent + fSize); } | |
49 | ||
50 | void StoreLastV0(){ | |
51 | fNV0s++; | |
52 | fSize+= sizeof(AliFlatESDV0); | |
53 | } | |
54 | ||
55 | // -------------------------------------------------------------------------------- | |
56 | // -- Getter methods | |
57 | ||
58 | AliFlatESDVertex* GetPrimaryVertexSPD(){ | |
59 | return (fPrimaryVertexMask & 0x1) ? reinterpret_cast<AliFlatESDVertex*>(fContent) : NULL; | |
60 | } | |
61 | ||
62 | AliFlatESDVertex* GetPrimaryVertexTracks() { | |
63 | return (fPrimaryVertexMask & 0x2) ? reinterpret_cast<AliFlatESDVertex*>(fContent + CountBits(fPrimaryVertexMask, 0x1)) : NULL; | |
64 | } | |
65 | ||
66 | Int_t GetNumberOfV0s() {return fNV0s;} | |
67 | ||
68 | Int_t GetNumberOfTracks() {return fNTracks;} | |
69 | ||
70 | AliFlatESDTrack *GetTracks() {return reinterpret_cast<AliFlatESDTrack*>(fContent + fTracksPointer);} | |
71 | ||
72 | // -------------------------------------------------------------------------------- | |
73 | // -- Size methods | |
74 | static ULong64_t EstimateSize(AliESDEvent*esd, Bool_t useESDFriends = kTRUE, Bool_t fillV0s=kTRUE); | |
75 | ULong64_t GetSize() {return fContent - reinterpret_cast<Byte_t*>(this) + fSize;} | |
76 | ||
77 | private: | |
78 | AliFlatESDEvent(const AliFlatESDEvent&); | |
79 | AliFlatESDEvent& operator=(const AliFlatESDEvent&); | |
80 | ||
81 | void FillPrimaryVertex(const AliESDVertex *v, Byte_t flag); | |
82 | Int_t FillNextTrack( const AliESDtrack* esdTrack, AliESDfriendTrack* friendTrack); | |
83 | Int_t FillNextV0( const AliESDV0 *v0); | |
84 | UInt_t CountBits(Byte_t field, UInt_t mask); | |
85 | ||
86 | // -------------------------------------------------------------------------------- | |
87 | // -- Fixed size member objects | |
88 | // -> Try to align in memory | |
89 | ||
90 | Byte_t fPrimaryVertexMask; // Bit mask specfifying which primary vertices are present | |
91 | Int_t fNTracks; // Number of tracks in vector | |
92 | ULong64_t fTracksPointer; // position of the first track in fContent | |
93 | Int_t fNV0s; // Number of v0's | |
94 | ULong64_t fV0Pointer; // position of the first V0 in fContent | |
95 | ||
96 | ||
97 | ULong64_t fSize; // Size of this object | |
98 | ||
99 | // -------------------------------------------------------------------------------- | |
100 | // -- Variable Size Object | |
101 | Byte_t fContent[1]; // Variale size object, which contains all data | |
102 | ||
103 | }; | |
104 | #endif |