]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/BASE/AliHLTCalibrationProcessor.h
Include the new AliAODPid object (and don't create it by default).
[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 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 
66    */
67   Int_t PushToFXS(TObject* pObject, const char* pDetector, const char* pFileID, const char* pDDLNumber = "");
68
69   /**
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 
79    */
80    Int_t PushToFXS(void* pBuffer, int iSize, const char* pDetector, const char* pFileID, const char* pDDLNumber = "");
81
82   /** Constants  */ 
83   static const AliHLTUInt32_t fgkFXSProtocolHeaderSize;
84   static const AliHLTUInt32_t fgkFXSProtocolHeaderVersion;
85
86   /*
87    * ######################## ProcessCalibaration #####################
88    */
89
90   /**
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
102    */
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);
108  
109   /**  
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
118    */
119   virtual Int_t ProcessCalibration( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData);
120
121   /*
122    * ######################## ShipDataToFXS #####################
123    */
124
125   /**
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
137    */
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);
143  
144   /**  
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
153    */
154   virtual Int_t ShipDataToFXS( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData);
155
156  private:
157
158   /*
159    * ######################## InitCalibration #####################
160    */
161
162   /**
163    * Internal initialization method, which is not available for child classes. InitCalibration is the
164    * corresponding function for classes derived from AliHLTCalibrationProcessor.
165    */
166   Int_t DoInit( int argc, const char** argv );
167
168   /**
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.
172    */
173   virtual Int_t InitCalibration();
174
175   /**
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>
186    */
187   virtual Int_t ScanArgument(int argc, const char** argv);
188
189
190   /*
191    * ######################## DeinitCalibration #####################
192    */
193
194   /**
195    * Internal deinitialization method, which is not available for child classes. DeinitCalibration is the
196    * corresponding function for classes derived from AliHLTCalibrationProcessor.
197    */
198   Int_t DoDeinit();
199
200   /**
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.
204    */
205   virtual Int_t DeinitCalibration();
206
207   /*
208    * ######################## DoEvent #####################
209    */
210   
211   /**
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
225    */
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 );
232
233   using AliHLTProcessor::DoEvent;
234   
235   /*
236    * ######################## CreateFXSHeader #####################
237    */
238
239   /**
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 
248    */
249   Int_t CreateFXSHeader( AliHLTFXSHeader &pHeader, const char* pDetector, const char* pFileID, const char* pDDLNumber );
250
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: lower 4 Bits of each Byte convert to 
274    * digit (0 - F)
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