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