3 #ifndef ALIHLTCALIBRATIONPROCESSOR_H
4 #define ALIHLTCALIBRATIONPROCESSOR_H
5 /* This file is property of and copyright by the ALICE HLT Project *
6 * ALICE Experiment at CERN, All rights reserved. *
7 * 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"
23 class AliHLTReadoutList;
26 * @class AliHLTCalibrationProcessor
27 * Base class of HLT calibration components.
28 * The class provides a common interface for the implementation of HLT
29 * calibration components. It takes care of handling and shipping of
30 * produced calibration data to the FXS of the HLT. The child class must
31 * implement the functions:
32 * - @ref InitCalibration (optional)
33 * - @ref ScanArgument (optional)
34 * - @ref DeinitCalibration (optional)
35 * - @ref ProcessCalibration
36 * - @ref ShipDataToFXS
37 * - @ref GetComponentID
38 * - @ref GetInputDataTypes
39 * - @ref GetOutputDataType
40 * - @ref GetOutputDataSize
43 * @ingroup alihlt_component
45 class AliHLTCalibrationProcessor : public AliHLTProcessor {
48 /** standard constructor */
49 AliHLTCalibrationProcessor();
51 /** standard destructor */
52 virtual ~AliHLTCalibrationProcessor();
57 * ######################## PushToFXS #####################
61 * Insert an object into the output. FXS header will be inserted before the root object.
62 * @param pObject pointer to root object
63 * @param pDetector 4 byte Detector identifier
64 * @param pFileID name of the file to which the data shall be stored
65 * @param pDDLList pointer to ReadoutList ( class @ref AliHLTReadoutList) of
66 * participating DDLs. Have to be set or unset with @ref
67 * AliHLTComponent::EnableDDLBit() and @ref AliHLTComponent::DisableDDLBit().
68 * Will be filled automatically if not supplied by the component.
69 * @return neg. error code if failed
71 Int_t PushToFXS(TObject* pObject, const char* pDetector, const char* pFileID, const AliHLTReadoutList* pDDLList);
74 * Insert an object into the output. FXS header will be inserted before the root object.
75 * @param pBuffer pointer to buffer
76 * @param iSize size of the buffer
77 * @param pDetector 4 byte Detector identifier
78 * @param pFileID name of the file to which the data shall be stored
79 * @param pDDLList pointer to ReadoutList ( class @ref AliHLTReadoutList) of
80 * participating DDLs. Have to be set or unset with @ref
81 * AliHLTComponent::EnableDDLBit() and @ref AliHLTComponent::DisableDDLBit().
82 * Will be filled automatically if not supplied by the component.
83 * @return neg. error code if failed
85 Int_t PushToFXS(void* pBuffer, int iSize, const char* pDetector, const char* pFileID, const AliHLTReadoutList* pDDLList);
88 static const AliHLTUInt32_t fgkFXSProtocolHeaderSize;
89 static const AliHLTUInt32_t fgkFXSProtocolHeaderVersion;
92 * ######################## ProcessCalibaration #####################
96 * The low-level data processing method for the component,
97 * called for every data event. This is the custom processing
98 * method and can be overloaded by the component.
99 * @param [in] evtData event data structure
100 * @param [in] blocks input data block descriptors
101 * @param [in] trigData trigger data structure
102 * @param [in] outputPtr pointer to target buffer
103 * @param [in,out] size <i>input</i>: size of target buffer
104 * <i>output</i>:size of produced data
105 * @param [in] outputBlocks list to receive output block descriptors
106 * @return neg. error code if failed
108 virtual Int_t ProcessCalibration(const AliHLTComponent_EventData& evtData,
109 const AliHLTComponent_BlockData* blocks,
110 AliHLTComponent_TriggerData& trigData, AliHLTUInt8_t* outputPtr,
111 AliHLTUInt32_t& size,
112 vector<AliHLTComponent_BlockData>& outputBlocks);
115 * The high-level data processing method for the component,
116 * called for every data event. This is the custom processing
117 * method and can be overloaded by the component.
118 * This is the default processing method; the method is called
119 * if no low level @ref ProcessCalibration method is overloaded by the component.
120 * @param evtData event data structure
121 * @param trigData trigger data structure
122 * @return neg. error code if failed
124 virtual Int_t ProcessCalibration( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData);
127 * ######################## ShipDataToFXS #####################
131 * The low-level data processing method for the component,
132 * called for the END_OF_RUN event. This is the custom processing
133 * method and can be overloaded by the component.
134 * @param [in] evtData event data structure
135 * @param [in] blocks input data block descriptors
136 * @param [in] trigData trigger data structure
137 * @param [in] outputPtr pointer to target buffer
138 * @param [in,out] size <i>input</i>: size of target buffer
139 * <i>output</i>:size of produced data
140 * @param [in] outputBlocks list to receive output block descriptors
141 * @return neg. error code if failed
143 virtual Int_t ShipDataToFXS(const AliHLTComponent_EventData& evtData,
144 const AliHLTComponent_BlockData* blocks,
145 AliHLTComponent_TriggerData& trigData, AliHLTUInt8_t* outputPtr,
146 AliHLTUInt32_t& size,
147 vector<AliHLTComponent_BlockData>& outputBlocks);
150 * The high-level data processing method for the component,
151 * called for the END_OF_RUN event. This is the custom processing
152 * method and can be overloaded by the component.
153 * This is the default processing method; the method is called
154 * if no low level @ref ShipDataToFXS method is overloaded by the component.
155 * @param evtData event data structure
156 * @param trigData trigger data structure
157 * @return neg. error code if failed
159 virtual Int_t ShipDataToFXS( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData);
164 * ######################## InitCalibration #####################
168 * Internal initialization method, which is not available for child classes. InitCalibration is the
169 * corresponding function for classes derived from AliHLTCalibrationProcessor.
171 Int_t DoInit( int argc, const char** argv );
174 * Default method for the internal initialization.
175 * The method is called by @ref DoInit.
176 * This class can be overridden by the child class.
178 virtual Int_t InitCalibration();
181 * Scan one argument and adjacent parameters.
182 * Can be overloaded by child classes in order to add additional arguments
183 * beyond the standard arguments of the calibration processor. The method is called
184 * whenever a non-standard argument is recognized. Make sure to return
185 * <tt> -EPROTO </tt> if the argument is not recognized be the child.
186 * @param argc size of the argument array
187 * @param argv agument array for component initialization
188 * @return number of processed members of the argv <br>
189 * -EINVAL unknown argument <br>
190 * -EPROTO parameter for argument missing <br>
192 virtual Int_t ScanArgument(int argc, const char** argv);
195 * ######################## DeinitCalibration #####################
199 * Internal deinitialization method, which is not available for child classes. DeinitCalibration is the
200 * corresponding function for classes derived from AliHLTCalibrationProcessor.
205 * Default method for the internal clean-up.
206 * The method is called by @ref DoDeinit.
207 * This class can be overridden by the child class.
209 virtual Int_t DeinitCalibration();
212 * ######################## DoEvent #####################
216 * The low-level data processing method for the component.
217 * It decides wether to call @ref ProcessCalibration or @ref ShipDataToFXS
218 * according to the event type - END_OF_RUN / DATA / CALIBRATION
219 * If commandline paramater "-eventmodulo x"is given and x > 0, data will
220 * be also shipped to the FXS with this modulo.
221 * @param [in] evtData event data structure
222 * @param [in] blocks input data block descriptors
223 * @param [in] trigData trigger data structure
224 * @param [in] outputPtr pointer to target buffer
225 * @param [in,out] size <i>input</i>: size of target buffer
226 * <i>output</i>:size of produced data
227 * @param [in] outputBlocks list to receive output block descriptors
228 * @return neg. error code if failed
230 Int_t DoEvent( const AliHLTComponentEventData& evtData,
231 const AliHLTComponentBlockData* blocks,
232 AliHLTComponentTriggerData& trigData,
233 AliHLTUInt8_t* outputPtr,
234 AliHLTUInt32_t& size,
235 vector<AliHLTComponentBlockData>& outputBlocks );
237 using AliHLTProcessor::DoEvent;
240 * ######################## CreateFXSHeader #####################
244 * Insert an object into the output. FXS header will be inserted before the root object.
245 * @param pHeader pointer to AliHLTFXSHeader
246 * @param pDetector 4 byte Detector identifier
247 * @param pFileID name of the file to which the data shall be stored
248 * @param pDDLList pointer to ReadoutList ( class @ref AliHLTReadoutList) of
249 * participating DDLs. Will be filled automatically if not
250 * supplied by the component.
251 * @return neg. error code if failed
253 Int_t CreateFXSHeader( AliHLTFXSHeader &pHeader, const char* pDetector, const char* pFileID, const AliHLTReadoutList* pDDLList );
256 * ######################## Members #####################
260 * Event modulo, when Data should shipped to FXS additionally.
261 * Default is 0, eventmodulo is deactivated.
263 Int_t fEventModulo; // see above
266 * if kTrue corrupt events will be passed through,
267 * if kFalse (default) they will be filtered
269 Bool_t fUseCorruptEvents; // see above
272 Int_t fEventCounter; // see above
275 * Bit Array of participating DDL Numbers.
276 * Scheme: every 4 Bits of each Byte convert digit
277 * (0 - F), before writing to FXS Header
279 //Char_t fDDLNumber[gkAliHLTFXSHeaderfDDLNumberSize];// see above
280 Char_t fDDLNumber[64]; // see above
282 /** Dummy in order to cope with RC 11 */
283 Int_t fDummy; // see above
285 ClassDef(AliHLTCalibrationProcessor, 0)
289 #endif // ALIHLTCALIBRATIONPROCESSOR_H