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