]>
Commit | Line | Data |
---|---|---|
5ea08be4 | 1 | // @(#)alimdc:$Name$:$Id$ |
2 | // Author: Fons Rademakers 26/11/99 | |
5ea08be4 | 3 | |
35aa01d6 | 4 | /************************************************************************** |
5 | * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. * | |
6 | * * | |
7 | * Author: The ALICE Off-line Project. * | |
8 | * Contributors are mentioned in the code where appropriate. * | |
9 | * * | |
10 | * Permission to use, copy, modify and distribute this software and its * | |
11 | * documentation strictly for non-commercial purposes is hereby granted * | |
12 | * without fee, provided that the above copyright notice appears in all * | |
13 | * copies and that both the copyright notice and this permission notice * | |
14 | * appear in the supporting documentation. The authors make no claims * | |
15 | * about the suitability of this software for any purpose. It is * | |
16 | * provided "as is" without express or implied warranty. * | |
17 | **************************************************************************/ | |
18 | ||
19 | ////////////////////////////////////////////////////////////////////////// | |
20 | // // | |
21 | // AliRawEvent // | |
22 | // // | |
23 | // Set of classes defining the ALICE RAW event format. The AliRawEvent // | |
24 | // class defines a RAW event. It consists of an AliEventHeader object // | |
25 | // an AliEquipmentHeader object, an AliRawData object and an array of // | |
26 | // sub-events, themselves also being AliRawEvents. The number of // | |
27 | // sub-events depends on the number of DATE LDC's. // | |
28 | // The AliRawEvent objects are written to a ROOT file using different // | |
29 | // technologies, i.e. to local disk via AliRawDB or via rfiod using // | |
30 | // AliRawRFIODB or via rootd using AliRawRootdDB or to CASTOR via // | |
31 | // rootd using AliRawCastorDB (and for performance testing there is // | |
32 | // also AliRawNullDB). // | |
33 | // The AliRunDB class provides the interface to the run and file // | |
34 | // catalogues (AliEn or plain MySQL). // | |
35 | // The AliStats class provides statics information that is added as // | |
36 | // a single keyed object to each raw file. // | |
37 | // The AliTagDB provides an interface to a TAG database. // | |
38 | // The AliMDC class is usid by the "alimdc" stand-alone program // | |
39 | // that reads data directly from DATE. // | |
40 | // // | |
41 | ////////////////////////////////////////////////////////////////////////// | |
42 | ||
a197a4ce | 43 | #include <TObjArray.h> |
5ea08be4 | 44 | |
f2dc6b20 | 45 | #include "AliLog.h" |
46 | ||
47 | #include "AliRawEventHeaderBase.h" | |
94d918a7 | 48 | #include "AliRawEquipment.h" |
5ea08be4 | 49 | |
50 | #include "AliRawEvent.h" | |
51 | ||
5ea08be4 | 52 | |
53 | ClassImp(AliRawEvent) | |
5ea08be4 | 54 | |
5ea08be4 | 55 | |
56 | //______________________________________________________________________________ | |
a197a4ce | 57 | AliRawEvent::AliRawEvent() |
5ea08be4 | 58 | { |
a197a4ce | 59 | // Create ALICE event object. If ownData is kFALSE we will use a static |
60 | // raw data object, otherwise a private copy will be made. | |
5ea08be4 | 61 | |
94d918a7 | 62 | fNEquipments = 0; |
63 | fNSubEvents = 0; | |
64 | fEvtHdr = 0; | |
65 | fEquipments = 0; | |
66 | fSubEvents = 0; | |
5ea08be4 | 67 | } |
68 | ||
5ea08be4 | 69 | //______________________________________________________________________________ |
a197a4ce | 70 | AliRawEvent::AliRawEvent(const AliRawEvent& rawEvent): TObject(rawEvent) |
5ea08be4 | 71 | { |
a197a4ce | 72 | // copy constructor |
5459c838 | 73 | |
a197a4ce | 74 | Fatal("AliRawEvent", "copy constructor not implemented"); |
5ea08be4 | 75 | } |
76 | ||
5ea08be4 | 77 | //______________________________________________________________________________ |
a197a4ce | 78 | AliRawEvent& AliRawEvent::operator = (const AliRawEvent& /*rawEvent*/) |
5ea08be4 | 79 | { |
a197a4ce | 80 | // assignment operator |
5ea08be4 | 81 | |
a197a4ce | 82 | Fatal("operator =", "assignment operator not implemented"); |
83 | return *this; | |
5ea08be4 | 84 | } |
85 | ||
c51de60d | 86 | //______________________________________________________________________________ |
f2dc6b20 | 87 | AliRawEventHeaderBase *AliRawEvent::GetHeader(char*& data) |
c51de60d | 88 | { |
f2dc6b20 | 89 | // Get event header part of AliRawEvent. |
90 | // First the DATE version is identified and then the | |
91 | // corresponding event header version object is created | |
92 | ||
93 | if (!fEvtHdr) { | |
94 | fEvtHdr = AliRawEventHeaderBase::Create(data); | |
95 | } | |
96 | ||
97 | return fEvtHdr; | |
98 | } | |
c51de60d | 99 | |
f2dc6b20 | 100 | //______________________________________________________________________________ |
101 | AliRawEventHeaderBase *AliRawEvent::GetHeader() | |
102 | { | |
103 | if (!fEvtHdr) { | |
104 | AliFatal("Header version not yet initialized!"); | |
105 | return 0x0; | |
106 | } | |
c51de60d | 107 | |
f2dc6b20 | 108 | return fEvtHdr; |
c51de60d | 109 | } |
110 | ||
5ea08be4 | 111 | //______________________________________________________________________________ |
94d918a7 | 112 | AliRawEquipment *AliRawEvent::NextEquipment() |
5ea08be4 | 113 | { |
94d918a7 | 114 | // Returns next equipment object. |
115 | ||
116 | if (!fEquipments) | |
117 | fEquipments = new TObjArray(100); // arbitrary, probably enough to prevent resizing | |
118 | ||
119 | if (fEquipments->GetSize() <= fNEquipments) { | |
120 | fEquipments->Expand(fNEquipments+10); | |
121 | Warning("NextEquipment", "expanded fEquipments by 10 to %d", | |
122 | fEquipments->GetSize()); | |
123 | } | |
5ea08be4 | 124 | |
94d918a7 | 125 | AliRawEquipment *eq; |
126 | if (!(eq = (AliRawEquipment *)fEquipments->At(fNEquipments))) { | |
127 | eq = new AliRawEquipment; | |
128 | fEquipments->AddAt(eq, fNEquipments); | |
129 | } | |
130 | ||
131 | fNEquipments++; | |
5ea08be4 | 132 | |
94d918a7 | 133 | return eq; |
5ea08be4 | 134 | } |
135 | ||
136 | //______________________________________________________________________________ | |
94d918a7 | 137 | AliRawEquipment *AliRawEvent::GetEquipment(Int_t index) const |
5ea08be4 | 138 | { |
94d918a7 | 139 | // Get specified equipment. Returns 0 if equipment does not exist. |
5ea08be4 | 140 | |
94d918a7 | 141 | if (!fEquipments) |
142 | return 0; | |
5ea08be4 | 143 | |
94d918a7 | 144 | return (AliRawEquipment *) fEquipments->At(index); |
5ea08be4 | 145 | } |
146 | ||
147 | //______________________________________________________________________________ | |
148 | AliRawEvent *AliRawEvent::NextSubEvent() | |
149 | { | |
150 | // Returns next sub-event object. | |
151 | ||
152 | if (!fSubEvents) | |
153 | fSubEvents = new TObjArray(100); // arbitrary, probably enough to prevent resizing | |
154 | ||
155 | if (fSubEvents->GetSize() <= fNSubEvents) { | |
156 | fSubEvents->Expand(fNSubEvents+10); | |
157 | Warning("NextSubEvent", "expanded fSubEvents by 10 to %d", | |
158 | fSubEvents->GetSize()); | |
159 | } | |
160 | ||
161 | AliRawEvent *ev; | |
162 | if (!(ev = (AliRawEvent *)fSubEvents->At(fNSubEvents))) { | |
163 | ev = new AliRawEvent; | |
164 | fSubEvents->AddAt(ev, fNSubEvents); | |
165 | } | |
166 | ||
167 | fNSubEvents++; | |
168 | ||
169 | return ev; | |
170 | } | |
171 | ||
04fa961a | 172 | //______________________________________________________________________________ |
5459c838 | 173 | AliRawEvent *AliRawEvent::GetSubEvent(Int_t index) const |
04fa961a | 174 | { |
5459c838 | 175 | // Get specified sub event. Returns 0 if sub event does not exist. |
176 | ||
177 | if (!fSubEvents) | |
178 | return 0; | |
179 | ||
180 | return (AliRawEvent *) fSubEvents->At(index); | |
04fa961a | 181 | } |
182 | ||
5ea08be4 | 183 | //______________________________________________________________________________ |
184 | void AliRawEvent::Reset() | |
185 | { | |
186 | // Reset the event in case it needs to be re-used (avoiding costly | |
187 | // new/delete cycle). We reset the size marker for the AliRawData | |
188 | // objects and the sub event counter. | |
189 | ||
94d918a7 | 190 | for (int i = 0; i < fNEquipments; i++) { |
191 | AliRawEquipment *eq = (AliRawEquipment *)fEquipments->At(i); | |
192 | eq->Reset(); | |
193 | } | |
194 | fNEquipments = 0; | |
5ea08be4 | 195 | for (int i = 0; i < fNSubEvents; i++) { |
196 | AliRawEvent *ev = (AliRawEvent *)fSubEvents->At(i); | |
94d918a7 | 197 | ev->Reset(); |
5ea08be4 | 198 | } |
199 | fNSubEvents = 0; | |
200 | } | |
201 | ||
202 | //______________________________________________________________________________ | |
203 | AliRawEvent::~AliRawEvent() | |
204 | { | |
205 | // Clean up event object. Delete also, possible, private raw data. | |
206 | ||
207 | delete fEvtHdr; | |
94d918a7 | 208 | if (fEquipments) |
209 | fEquipments->Delete(); | |
210 | delete fEquipments; | |
5ea08be4 | 211 | if (fSubEvents) |
212 | fSubEvents->Delete(); | |
213 | delete fSubEvents; | |
214 | } |