]>
Commit | Line | Data |
---|---|---|
1 | // @(#)alimdc:$Name$:$Id$ | |
2 | // Author: Fons Rademakers 26/11/99 | |
3 | ||
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 | ||
43 | #include <TObjArray.h> | |
44 | ||
45 | #include "AliRawEventHeader.h" | |
46 | #include "AliRawEquipment.h" | |
47 | ||
48 | #include "AliRawEvent.h" | |
49 | ||
50 | ||
51 | ClassImp(AliRawEvent) | |
52 | ||
53 | ||
54 | //______________________________________________________________________________ | |
55 | AliRawEvent::AliRawEvent() | |
56 | { | |
57 | // Create ALICE event object. If ownData is kFALSE we will use a static | |
58 | // raw data object, otherwise a private copy will be made. | |
59 | ||
60 | fNEquipments = 0; | |
61 | fNSubEvents = 0; | |
62 | fEvtHdr = 0; | |
63 | fEquipments = 0; | |
64 | fSubEvents = 0; | |
65 | } | |
66 | ||
67 | //______________________________________________________________________________ | |
68 | AliRawEvent::AliRawEvent(const AliRawEvent& rawEvent): TObject(rawEvent) | |
69 | { | |
70 | // copy constructor | |
71 | ||
72 | Fatal("AliRawEvent", "copy constructor not implemented"); | |
73 | } | |
74 | ||
75 | //______________________________________________________________________________ | |
76 | AliRawEvent& AliRawEvent::operator = (const AliRawEvent& /*rawEvent*/) | |
77 | { | |
78 | // assignment operator | |
79 | ||
80 | Fatal("operator =", "assignment operator not implemented"); | |
81 | return *this; | |
82 | } | |
83 | ||
84 | //______________________________________________________________________________ | |
85 | AliRawEventHeader *AliRawEvent::GetHeader() | |
86 | { | |
87 | // Get event header part of AliRawEvent. | |
88 | ||
89 | if (!fEvtHdr) | |
90 | fEvtHdr = new AliRawEventHeader; | |
91 | ||
92 | return fEvtHdr; | |
93 | } | |
94 | ||
95 | //______________________________________________________________________________ | |
96 | AliRawEquipment *AliRawEvent::NextEquipment() | |
97 | { | |
98 | // Returns next equipment object. | |
99 | ||
100 | if (!fEquipments) | |
101 | fEquipments = new TObjArray(100); // arbitrary, probably enough to prevent resizing | |
102 | ||
103 | if (fEquipments->GetSize() <= fNEquipments) { | |
104 | fEquipments->Expand(fNEquipments+10); | |
105 | Warning("NextEquipment", "expanded fEquipments by 10 to %d", | |
106 | fEquipments->GetSize()); | |
107 | } | |
108 | ||
109 | AliRawEquipment *eq; | |
110 | if (!(eq = (AliRawEquipment *)fEquipments->At(fNEquipments))) { | |
111 | eq = new AliRawEquipment; | |
112 | fEquipments->AddAt(eq, fNEquipments); | |
113 | } | |
114 | ||
115 | fNEquipments++; | |
116 | ||
117 | return eq; | |
118 | } | |
119 | ||
120 | //______________________________________________________________________________ | |
121 | AliRawEquipment *AliRawEvent::GetEquipment(Int_t index) const | |
122 | { | |
123 | // Get specified equipment. Returns 0 if equipment does not exist. | |
124 | ||
125 | if (!fEquipments) | |
126 | return 0; | |
127 | ||
128 | return (AliRawEquipment *) fEquipments->At(index); | |
129 | } | |
130 | ||
131 | //______________________________________________________________________________ | |
132 | AliRawEvent *AliRawEvent::NextSubEvent() | |
133 | { | |
134 | // Returns next sub-event object. | |
135 | ||
136 | if (!fSubEvents) | |
137 | fSubEvents = new TObjArray(100); // arbitrary, probably enough to prevent resizing | |
138 | ||
139 | if (fSubEvents->GetSize() <= fNSubEvents) { | |
140 | fSubEvents->Expand(fNSubEvents+10); | |
141 | Warning("NextSubEvent", "expanded fSubEvents by 10 to %d", | |
142 | fSubEvents->GetSize()); | |
143 | } | |
144 | ||
145 | AliRawEvent *ev; | |
146 | if (!(ev = (AliRawEvent *)fSubEvents->At(fNSubEvents))) { | |
147 | ev = new AliRawEvent; | |
148 | fSubEvents->AddAt(ev, fNSubEvents); | |
149 | } | |
150 | ||
151 | fNSubEvents++; | |
152 | ||
153 | return ev; | |
154 | } | |
155 | ||
156 | //______________________________________________________________________________ | |
157 | AliRawEvent *AliRawEvent::GetSubEvent(Int_t index) const | |
158 | { | |
159 | // Get specified sub event. Returns 0 if sub event does not exist. | |
160 | ||
161 | if (!fSubEvents) | |
162 | return 0; | |
163 | ||
164 | return (AliRawEvent *) fSubEvents->At(index); | |
165 | } | |
166 | ||
167 | //______________________________________________________________________________ | |
168 | void AliRawEvent::Reset() | |
169 | { | |
170 | // Reset the event in case it needs to be re-used (avoiding costly | |
171 | // new/delete cycle). We reset the size marker for the AliRawData | |
172 | // objects and the sub event counter. | |
173 | ||
174 | for (int i = 0; i < fNEquipments; i++) { | |
175 | AliRawEquipment *eq = (AliRawEquipment *)fEquipments->At(i); | |
176 | eq->Reset(); | |
177 | } | |
178 | fNEquipments = 0; | |
179 | for (int i = 0; i < fNSubEvents; i++) { | |
180 | AliRawEvent *ev = (AliRawEvent *)fSubEvents->At(i); | |
181 | ev->Reset(); | |
182 | } | |
183 | fNSubEvents = 0; | |
184 | } | |
185 | ||
186 | //______________________________________________________________________________ | |
187 | AliRawEvent::~AliRawEvent() | |
188 | { | |
189 | // Clean up event object. Delete also, possible, private raw data. | |
190 | ||
191 | delete fEvtHdr; | |
192 | if (fEquipments) | |
193 | fEquipments->Delete(); | |
194 | delete fEquipments; | |
195 | if (fSubEvents) | |
196 | fSubEvents->Delete(); | |
197 | delete fSubEvents; | |
198 | } |