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