Line data Source code
1 : // @(#) $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 AliStats class provides statics information that is added as //
34 : // a single keyed object to each raw file. //
35 : // The AliTagDB provides an interface to a TAG database. //
36 : // The AliMDC class is usid by the "alimdc" stand-alone program //
37 : // that reads data directly from DATE. //
38 : // //
39 : //////////////////////////////////////////////////////////////////////////
40 :
41 : #include <TObjArray.h>
42 : #include "TBuffer.h"
43 :
44 : #include "AliLog.h"
45 :
46 : #include "AliRawEventHeaderBase.h"
47 : #include "AliRawEquipment.h"
48 :
49 : #include "AliRawEvent.h"
50 :
51 :
52 128 : ClassImp(AliRawEvent)
53 :
54 :
55 : //______________________________________________________________________________
56 0 : AliRawEvent::AliRawEvent():
57 0 : fNEquipments(0),
58 0 : fNSubEvents(0),
59 0 : fEvtHdr(NULL),
60 0 : fEquipments(NULL),
61 0 : fSubEvents(NULL)
62 0 : {
63 : // Create ALICE event object. If ownData is kFALSE we will use a static
64 : // raw data object, otherwise a private copy will be made.
65 :
66 0 : }
67 :
68 : //______________________________________________________________________________
69 : AliRawEventHeaderBase *AliRawEvent::GetHeader()
70 : {
71 0 : if (!fEvtHdr) {
72 0 : AliFatal("Event header does not exist!");
73 0 : return 0x0;
74 : }
75 :
76 0 : return fEvtHdr;
77 0 : }
78 :
79 : //______________________________________________________________________________
80 : AliRawVEquipment *AliRawEvent::GetEquipment(Int_t index) const
81 : {
82 : // Get specified equipment. Returns 0 if equipment does not exist.
83 :
84 0 : if (!fEquipments)
85 0 : return 0;
86 :
87 0 : return (AliRawEquipment *) fEquipments->At(index);
88 0 : }
89 :
90 : //______________________________________________________________________________
91 : AliRawVEvent *AliRawEvent::GetSubEvent(Int_t index)
92 : {
93 : // Get specified sub event. Returns 0 if sub event does not exist.
94 :
95 0 : if (!fSubEvents)
96 0 : return 0;
97 :
98 0 : return (AliRawEvent *) fSubEvents->At(index);
99 0 : }
100 :
101 : //______________________________________________________________________________
102 : AliRawEvent::~AliRawEvent()
103 0 : {
104 : // Clean up event object. Delete also, possible, private raw data.
105 :
106 0 : delete fEvtHdr;
107 0 : if (fEquipments)
108 0 : fEquipments->Delete();
109 0 : delete fEquipments;
110 0 : if (fSubEvents)
111 0 : fSubEvents->Delete();
112 0 : delete fSubEvents;
113 0 : }
114 :
115 : //______________________________________________________________________________
116 : void AliRawEvent::Streamer(TBuffer &R__b)
117 : {
118 : // Stream an object of class AliRawEvent.
119 :
120 0 : UInt_t R__s, R__c;
121 0 : if (R__b.IsReading()) {
122 0 : Version_t R__v = R__b.ReadVersion(&R__s, &R__c); if (R__v) { }
123 0 : TObject::Streamer(R__b);
124 0 : R__b >> fNEquipments;
125 0 : R__b >> fNSubEvents;
126 0 : R__b >> fEvtHdr;
127 0 : R__b >> fEquipments;
128 0 : R__b >> fSubEvents;
129 0 : R__b.CheckByteCount(R__s, R__c, AliRawEvent::IsA());
130 0 : } else {
131 0 : R__c = R__b.WriteVersion(AliRawEvent::IsA(), kTRUE);
132 0 : TObject::Streamer(R__b);
133 0 : R__b << fNEquipments;
134 0 : R__b << fNSubEvents;
135 0 : R__b << fEvtHdr;
136 0 : R__b << fEquipments;
137 0 : R__b << fSubEvents;
138 0 : R__b.SetByteCount(R__c, kTRUE);
139 : }
140 0 : }
|