Line data Source code
1 : // @(#) $Id: AliRawEquipment.cxx 23318 2008-01-14 12:43:28Z hristov $
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 : // AliRawEquipmentV2 //
22 : // //
23 : // Set of classes defining the ALICE RAW event format. The AliRawEventV2//
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 AliRawEventV2s. The number of //
27 : // sub-events depends on the number of DATE LDC's. //
28 : // The AliRawEventV2 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 "AliRawEquipmentV2.h"
42 : #include "AliRawDataArrayV2.h"
43 : #include "AliRawData.h"
44 :
45 128 : ClassImp(AliRawEquipmentV2)
46 :
47 : //______________________________________________________________________________
48 : AliRawEquipmentV2::AliRawEquipmentV2():
49 2438 : AliRawVEquipment(),
50 2438 : fEqpHdr(),
51 2438 : fRawData(NULL),
52 2438 : fRawDataRef(NULL)
53 12190 : {
54 : // Create ALICE equipment object.
55 :
56 4876 : }
57 :
58 : //______________________________________________________________________________
59 : AliRawEquipmentHeader *AliRawEquipmentV2::GetEquipmentHeader()
60 : {
61 : // Get equipment header part of AliRawEquipmentV2.
62 :
63 3168846 : return &fEqpHdr;
64 : }
65 :
66 : //______________________________________________________________________________
67 : AliRawData *AliRawEquipmentV2::GetRawData()
68 : {
69 : // Get raw data part of AliRawEquipmentV2.
70 :
71 3880 : if (!fRawData) {
72 1621 : if (fRawDataRef.IsValid()) {
73 1621 : fRawData = (AliRawData*)fRawDataRef.GetObject();
74 1621 : }
75 : }
76 1940 : return fRawData;
77 : }
78 :
79 : //______________________________________________________________________________
80 : void AliRawEquipmentV2::Reset()
81 : {
82 : // Reset the equipment in case it needs to be re-used (avoiding costly
83 : // new/delete cycle). We reset the size marker for the AliRawData
84 : // object.
85 :
86 0 : fEqpHdr.Reset();
87 0 : fRawDataRef = NULL;
88 0 : }
89 :
90 : //______________________________________________________________________________
91 : void AliRawEquipmentV2::Clear(Option_t*)
92 : {
93 : // Clear the equipment in case it needs to be re-used (avoiding costly
94 : // new/delete cycle). Called by AliRawEventV2 Clear method inside the event loop.
95 :
96 0 : fEqpHdr.Reset();
97 0 : fRawDataRef = NULL;
98 0 : fRawData = NULL;
99 0 : }
100 :
101 : //______________________________________________________________________________
102 : AliRawEquipmentV2::~AliRawEquipmentV2()
103 14628 : {
104 : // Clean up event object. Delete also, possible, private raw data.
105 :
106 4878 : if (!fRawDataRef.IsValid()) delete fRawData;
107 7314 : }
108 :
109 : //______________________________________________________________________________
110 : AliRawData *AliRawEquipmentV2::NextRawData(AliRawDataArrayV2 *array)
111 : {
112 : // Get a pointer to the raw-data object
113 : // stored within an array in a separate
114 : // branch of the tree.
115 : // Set the reference to the raw-data object
116 :
117 : AliRawData *raw = NULL;
118 3242 : if (array) {
119 1621 : raw = array->Add();
120 1621 : fRawDataRef = raw;
121 1621 : }
122 : else {
123 0 : Error("NextRawData", "Raw-data array does not exist! Can not set a reference to a raw-data object!");
124 0 : fRawDataRef = NULL;
125 : }
126 :
127 1621 : return raw;
128 : }
129 :
130 : //______________________________________________________________________________
131 : void AliRawEquipmentV2::CloneRawData(const AliRawData *rawData)
132 : {
133 : // Clone the input raw data and
134 : // flush the TRef
135 :
136 0 : fRawDataRef = NULL;
137 0 : if (rawData) fRawData = (AliRawData*)rawData->Clone();
138 0 : }
|