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 */
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
12 * @file AliHLTCalibrationProcessor.h
13 * @author Jochen Thaeder, Sebastian Bablok
15 * @brief Base class of HLT calibration components.
18 #include "AliHLTProcessor.h"
19 #include "AliHLTMessage.h"
20 #include "AliHLTDataTypes.h"
23 * @class AliHLTCalibrationProcessor
24 * Base class of HLT calibration components.
25 * The class provides a common interface for the implementation of HLT
26 * calibration components. It takes care of handling and shipping of
27 * produced calibration data to the FXS of the HLT. The child class must
28 * implement the functions:
29 * - @ref InitCalibration (optional)
30 * - @ref ScanArgument (optional)
31 * - @ref DeinitCalibration (optional)
32 * - @ref ProcessCalibration
33 * - @ref ShipDataToFXS
34 * - @ref GetComponentID
35 * - @ref GetInputDataTypes
36 * - @ref GetOutputDataType
37 * - @ref GetOutputDataSize
40 * @ingroup alihlt_component
42 class AliHLTCalibrationProcessor : public AliHLTProcessor {
45 /** standard constructor */
46 AliHLTCalibrationProcessor();
48 /** standard destructor */
49 virtual ~AliHLTCalibrationProcessor();
54 * ######################## PushToFXS #####################
58 * Insert an object into the output. FXS header will be inserted before the root object.
59 * @param pObject pointer to root object
60 * @param pDetector 4 byte Detector identifier
61 * @param pFileID name of the file to which the data shall be stored
62 * @param pDDLNumber number of DDLs participating in the processing/
63 * creation of this calibration data, will be filled
64 * automatically if not supplied by the componenet.
65 * @return neg. error code if failed
67 Int_t PushToFXS(TObject* pObject, const char* pDetector, const char* pFileID, const char* pDDLNumber = "");
70 * Insert an object into the output. FXS header will be inserted before the root object.
71 * @param pBuffer pointer to buffer
72 * @param iSize size of the buffer
73 * @param pDetector 4 byte Detector identifier
74 * @param pFileID name of the file to which the data shall be stored
75 * @param pDDLNumber number of DDLs participating in the processing/
76 * creation of this calibration data, will be filled
77 * automatically if not supplied by the componenet.
78 * @return neg. error code if failed
80 Int_t PushToFXS(void* pBuffer, int iSize, const char* pDetector, const char* pFileID, const char* pDDLNumber = "");
83 static const AliHLTUInt32_t fgkFXSProtocolHeaderSize;
84 static const AliHLTUInt32_t fgkFXSProtocolHeaderVersion;
87 * ######################## ProcessCalibaration #####################
91 * The low-level data processing method for the component,
92 * called for every data event. This is the custom processing
93 * method and can be overloaded by the component.
94 * @param evtData event data structure
95 * @param blocks input data block descriptors
96 * @param trigData trigger data structure
97 * @param outputPtr pointer to target buffer
98 * @param size <i>input</i>: size of target buffer
99 * <i>output</i>:size of produced data
100 * @param outputBlocks list to receive output block descriptors
101 * @return neg. error code if failed
103 virtual Int_t ProcessCalibration(const AliHLTComponent_EventData& evtData,
104 const AliHLTComponent_BlockData* blocks,
105 AliHLTComponent_TriggerData& trigData, AliHLTUInt8_t* outputPtr,
106 AliHLTUInt32_t& size,
107 vector<AliHLTComponent_BlockData>& outputBlocks);
110 * The high-level data processing method for the component,
111 * called for every data event. This is the custom processing
112 * method and can be overloaded by the component.
113 * This is the default processing method; the method is called
114 * if no low level @ref ProcessCalibration method is overloaded by the component.
115 * @param evtData event data structure
116 * @param trigData trigger data structure
117 * @return neg. error code if failed
119 virtual Int_t ProcessCalibration( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData);
122 * ######################## ShipDataToFXS #####################
126 * The low-level data processing method for the component,
127 * called for the END_OF_RUN event. This is the custom processing
128 * method and can be overloaded by the component.
129 * @param evtData event data structure
130 * @param blocks input data block descriptors
131 * @param trigData trigger data structure
132 * @param outputPtr pointer to target buffer
133 * @param size <i>input</i>: size of target buffer
134 * <i>output</i>:size of produced data
135 * @param outputBlocks list to receive output block descriptors
136 * @return neg. error code if failed
138 virtual Int_t ShipDataToFXS(const AliHLTComponent_EventData& evtData,
139 const AliHLTComponent_BlockData* blocks,
140 AliHLTComponent_TriggerData& trigData, AliHLTUInt8_t* outputPtr,
141 AliHLTUInt32_t& size,
142 vector<AliHLTComponent_BlockData>& outputBlocks);
145 * The high-level data processing method for the component,
146 * called for the END_OF_RUN event. This is the custom processing
147 * method and can be overloaded by the component.
148 * This is the default processing method; the method is called
149 * if no low level @ref ShipDataToFXS method is overloaded by the component.
150 * @param evtData event data structure
151 * @param trigData trigger data structure
152 * @return neg. error code if failed
154 virtual Int_t ShipDataToFXS( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData);
159 * ######################## InitCalibration #####################
163 * Internal initialization method, which is not available for child classes. InitCalibration is the
164 * corresponding function for classes derived from AliHLTCalibrationProcessor.
166 Int_t DoInit( int argc, const char** argv );
169 * Default method for the internal initialization.
170 * The method is called by @ref DoInit.
171 * This class can be overridden by the child class.
173 virtual Int_t InitCalibration();
176 * Scan one argument and adjacent parameters.
177 * Can be overloaded by child classes in order to add additional arguments
178 * beyond the standard arguments of the calibration processor. The method is called
179 * whenever a non-standard argument is recognized. Make sure to return
180 * <tt> -EPROTO </tt> if the argument is not recognized be the child.
181 * @param argc size of the argument array
182 * @param argv agument array for component initialization
183 * @return number of processed members of the argv <br>
184 * -EINVAL unknown argument <br>
185 * -EPROTO parameter for argument missing <br>
187 virtual Int_t ScanArgument(int argc, const char** argv);
191 * ######################## DeinitCalibration #####################
195 * Internal deinitialization method, which is not available for child classes. DeinitCalibration is the
196 * corresponding function for classes derived from AliHLTCalibrationProcessor.
201 * Default method for the internal clean-up.
202 * The method is called by @ref DoDeinit.
203 * This class can be overridden by the child class.
205 virtual Int_t DeinitCalibration();
208 * ######################## DoEvent #####################
212 * The low-level data processing method for the component.
213 * It decides wether to call @ref ProcessCalibration or @ref ShipDataToFXS
214 * according to the event type - END_OF_RUN / DATA / CALIBRATION
215 * If commandline paramater "-eventmodulo x"is given and x > 0, data will
216 * be also shipped to the FXS with this modulo.
217 * @param evtData event data structure
218 * @param blocks input data block descriptors
219 * @param trigData trigger data structure
220 * @param outputPtr pointer to target buffer
221 * @param size <i>input</i>: size of target buffer
222 * <i>output</i>:size of produced data
223 * @param outputBlocks list to receive output block descriptors
224 * @return neg. error code if failed
226 Int_t DoEvent( const AliHLTComponentEventData& evtData,
227 const AliHLTComponentBlockData* blocks,
228 AliHLTComponentTriggerData& trigData,
229 AliHLTUInt8_t* outputPtr,
230 AliHLTUInt32_t& size,
231 vector<AliHLTComponentBlockData>& outputBlocks );
233 using AliHLTProcessor::DoEvent;
236 * ######################## CreateFXSHeader #####################
240 * Insert an object into the output. FXS header will be inserted before the root object.
241 * @param pHeader pointer to AliHLTFXSHeader
242 * @param pDetector 4 byte Detector identifier
243 * @param pFileID name of the file to which the data shall be stored
244 * @param pDDLNumber number of DDLs participating in the processing/
245 * creation of this calibration data, will be filled
246 * automatically if not supplied by the componenet.
247 * @return neg. error code if failed
249 Int_t CreateFXSHeader( AliHLTFXSHeader &pHeader, const char* pDetector, const char* pFileID, const char* pDDLNumber );
253 * ######################## Members #####################
257 * Event modulo, when Data should shipped to FXS additionally.
258 * Default is 0, eventmodulo is deactivated.
260 Int_t fEventModulo; // see above
263 * if kTrue corrupt events will be passed through,
264 * if kFalse (default) they will be filtered
266 Bool_t fUseCorruptEvents; // see above
269 Int_t fEventCounter; // see above
272 * Bit Array of participating DDL Numbers.
273 * Scheme: lower 4 Bits of each Byte convert to
276 //Char_t fDDLNumber[gkAliHLTFXSHeaderfDDLNumberSize]; // see above
277 Char_t fDDLNumber[64]; // see above
279 /** Dummy in order to cope with RC 11 */
280 Int_t fDummy; // see above
282 ClassDef(AliHLTCalibrationProcessor, 0)
286 #endif // ALIHLTCALIBRATIONPROCESSOR_H