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 *
9 /** @file AliHLTOUTComponent.h
10 @author Matthias Richter
12 @brief The HLTOUT data sink component similar to HLTOUT nodes
15 // see class description below
17 // refer to README to build package
19 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
21 #include "AliHLTOfflineDataSink.h"
23 class AliHLTHOMERLibManager;
24 class AliHLTMonitoringWriter;
27 typedef vector<AliHLTMonitoringWriter*> AliHLTMonitoringWriterPVector;
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>
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>
40 * <h2>Mandatory arguments:</h2>
41 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
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
48 * <h2>Configuration:</h2>
49 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
52 * <h2>Default CDB entries:</h2>
55 * <h2>Performance:</h2>
56 * The component does not any event data processing.
58 * <h2>Memory consumption:</h2>
59 * The component does not any event data processing.
61 * <h2>Output size:</h2>
62 * The component is an offline sink component and has no output data.
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
70 * @ingroup alihlt_aliroot_simulation
72 class AliHLTOUTComponent : public AliHLTOfflineDataSink {
74 /** standard constructor */
77 virtual ~AliHLTOUTComponent();
79 const char* GetComponentID();
80 void GetInputDataTypes( vector<AliHLTComponentDataType>& list);
81 AliHLTComponent* Spawn();
84 * Enable global options valid for all instances of the component
85 * @param options bit field
87 static void SetGlobalOption(unsigned int options);
90 * Disable global options valid for all instances of the component
91 * @param options bit field
93 static void ClearGlobalOption(unsigned int options);
96 /** write the raw files of the HLT links */
98 /** write the digit file */
106 int DoInit( int argc, const char** argv );
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
120 int DumpEvent( const AliHLTComponentEventData& evtData,
121 const AliHLTComponentBlockData* blocks,
122 AliHLTComponentTriggerData& trigData );
124 using AliHLTDataSink::DumpEvent;
127 * Fill ESD for one event.
128 * @param eventNo event No. \em Note: this is an internal enumeration of the
130 * @param runLoader the AliRoot runloader
131 * @param esd an AliESDEvent instance
132 * @return neg. error code if failed
134 int FillESD(int eventNo, AliRunLoader* runLoader, AliESDEvent* esd);
137 /** copy constructor prohibited */
138 AliHLTOUTComponent(const AliHLTOUTComponent&);
139 /** assignment operator prohibited */
140 AliHLTOUTComponent& operator=(const AliHLTOUTComponent&);
142 int ShuffleWriters(AliHLTMonitoringWriterPVector &list, AliHLTUInt32_t size);
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
154 int FillOutputBuffer(int eventNo, AliHLTMonitoringWriter* pWriter, const AliHLTUInt8_t* &pBuffer);
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
162 int WriteDigitArray(int hltddl, const AliHLTUInt8_t* pBuffer, unsigned int bufferSize);
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
170 int WriteDigits(int eventNo, AliRunLoader* runLoader);
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
181 int WriteRawFile(int eventNo, AliRunLoader* runLoader, int hltddl, const AliHLTUInt8_t* pBuffer, unsigned int size);
183 /** list of HOMER writers */
184 AliHLTMonitoringWriterPVector fWriters; //!transient
186 /** number of DDLs used*/
187 int fNofDDLs; //!transient
189 /** equipment ID of first HLT DDL */
190 int fIdFirstDDL; //!transient
192 /** output buffer, allocated once in order to avoid frequent alloc/dealloc */
193 vector<AliHLTUInt8_t> fBuffer; //!transient
195 /** instance of the HOMER library manager */
196 AliHLTHOMERLibManager* fpLibManager; // !transient
198 /** global options for all instances */
199 static int fgOptions; //! transient
201 /** the root file for the HLT 'digit' output */
202 TFile* fpDigitFile; //!transient
204 /** the tree for the HLT 'digit' output */
205 TTree* fpDigitTree; //!transient
207 /** array of TArrayC output buffers and branches */
208 TArrayC** fppDigitArrays; //!transient
210 /** Id of HOMER writer kept from previous event */
211 int fReservedWriter; //!transient
213 /** Data size kept in the internal buffer */
214 int fReservedData; //!transient
216 ClassDef(AliHLTOUTComponent, 3)