Enhanced doxygen documentation
[u/mrichter/AliRoot.git] / HLT / sim / AliHLTOUTComponent.h
CommitLineData
c4228ec4 1// @(#) $Id$
2
3#ifndef ALIHLTOUTCOMPONENT_H
4#define ALIHLTOUTCOMPONENT_H
c5123824 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 *
c4228ec4 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"
c4228ec4 22
64defa03 23class AliHLTHOMERLibManager;
a183f221 24class AliHLTMonitoringWriter;
c5123824 25class TFile;
26class TTree;
a183f221 27typedef vector<AliHLTMonitoringWriter*> AliHLTMonitoringWriterPVector;
4b113031 28
c4228ec4 29/**
30 * @class AliHLTOUTComponent
31 * The HLTOUT data sink component which models the behavior of the HLTOUT
32 * nodes of the HLT cluster.
a8420176 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>
1ac82ce6 41 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
a8420176 42 *
43 * <h2>Optional arguments:</h2>
1ac82ce6 44 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
a8420176 45 * \li -links <i> n </i> <br>
46 * number of output ddl links
47 *
48 * <h2>Configuration:</h2>
1ac82ce6 49 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
a8420176 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 *
fb345ed7 70 * @ingroup alihlt_aliroot_simulation
c4228ec4 71 */
72class 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
2c0e5942 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
c4228ec4 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
d76bc02a 124 using AliHLTDataSink::DumpEvent;
125
c4228ec4 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
a183f221 142 int ShuffleWriters(AliHLTMonitoringWriterPVector &list, AliHLTUInt32_t size);
4b113031 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 */
a183f221 154 int FillOutputBuffer(int eventNo, AliHLTMonitoringWriter* pWriter, const AliHLTUInt8_t* &pBuffer);
4b113031 155
c5123824 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
4b113031 164 /**
165 * Write the digits for one DDL
166 * @param eventNo number of the event
167 * @param runLoader AliRoot run loader instance
4b113031 168 * @return neg. error if failed
169 */
c5123824 170 int WriteDigits(int eventNo, AliRunLoader* runLoader);
4b113031 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 */
a8420176 181 int WriteRawFile(int eventNo, AliRunLoader* runLoader, int hltddl, const AliHLTUInt8_t* pBuffer, unsigned int size);
4b113031 182
183 /** list of HOMER writers */
a183f221 184 AliHLTMonitoringWriterPVector fWriters; //!transient
4b113031 185
186 /** number of DDLs used*/
187 int fNofDDLs; //!transient
188
189 /** equipment ID of first HLT DDL */
190 int fIdFirstDDL; //!transient
191
4b113031 192 /** output buffer, allocated once in order to avoid frequent alloc/dealloc */
193 vector<AliHLTUInt8_t> fBuffer; //!transient
194
a183f221 195 /** instance of the HOMER library manager */
196 AliHLTHOMERLibManager* fpLibManager; // !transient
197
2c0e5942 198 /** global options for all instances */
199 static int fgOptions; //! transient
200
c5123824 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
6478b06b 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)
c4228ec4 217};
218#endif