]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/sim/AliHLTOUTComponent.h
Enhanced doxygen documentation
[u/mrichter/AliRoot.git] / HLT / sim / AliHLTOUTComponent.h
1 // @(#) $Id$
2
3 #ifndef ALIHLTOUTCOMPONENT_H
4 #define ALIHLTOUTCOMPONENT_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
9 /** @file   AliHLTOUTComponent.h
10     @author Matthias Richter
11     @date   
12     @brief  The HLTOUT data sink component similar to HLTOUT nodes
13 */
14
15 // see class description below
16 // or
17 // refer to README to build package
18 // or
19 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
20
21 #include "AliHLTOfflineDataSink.h"
22
23 class AliHLTHOMERLibManager;
24 class AliHLTMonitoringWriter;
25 class TFile;
26 class TTree;
27 typedef vector<AliHLTMonitoringWriter*> AliHLTMonitoringWriterPVector;
28
29 /**
30  * @class AliHLTOUTComponent
31  * The HLTOUT data sink component which models the behavior of the HLTOUT
32  * nodes of the HLT cluster.
33  * <h2>General properties:</h2>
34  *
35  * Component ID: \b HLTOUT <br>
36  * Library: \b libHLTrec.so     <br>
37  * Input Data Types: @ref kAliHLTAnyDataType <br>
38  * Output Data Types: none (offline data sink) <br>
39  *
40  * <h2>Mandatory arguments:</h2>
41  * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
42  *
43  * <h2>Optional arguments:</h2>
44  * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
45  * \li -links      <i> n   </i> <br>
46  *      number of output ddl links
47  *
48  * <h2>Configuration:</h2>
49  * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
50  * none
51  *
52  * <h2>Default CDB entries:</h2>
53  * none
54  *
55  * <h2>Performance:</h2>
56  * The component does not any event data processing.
57  *
58  * <h2>Memory consumption:</h2>
59  * The component does not any event data processing.
60  *
61  * <h2>Output size:</h2>
62  * The component is an offline sink component and has no output data.
63  *
64  * The component can be used to write data in the same format as
65  * the HLTOUT on the real HLT. In case of AliRoot simulation, the
66  * component is automatically added to the chain if the specified
67  * chains have output data. By that means, the HLT output is added
68  * to the simulation.
69  *
70  * @ingroup alihlt_aliroot_simulation
71  */
72 class AliHLTOUTComponent : public AliHLTOfflineDataSink  {
73  public:
74   /** standard constructor */
75   AliHLTOUTComponent();
76   /** destructor */
77   virtual ~AliHLTOUTComponent();
78
79   const char* GetComponentID();
80   void GetInputDataTypes( vector<AliHLTComponentDataType>& list);
81   AliHLTComponent* Spawn();
82
83   /**
84    * Enable global options valid for all instances of the component
85    * @param options   bit field
86    */
87   static void SetGlobalOption(unsigned int options);
88
89   /**
90    * Disable global options valid for all instances of the component
91    * @param options   bit field
92    */
93   static void ClearGlobalOption(unsigned int options);
94
95   enum {
96     /** write the raw files of the HLT links */
97     kWriteRawFiles = 0x1,
98     /** write the digit file */
99     kWriteDigits = 0x2
100   };
101
102  protected:
103   /**
104    * Init method.
105    */
106   int DoInit( int argc, const char** argv );
107
108   /**
109    * Deinit method.
110    */
111   int DoDeinit();
112
113   /**
114    * Data processing method for the component.
115    * The function can be overloaded by other file writer components.
116    * @param evtData       event data structure
117    * @param blocks        input data block descriptors
118    * @param trigData      trigger data structure
119    */
120   int DumpEvent( const AliHLTComponentEventData& evtData,
121                  const AliHLTComponentBlockData* blocks, 
122                  AliHLTComponentTriggerData& trigData );
123
124   using AliHLTDataSink::DumpEvent;
125
126   /**
127    * Fill ESD for one event.
128    * @param eventNo       event No. \em Note: this is an internal enumeration of the
129    *                      processed events.
130    * @param runLoader     the AliRoot runloader
131    * @param esd           an AliESDEvent instance
132    * @return neg. error code if failed 
133    */
134   int FillESD(int eventNo, AliRunLoader* runLoader, AliESDEvent* esd);
135
136  private:
137   /** copy constructor prohibited */
138   AliHLTOUTComponent(const AliHLTOUTComponent&);
139   /** assignment operator prohibited */
140   AliHLTOUTComponent& operator=(const AliHLTOUTComponent&);
141
142   int ShuffleWriters(AliHLTMonitoringWriterPVector &list, AliHLTUInt32_t size);
143
144   /**
145    * Fill the output buffer and allocate if neccessary.
146    * Assemble ouput buffer with Common Data Header, HLT header and data from the
147    * writer. Works on the same buffer witch is allocated once and eventually
148    * grown in order to avoid frequent allocs/deallocs.   
149    * @param eventNo    number of the event
150    * @param pWriter    [IN]  the HOMER writer
151    * @param pBuffer    [OUT] target to receive the pointer to buffer
152    * @return size of the buffer
153    */
154   int FillOutputBuffer(int eventNo, AliHLTMonitoringWriter* pWriter, const AliHLTUInt8_t* &pBuffer);
155
156   /**
157    * Write data for a DDL link.
158    * @param hltddl     Number of DDL link within the range of HLT
159    * @param pBuffer    buffer to write
160    * @param bufferSize size of the buffer
161    */
162   int WriteDigitArray(int hltddl, const AliHLTUInt8_t* pBuffer, unsigned int bufferSize);
163
164   /**
165    * Write the digits for one DDL
166    * @param eventNo    number of the event
167    * @param runLoader  AliRoot run loader instance
168    * @return neg. error if failed
169    */
170   int WriteDigits(int eventNo, AliRunLoader* runLoader);
171
172   /**
173    * Write the raw file for one DDL
174    * @param eventNo    number of the event
175    * @param runLoader  AliRoot run loader instance
176    * @param hltddl     Number of DDL link within the range of HLT
177    * @param pBuffer    buffer to write
178    * @param size       size of the buffer
179    * @return neg. error if failed
180    */
181   int WriteRawFile(int eventNo, AliRunLoader* runLoader, int hltddl, const AliHLTUInt8_t* pBuffer, unsigned int size);
182
183   /** list of HOMER writers */
184   AliHLTMonitoringWriterPVector fWriters; //!transient
185
186   /** number of DDLs used*/
187   int fNofDDLs; //!transient
188
189   /** equipment ID of first HLT DDL */
190   int fIdFirstDDL; //!transient
191
192   /** output buffer, allocated once in order to avoid frequent alloc/dealloc */
193   vector<AliHLTUInt8_t> fBuffer; //!transient
194
195   /** instance of the HOMER library manager */
196   AliHLTHOMERLibManager* fpLibManager; // !transient
197
198   /** global options for all instances */
199   static int fgOptions; //! transient
200
201   /** the root file for the HLT 'digit' output */
202   TFile* fpDigitFile; //!transient
203
204   /** the tree for the HLT 'digit' output */
205   TTree* fpDigitTree; //!transient
206
207   /** array of TArrayC output buffers and branches */
208   TArrayC** fppDigitArrays; //!transient
209
210   /** Id of HOMER writer kept from previous event */
211   int fReservedWriter; //!transient
212
213   /** Data size kept in the internal buffer */
214   int fReservedData; //!transient
215
216   ClassDef(AliHLTOUTComponent, 3)
217 };
218 #endif