]>
Commit | Line | Data |
---|---|---|
9d9ffd37 | 1 | //-*- Mode: C++ -*- |
1c2013e0 | 2 | // $Id$ |
9d9ffd37 | 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 */ | |
8 | ||
9d9ffd37 | 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 | ||
89413559 | 23 | class AliHLTReadoutList; |
24 | ||
9d9ffd37 | 25 | /** |
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 | |
41 | * - @ref Spawn | |
42 | ||
43 | * @ingroup alihlt_component | |
44 | */ | |
45 | class AliHLTCalibrationProcessor : public AliHLTProcessor { | |
46 | ||
47 | public: | |
48 | /** standard constructor */ | |
49 | AliHLTCalibrationProcessor(); | |
50 | ||
51 | /** standard destructor */ | |
52 | virtual ~AliHLTCalibrationProcessor(); | |
53 | ||
9d9ffd37 | 54 | protected: |
55 | ||
56 | /* | |
57 | * ######################## PushToFXS ##################### | |
58 | */ | |
59 | ||
60 | /** | |
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 | |
89413559 | 65 | * @param pDDLList pointer to ReadoutList ( class @ref AliHLTReadoutList) of |
e962f438 | 66 | * participating DDLs. Have to be set or unset with @ref |
67 | * AliHLTComponent::EnableDDLBit() and @ref AliHLTComponent::DisableDDLBit(). | |
ed504011 | 68 | * Will be filled automatically if not supplied by the component. |
9d9ffd37 | 69 | * @return neg. error code if failed |
70 | */ | |
89413559 | 71 | Int_t PushToFXS(TObject* pObject, const char* pDetector, const char* pFileID, const AliHLTReadoutList* pDDLList); |
9d9ffd37 | 72 | |
73 | /** | |
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 | |
89413559 | 79 | * @param pDDLList pointer to ReadoutList ( class @ref AliHLTReadoutList) of |
e962f438 | 80 | * participating DDLs. Have to be set or unset with @ref |
81 | * AliHLTComponent::EnableDDLBit() and @ref AliHLTComponent::DisableDDLBit(). | |
ed504011 | 82 | * Will be filled automatically if not supplied by the component. |
9d9ffd37 | 83 | * @return neg. error code if failed |
84 | */ | |
89413559 | 85 | Int_t PushToFXS(void* pBuffer, int iSize, const char* pDetector, const char* pFileID, const AliHLTReadoutList* pDDLList); |
9d9ffd37 | 86 | |
3a7c0444 | 87 | /** Constants */ |
88 | static const AliHLTUInt32_t fgkFXSProtocolHeaderSize; | |
89 | static const AliHLTUInt32_t fgkFXSProtocolHeaderVersion; | |
90 | ||
e4efa587 | 91 | /* |
92 | * ######################## ProcessCalibaration ##################### | |
93 | */ | |
94 | ||
95 | /** | |
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. | |
9bb806cd | 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 | |
e4efa587 | 104 | * <i>output</i>:size of produced data |
9bb806cd | 105 | * @param [in] outputBlocks list to receive output block descriptors |
e4efa587 | 106 | * @return neg. error code if failed |
107 | */ | |
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); | |
113 | ||
114 | /** | |
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 | |
123 | */ | |
124 | virtual Int_t ProcessCalibration( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData); | |
125 | ||
2cf5780e | 126 | /* |
127 | * ######################## ShipDataToFXS ##################### | |
128 | */ | |
129 | ||
130 | /** | |
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. | |
9bb806cd | 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 | |
2cf5780e | 139 | * <i>output</i>:size of produced data |
9bb806cd | 140 | * @param [in] outputBlocks list to receive output block descriptors |
2cf5780e | 141 | * @return neg. error code if failed |
142 | */ | |
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); | |
148 | ||
149 | /** | |
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 | |
158 | */ | |
159 | virtual Int_t ShipDataToFXS( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData); | |
160 | ||
9d9ffd37 | 161 | private: |
162 | ||
163 | /* | |
164 | * ######################## InitCalibration ##################### | |
165 | */ | |
166 | ||
167 | /** | |
168 | * Internal initialization method, which is not available for child classes. InitCalibration is the | |
169 | * corresponding function for classes derived from AliHLTCalibrationProcessor. | |
170 | */ | |
171 | Int_t DoInit( int argc, const char** argv ); | |
172 | ||
173 | /** | |
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. | |
177 | */ | |
178 | virtual Int_t InitCalibration(); | |
179 | ||
180 | /** | |
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> | |
191 | */ | |
7c4091c1 | 192 | virtual Int_t ScanArgument(int argc, const char** argv); |
9d9ffd37 | 193 | |
9d9ffd37 | 194 | /* |
195 | * ######################## DeinitCalibration ##################### | |
196 | */ | |
197 | ||
198 | /** | |
199 | * Internal deinitialization method, which is not available for child classes. DeinitCalibration is the | |
200 | * corresponding function for classes derived from AliHLTCalibrationProcessor. | |
201 | */ | |
202 | Int_t DoDeinit(); | |
203 | ||
204 | /** | |
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. | |
208 | */ | |
209 | virtual Int_t DeinitCalibration(); | |
210 | ||
211 | /* | |
212 | * ######################## DoEvent ##################### | |
213 | */ | |
214 | ||
215 | /** | |
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. | |
9bb806cd | 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 | |
9d9ffd37 | 226 | * <i>output</i>:size of produced data |
9bb806cd | 227 | * @param [in] outputBlocks list to receive output block descriptors |
9d9ffd37 | 228 | * @return neg. error code if failed |
229 | */ | |
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 ); | |
236 | ||
2cf5780e | 237 | using AliHLTProcessor::DoEvent; |
9d9ffd37 | 238 | |
239 | /* | |
240 | * ######################## CreateFXSHeader ##################### | |
241 | */ | |
242 | ||
243 | /** | |
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 | |
89413559 | 248 | * @param pDDLList pointer to ReadoutList ( class @ref AliHLTReadoutList) of |
ed504011 | 249 | * participating DDLs. Will be filled automatically if not |
250 | * supplied by the component. | |
9d9ffd37 | 251 | * @return neg. error code if failed |
252 | */ | |
89413559 | 253 | Int_t CreateFXSHeader( AliHLTFXSHeader &pHeader, const char* pDetector, const char* pFileID, const AliHLTReadoutList* pDDLList ); |
9d9ffd37 | 254 | |
255 | /* | |
256 | * ######################## Members ##################### | |
257 | */ | |
258 | ||
259 | /** | |
260 | * Event modulo, when Data should shipped to FXS additionally. | |
261 | * Default is 0, eventmodulo is deactivated. | |
262 | */ | |
263 | Int_t fEventModulo; // see above | |
264 | ||
265 | /** | |
266 | * if kTrue corrupt events will be passed through, | |
267 | * if kFalse (default) they will be filtered | |
268 | */ | |
269 | Bool_t fUseCorruptEvents; // see above | |
270 | ||
271 | /** Event counter */ | |
272 | Int_t fEventCounter; // see above | |
273 | ||
274 | /** | |
275 | * Bit Array of participating DDL Numbers. | |
ed504011 | 276 | * Scheme: every 4 Bits of each Byte convert digit |
277 | * (0 - F), before writing to FXS Header | |
9d9ffd37 | 278 | */ |
ed504011 | 279 | //Char_t fDDLNumber[gkAliHLTFXSHeaderfDDLNumberSize];// see above |
280 | Char_t fDDLNumber[64]; // see above | |
9d9ffd37 | 281 | |
282 | /** Dummy in order to cope with RC 11 */ | |
283 | Int_t fDummy; // see above | |
284 | ||
285 | ClassDef(AliHLTCalibrationProcessor, 0) | |
286 | ||
287 | }; | |
288 | ||
289 | #endif // ALIHLTCALIBRATIONPROCESSOR_H |