]>
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" | |
50ff8c36 | 13 | #include "AliVVevent.h" |
14 | #include "AliFlatESDVertex.h" | |
6a33e0e9 | 15 | |
16 | class AliFlatESDTrack; | |
17 | class AliFlatESDV0; | |
18 | class AliFlatESDTrigger; | |
251a2c81 | 19 | |
20 | class AliESDEvent; | |
251a2c81 | 21 | class AliESDVertex; |
6a33e0e9 | 22 | class AliESDtrack; |
23 | class AliESDfriendTrack; | |
24 | class AliESDv0; | |
251a2c81 | 25 | |
6a33e0e9 | 26 | class AliFlatESDEvent :public AliVVevent { |
251a2c81 | 27 | public: |
28 | // -------------------------------------------------------------------------------- | |
29 | // -- Constructor / Destructors | |
6a33e0e9 | 30 | AliFlatESDEvent(); |
31 | ~AliFlatESDEvent(); | |
32 | ||
33 | // Interface to AliVVEvent | |
34 | ||
35 | void Reset(){} | |
36 | ||
37 | Double_t GetMagneticField() const { return fMagneticField; } | |
38 | UInt_t GetPeriodNumber() const { return fPeriodNumber; } | |
39 | Int_t GetRunNumber() const { return fRunNumber; } | |
40 | UInt_t GetOrbitNumber() const { return fOrbitNumber; } | |
41 | UShort_t GetBunchCrossNumber() const { return fBunchCrossNumber; } | |
42 | UInt_t GetTimeStamp() const { return fTimeStamp; } | |
43 | ULong64_t GetTriggerMask() const { return fTriggerMask; } | |
44 | ||
45 | TString GetFiredTriggerClasses() const { TString s; return s; } //!! | |
46 | UInt_t GetEventSpecie() const { return 0; } //!! | |
47 | ||
48 | Int_t GetNumberOfTracks() const { return fNTracks; } | |
49 | Int_t GetNumberOfV0s() const { return fNV0s; } | |
50 | Int_t GetNumberOfKinks() const { return 0; } | |
488e1434 | 51 | |
6a33e0e9 | 52 | AliVVtrack* GetTrack(Int_t /*i*/) const { return NULL; } |
53 | AliESDkink* GetKink(Int_t /*i*/) const { return NULL;} | |
488e1434 | 54 | |
6a33e0e9 | 55 | void ConnectTracks(){} // initialisation, needed by the ESD event, part of VVevent interface |
251a2c81 | 56 | |
57 | // -------------------------------------------------------------------------------- | |
58 | // -- Fill / Set methods | |
6a33e0e9 | 59 | void Init(); |
251a2c81 | 60 | |
6a33e0e9 | 61 | Int_t FillFromESD( const size_t allocatedMemorySize, const AliESDEvent *esd, const Bool_t useESDFriends = kTRUE, const Bool_t fillV0s=kTRUE ); |
251a2c81 | 62 | |
6a33e0e9 | 63 | void SetMagneticField( Double_t mf ){ fMagneticField = mf; } |
64 | void SetPeriodNumber( Int_t n ) { fPeriodNumber = n; } | |
65 | void SetRunNumber( Int_t n ) { fRunNumber = n; } | |
66 | void SetOrbitNumber( UInt_t n ) { fOrbitNumber = n; } | |
67 | void SetBunchCrossNumber( UShort_t n ) { fBunchCrossNumber = n; } | |
68 | void SetTimeStamp( UInt_t timeStamp ){ fTimeStamp = timeStamp; } | |
69 | void SetTriggerMask(ULong64_t n) { fTriggerMask = n; } | |
70 | ||
71 | AliFlatESDTrigger *FillTriggersStart(); | |
72 | void FillTriggersEnd( Int_t nTriggerClasses, size_t triggersSize ); | |
251a2c81 | 73 | |
6a33e0e9 | 74 | void FillPrimaryVertices( const AliESDVertex *vertexSPD, const AliESDVertex *vertexTracks ); |
75 | ||
76 | AliFlatESDTrack *FillTracksStart(); | |
77 | void FillTracksEnd( Int_t nTracks, size_t tracksSize ); | |
78 | ||
79 | AliFlatESDV0 *FillV0sStart(); | |
80 | void FillV0sEnd( Int_t nV0s, size_t v0sSize ); | |
251a2c81 | 81 | |
251a2c81 | 82 | |
83 | // -------------------------------------------------------------------------------- | |
84 | // -- Getter methods | |
85 | ||
251a2c81 | 86 | |
6a33e0e9 | 87 | const AliFlatESDVertex* GetPrimaryVertexSPD() const ; |
88 | const AliFlatESDVertex* GetPrimaryVertexTracks() const ; | |
251a2c81 | 89 | |
6a33e0e9 | 90 | Int_t GetNumberOfTriggerClasses() const { return fNTriggerClasses; } |
91 | ||
92 | const AliFlatESDTrigger *GetTriggerClasses() const { return reinterpret_cast<const AliFlatESDTrigger*>( fContent + fTriggerPointer ); } | |
93 | const AliFlatESDTrack *GetTracks() const { return reinterpret_cast<const AliFlatESDTrack*>( fContent + fTracksPointer ); } | |
94 | const AliFlatESDV0 *GetV0s() const { return reinterpret_cast<const AliFlatESDV0*>( fContent + fV0Pointer ); } | |
8b15ecc3 | 95 | |
251a2c81 | 96 | // -------------------------------------------------------------------------------- |
97 | // -- Size methods | |
488e1434 | 98 | |
6a33e0e9 | 99 | ULong64_t GetSize() const { return fContent + fContentSize - reinterpret_cast<const Byte_t*>(this); } |
488e1434 | 100 | |
6a33e0e9 | 101 | static ULong64_t EstimateSize(AliESDEvent*esd, Bool_t useESDFriends = kTRUE, Bool_t fillV0s=kTRUE ); |
488e1434 | 102 | |
251a2c81 | 103 | private: |
251a2c81 | 104 | |
6a33e0e9 | 105 | AliFlatESDEvent( const AliFlatESDEvent& ); |
106 | AliFlatESDEvent& operator=( const AliFlatESDEvent& ); | |
107 | ||
108 | Int_t AddTriggerClass( const char *TriggerClassName, Int_t TriggerIndex, ULong64_t MaxSize ); | |
109 | void FillPrimaryVertex(const AliESDVertex *v, Byte_t flag); | |
251a2c81 | 110 | Int_t FillNextTrack( const AliESDtrack* esdTrack, AliESDfriendTrack* friendTrack); |
6a33e0e9 | 111 | Int_t FillNextV0( const AliESDv0 *v0); |
251a2c81 | 112 | |
6a33e0e9 | 113 | const AliFlatESDVertex* GetFirstPrimaryVertex() const ; |
114 | Byte_t *GetEndOfContent(){ return fContent + fContentSize; } | |
251a2c81 | 115 | |
6a33e0e9 | 116 | UInt_t CountBits(Byte_t field, UInt_t mask) const; |
251a2c81 | 117 | |
6a33e0e9 | 118 | // -------------------------------------------------------------------------------- |
251a2c81 | 119 | |
6a33e0e9 | 120 | // -- Fixed size member objects ( try to align in memory ) |
121 | ||
122 | size_t fContentSize; // Size of fContent | |
123 | Double32_t fMagneticField; // Solenoid Magnetic Field in kG : for compatibility with AliMagF | |
124 | UInt_t fPeriodNumber; // PeriodNumber | |
125 | Int_t fRunNumber; // Run Number | |
126 | UInt_t fOrbitNumber; // Orbit Number | |
127 | UInt_t fTimeStamp; // Time stamp | |
128 | UShort_t fBunchCrossNumber; // Bunch Crossing Number | |
129 | Byte_t fPrimaryVertexMask; // Bit mask specfifying which primary vertices are present | |
130 | ULong64_t fTriggerMask; // Trigger mask | |
131 | ||
132 | UInt_t fNTriggerClasses; // N trigger classes | |
133 | UInt_t fNPrimaryVertices; // Number of primary vertices in array | |
134 | UInt_t fNTracks; // Number of tracks in array | |
135 | UInt_t fNV0s; // Number of v0's | |
251a2c81 | 136 | |
6a33e0e9 | 137 | // Pointers to specific data in fContent |
138 | ||
139 | size_t fTriggerPointer; // position of the first trigger description in fContent | |
140 | size_t fPrimaryVertexPointer; // position of the first primary vertex in fContent | |
141 | size_t fTracksPointer; // position of the first track in fContent | |
142 | size_t fV0Pointer; // position of the first V0 in fContent | |
143 | ||
251a2c81 | 144 | // -------------------------------------------------------------------------------- |
6a33e0e9 | 145 | |
251a2c81 | 146 | // -- Variable Size Object |
6a33e0e9 | 147 | |
251a2c81 | 148 | Byte_t fContent[1]; // Variale size object, which contains all data |
149 | ||
150 | }; | |
6a33e0e9 | 151 | |
152 | // Inline implementations | |
153 | ||
154 | inline AliFlatESDTrack *AliFlatESDEvent::FillTracksStart() | |
155 | { | |
156 | fNTracks = 0; | |
157 | fTracksPointer = fContentSize; | |
158 | return reinterpret_cast< AliFlatESDTrack* >( fContent + fContentSize ); | |
159 | } | |
160 | ||
161 | inline void AliFlatESDEvent::FillTracksEnd( Int_t nTracks, size_t tracksSize ) | |
162 | { | |
163 | fNTracks = nTracks; | |
164 | fContentSize += tracksSize; | |
165 | } | |
166 | ||
167 | inline AliFlatESDV0 *AliFlatESDEvent::FillV0sStart() | |
168 | { | |
169 | fNV0s = 0; | |
170 | fV0Pointer = fContentSize; | |
171 | return reinterpret_cast< AliFlatESDV0* >( fContent + fContentSize ); | |
172 | } | |
173 | ||
174 | inline void AliFlatESDEvent::FillV0sEnd( Int_t nV0s, size_t v0sSize ) | |
175 | { | |
176 | fNV0s = nV0s; | |
177 | fContentSize += v0sSize; | |
178 | } | |
179 | ||
180 | inline AliFlatESDTrigger *AliFlatESDEvent::FillTriggersStart() | |
181 | { | |
182 | fNTriggerClasses = 0; | |
183 | fTriggerPointer = fContentSize; | |
184 | return reinterpret_cast< AliFlatESDTrigger* >( fContent + fContentSize ); | |
185 | } | |
186 | ||
187 | inline void AliFlatESDEvent::FillTriggersEnd( Int_t nTriggerClasses, size_t triggersSize ) | |
188 | { | |
189 | fNTriggerClasses = nTriggerClasses; | |
190 | fContentSize += triggersSize; | |
191 | } | |
192 | ||
193 | inline const AliFlatESDVertex* AliFlatESDEvent::GetFirstPrimaryVertex() const | |
194 | { | |
195 | return reinterpret_cast<const AliFlatESDVertex*>(fContent + fPrimaryVertexPointer); | |
196 | } | |
197 | ||
198 | inline const AliFlatESDVertex* AliFlatESDEvent::GetPrimaryVertexSPD() const | |
199 | { | |
200 | return (fPrimaryVertexMask & 0x1) ? GetFirstPrimaryVertex() : NULL; | |
201 | } | |
202 | ||
203 | inline const AliFlatESDVertex* AliFlatESDEvent::GetPrimaryVertexTracks() const | |
204 | { | |
205 | return (fPrimaryVertexMask & 0x2) ? (GetFirstPrimaryVertex() + (fPrimaryVertexMask & 0x1) ) : NULL; | |
206 | } | |
207 | ||
251a2c81 | 208 | #endif |