]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/BASE/AliHLTCalibrationProcessor.h
The file publisher now closes files when it is done with them during a given event...
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTCalibrationProcessor.h
CommitLineData
9d9ffd37 1//-*- Mode: C++ -*-
2#ifndef ALIHLTCALIBRATIONPROCESSOR_H
3#define ALIHLTCALIBRATIONPROCESSOR_H
4/* This file is property of and copyright by the ALICE HLT Project *
5 * ALICE Experiment at CERN, All rights reserved. *
6 * See cxx source for full Copyright notice */
7
8
9/**
10 * Class takes care of handling and shipping of freshly produced calibration
11 * data. this data will be shipped to the FXS of the HLT
12 *
13 * @file AliHLTCalibrationProcessor.h
14 * @author Jochen Thaeder, Sebastian Bablok
15 * @date
16 * @brief Base class of HLT calibration components.
17 */
18
19#include "AliHLTProcessor.h"
20#include "AliHLTMessage.h"
21#include "AliHLTDataTypes.h"
22
23/**
24 * @class AliHLTCalibrationProcessor
25 * Base class of HLT calibration components.
26 * The class provides a common interface for the implementation of HLT
27 * calibration components. It takes care of handling and shipping of
28 * produced calibration data to the FXS of the HLT. The child class must
29 * implement the functions:
30 * - @ref InitCalibration (optional)
31 * - @ref ScanArgument (optional)
32 * - @ref DeinitCalibration (optional)
33 * - @ref ProcessCalibration
34 * - @ref ShipDataToFXS
35 * - @ref GetComponentID
36 * - @ref GetInputDataTypes
37 * - @ref GetOutputDataType
38 * - @ref GetOutputDataSize
39 * - @ref Spawn
40
41 * @ingroup alihlt_component
42 */
43class AliHLTCalibrationProcessor : public AliHLTProcessor {
44
45 public:
46 /** standard constructor */
47 AliHLTCalibrationProcessor();
48
49 /** standard destructor */
50 virtual ~AliHLTCalibrationProcessor();
51
52 /** Constants */
53 static const AliHLTUInt32_t fgkFXSProtocolHeaderSize;
54 static const AliHLTUInt32_t fgkFXSProtocolHeaderVersion;
55
56 protected:
57
58 /*
59 * ######################## PushToFXS #####################
60 */
61
62 /**
63 * Insert an object into the output. FXS header will be inserted before the root object.
64 * @param pObject pointer to root object
65 * @param pDetector 4 byte Detector identifier
66 * @param pFileID name of the file to which the data shall be stored
67 * @param pDDLNumber number of DDLs participating in the processing/
68 * creation of this calibration data, will be filled
69 * automatically if not supplied by the componenet.
70 * @return neg. error code if failed
71 */
72 Int_t PushToFXS(TObject* pObject, const char* pDetector, const char* pFileID, const char* pDDLNumber = "");
73
74 /**
75 * Insert an object into the output. FXS header will be inserted before the root object.
76 * @param pBuffer pointer to buffer
77 * @param iSize size of the buffer
78 * @param pDetector 4 byte Detector identifier
79 * @param pFileID name of the file to which the data shall be stored
80 * @param pDDLNumber number of DDLs participating in the processing/
81 * creation of this calibration data, will be filled
82 * automatically if not supplied by the componenet.
83 * @return neg. error code if failed
84 */
7c4091c1 85 Int_t PushToFXS(void* pBuffer, int iSize, const char* pDetector, const char* pFileID, const char* pDDLNumber = "");
9d9ffd37 86
87 private:
88
89 /*
90 * ######################## InitCalibration #####################
91 */
92
93 /**
94 * Internal initialization method, which is not available for child classes. InitCalibration is the
95 * corresponding function for classes derived from AliHLTCalibrationProcessor.
96 */
97 Int_t DoInit( int argc, const char** argv );
98
99 /**
100 * Default method for the internal initialization.
101 * The method is called by @ref DoInit.
102 * This class can be overridden by the child class.
103 */
104 virtual Int_t InitCalibration();
105
106 /**
107 * Scan one argument and adjacent parameters.
108 * Can be overloaded by child classes in order to add additional arguments
109 * beyond the standard arguments of the calibration processor. The method is called
110 * whenever a non-standard argument is recognized. Make sure to return
111 * <tt> -EPROTO </tt> if the argument is not recognized be the child.
112 * @param argc size of the argument array
113 * @param argv agument array for component initialization
114 * @return number of processed members of the argv <br>
115 * -EINVAL unknown argument <br>
116 * -EPROTO parameter for argument missing <br>
117 */
7c4091c1 118 virtual Int_t ScanArgument(int argc, const char** argv);
9d9ffd37 119
120
121 /*
122 * ######################## DeinitCalibration #####################
123 */
124
125 /**
126 * Internal deinitialization method, which is not available for child classes. DeinitCalibration is the
127 * corresponding function for classes derived from AliHLTCalibrationProcessor.
128 */
129 Int_t DoDeinit();
130
131 /**
132 * Default method for the internal clean-up.
133 * The method is called by @ref DoDeinit.
134 * This class can be overridden by the child class.
135 */
136 virtual Int_t DeinitCalibration();
137
138 /*
139 * ######################## DoEvent #####################
140 */
141
142 /**
143 * The low-level data processing method for the component.
144 * It decides wether to call @ref ProcessCalibration or @ref ShipDataToFXS
145 * according to the event type - END_OF_RUN / DATA / CALIBRATION
146 * If commandline paramater "-eventmodulo x"is given and x > 0, data will
147 * be also shipped to the FXS with this modulo.
148 * @param evtData event data structure
149 * @param blocks input data block descriptors
150 * @param trigData trigger data structure
151 * @param outputPtr pointer to target buffer
152 * @param size <i>input</i>: size of target buffer
153 * <i>output</i>:size of produced data
154 * @param outputBlocks list to receive output block descriptors
155 * @return neg. error code if failed
156 */
157 Int_t DoEvent( const AliHLTComponentEventData& evtData,
158 const AliHLTComponentBlockData* blocks,
159 AliHLTComponentTriggerData& trigData,
160 AliHLTUInt8_t* outputPtr,
161 AliHLTUInt32_t& size,
162 vector<AliHLTComponentBlockData>& outputBlocks );
163
164 /*
165 * ######################## ProcessCalibaration #####################
166 */
167
168 /**
169 * The low-level data processing method for the component,
170 * called for every data event. This is the custom processing
171 * method and can be overloaded by the component.
172 * @param evtData event data structure
173 * @param blocks input data block descriptors
174 * @param trigData trigger data structure
175 * @param outputPtr pointer to target buffer
176 * @param size <i>input</i>: size of target buffer
177 * <i>output</i>:size of produced data
178 * @param outputBlocks list to receive output block descriptors
179 * @return neg. error code if failed
180 */
181 virtual Int_t ProcessCalibration(const AliHLTComponent_EventData& evtData,
182 const AliHLTComponent_BlockData* blocks,
183 AliHLTComponent_TriggerData& trigData, AliHLTUInt8_t* outputPtr,
184 AliHLTUInt32_t& size,
185 vector<AliHLTComponent_BlockData>& outputBlocks);
186
187 /**
188 * The high-level data processing method for the component,
189 * called for every data event. This is the custom processing
190 * method and can be overloaded by the component.
191 * This is the default processing method; the method is called
192 * if no low level @ref ProcessCalibration method is overloaded by the component.
193 * @param evtData event data structure
194 * @param trigData trigger data structure
195 * @return neg. error code if failed
196 */
197 virtual Int_t ProcessCalibration( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData);
198
199 /*
200 * ######################## ShipDataToFXS #####################
201 */
202
203 /**
204 * The low-level data processing method for the component,
205 * called for the END_OF_RUN event. This is the custom processing
206 * method and can be overloaded by the component.
207 * @param evtData event data structure
208 * @param blocks input data block descriptors
209 * @param trigData trigger data structure
210 * @param outputPtr pointer to target buffer
211 * @param size <i>input</i>: size of target buffer
212 * <i>output</i>:size of produced data
213 * @param outputBlocks list to receive output block descriptors
214 * @return neg. error code if failed
215 */
216 virtual Int_t ShipDataToFXS(const AliHLTComponent_EventData& evtData,
217 const AliHLTComponent_BlockData* blocks,
218 AliHLTComponent_TriggerData& trigData, AliHLTUInt8_t* outputPtr,
219 AliHLTUInt32_t& size,
220 vector<AliHLTComponent_BlockData>& outputBlocks);
221
222 /**
223 * The high-level data processing method for the component,
224 * called for the END_OF_RUN event. This is the custom processing
225 * method and can be overloaded by the component.
226 * This is the default processing method; the method is called
227 * if no low level @ref ShipDataToFXS method is overloaded by the component.
228 * @param evtData event data structure
229 * @param trigData trigger data structure
230 * @return neg. error code if failed
231 */
232 virtual Int_t ShipDataToFXS( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData);
233
234 /*
235 * ######################## CreateFXSHeader #####################
236 */
237
238 /**
239 * Insert an object into the output. FXS header will be inserted before the root object.
240 * @param pHeader pointer to AliHLTFXSHeader
241 * @param pDetector 4 byte Detector identifier
242 * @param pFileID name of the file to which the data shall be stored
243 * @param pDDLNumber number of DDLs participating in the processing/
244 * creation of this calibration data, will be filled
245 * automatically if not supplied by the componenet.
246 * @return neg. error code if failed
247 */
248 Int_t CreateFXSHeader( AliHLTFXSHeader &pHeader, const char* pDetector, const char* pFileID, const char* pDDLNumber );
249
250
251 /*
252 * ######################## Members #####################
253 */
254
255 /**
256 * Event modulo, when Data should shipped to FXS additionally.
257 * Default is 0, eventmodulo is deactivated.
258 */
259 Int_t fEventModulo; // see above
260
261 /**
262 * if kTrue corrupt events will be passed through,
263 * if kFalse (default) they will be filtered
264 */
265 Bool_t fUseCorruptEvents; // see above
266
267 /** Event counter */
268 Int_t fEventCounter; // see above
269
270 /**
271 * Bit Array of participating DDL Numbers.
272 * Scheme: lower 4 Bits of each Byte convert to
273 * digit (0 - F)
274 */
275 //Char_t fDDLNumber[gkAliHLTFXSHeaderfDDLNumberSize]; // see above
276 Char_t fDDLNumber[64]; // see above
277
278 /** Dummy in order to cope with RC 11 */
279 Int_t fDummy; // see above
280
281 ClassDef(AliHLTCalibrationProcessor, 0)
282
283};
284
285#endif // ALIHLTCALIBRATIONPROCESSOR_H