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 */
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
13 * @file AliHLTCalibrationProcessor.h
14 * @author Jochen Thaeder, Sebastian Bablok
16 * @brief Base class of HLT calibration components.
19 #include "AliHLTProcessor.h"
20 #include "AliHLTMessage.h"
21 #include "AliHLTDataTypes.h"
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
41 * @ingroup alihlt_component
43 class AliHLTCalibrationProcessor : public AliHLTProcessor {
46 /** standard constructor */
47 AliHLTCalibrationProcessor();
49 /** standard destructor */
50 virtual ~AliHLTCalibrationProcessor();
53 static const AliHLTUInt32_t fgkFXSProtocolHeaderSize;
54 static const AliHLTUInt32_t fgkFXSProtocolHeaderVersion;
59 * ######################## PushToFXS #####################
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
72 Int_t PushToFXS(TObject* pObject, const char* pDetector, const char* pFileID, const char* pDDLNumber = "");
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
85 Int_t PushToFXS(void* pBuffer, int iSize, const char* pDetector, const char* pFileID, const char* pDDLNumber = "");
90 * ######################## InitCalibration #####################
94 * Internal initialization method, which is not available for child classes. InitCalibration is the
95 * corresponding function for classes derived from AliHLTCalibrationProcessor.
97 Int_t DoInit( int argc, const char** argv );
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.
104 virtual Int_t InitCalibration();
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>
118 virtual Int_t ScanArgument(int argc, const char** argv);
122 * ######################## DeinitCalibration #####################
126 * Internal deinitialization method, which is not available for child classes. DeinitCalibration is the
127 * corresponding function for classes derived from AliHLTCalibrationProcessor.
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.
136 virtual Int_t DeinitCalibration();
139 * ######################## DoEvent #####################
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
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 );
165 * ######################## ProcessCalibaration #####################
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
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);
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
197 virtual Int_t ProcessCalibration( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData);
200 * ######################## ShipDataToFXS #####################
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
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);
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
232 virtual Int_t ShipDataToFXS( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData);
235 * ######################## CreateFXSHeader #####################
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
248 Int_t CreateFXSHeader( AliHLTFXSHeader &pHeader, const char* pDetector, const char* pFileID, const char* pDDLNumber );
252 * ######################## Members #####################
256 * Event modulo, when Data should shipped to FXS additionally.
257 * Default is 0, eventmodulo is deactivated.
259 Int_t fEventModulo; // see above
262 * if kTrue corrupt events will be passed through,
263 * if kFalse (default) they will be filtered
265 Bool_t fUseCorruptEvents; // see above
268 Int_t fEventCounter; // see above
271 * Bit Array of participating DDL Numbers.
272 * Scheme: lower 4 Bits of each Byte convert to
275 //Char_t fDDLNumber[gkAliHLTFXSHeaderfDDLNumberSize]; // see above
276 Char_t fDDLNumber[64]; // see above
278 /** Dummy in order to cope with RC 11 */
279 Int_t fDummy; // see above
281 ClassDef(AliHLTCalibrationProcessor, 0)
285 #endif // ALIHLTCALIBRATIONPROCESSOR_H