]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/sim/AliHLTOUTComponent.h
754e249b90b03747da9b7fed61e873b1c17873d9
[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 <vector>
22 #include "AliHLTOfflineDataSink.h"
23 #include "AliHLTHOMERLibManager.h"
24
25 class AliHLTMonitoringWriter;
26 typedef vector<AliHLTMonitoringWriter*> AliHLTMonitoringWriterPVector;
27
28 /**
29  * @class AliHLTOUTComponent
30  * The HLTOUT data sink component which models the behavior of the HLTOUT
31  * nodes of the HLT cluster.
32  * @ingroup alihlt_component
33  */
34 class AliHLTOUTComponent : public AliHLTOfflineDataSink  {
35  public:
36   /** standard constructor */
37   AliHLTOUTComponent();
38   /** destructor */
39   virtual ~AliHLTOUTComponent();
40
41   const char* GetComponentID();
42   void GetInputDataTypes( vector<AliHLTComponentDataType>& list);
43   AliHLTComponent* Spawn();
44
45  protected:
46   /**
47    * Init method.
48    */
49   int DoInit( int argc, const char** argv );
50
51   /**
52    * Deinit method.
53    */
54   int DoDeinit();
55
56   /**
57    * Data processing method for the component.
58    * The function can be overloaded by other file writer components.
59    * @param evtData       event data structure
60    * @param blocks        input data block descriptors
61    * @param trigData      trigger data structure
62    */
63   int DumpEvent( const AliHLTComponentEventData& evtData,
64                  const AliHLTComponentBlockData* blocks, 
65                  AliHLTComponentTriggerData& trigData );
66
67   using AliHLTDataSink::DumpEvent;
68
69   /**
70    * Fill ESD for one event.
71    * @param eventNo       event No. \em Note: this is an internal enumeration of the
72    *                      processed events.
73    * @param runLoader     the AliRoot runloader
74    * @param esd           an AliESDEvent instance
75    * @return neg. error code if failed 
76    */
77   int FillESD(int eventNo, AliRunLoader* runLoader, AliESDEvent* esd);
78
79  private:
80   /** copy constructor prohibited */
81   AliHLTOUTComponent(const AliHLTOUTComponent&);
82   /** assignment operator prohibited */
83   AliHLTOUTComponent& operator=(const AliHLTOUTComponent&);
84
85   int ShuffleWriters(AliHLTMonitoringWriterPVector &list, AliHLTUInt32_t size);
86
87   /**
88    * Fill the output buffer and allocate if neccessary.
89    * Assemble ouput buffer with Common Data Header, HLT header and data from the
90    * writer. Works on the same buffer witch is allocated once and eventually
91    * grown in order to avoid frequent allocs/deallocs.   
92    * @param eventNo    number of the event
93    * @param pWriter    [IN]  the HOMER writer
94    * @param pBuffer    [OUT] target to receive the pointer to buffer
95    * @return size of the buffer
96    */
97   int FillOutputBuffer(int eventNo, AliHLTMonitoringWriter* pWriter, const AliHLTUInt8_t* &pBuffer);
98
99   /**
100    * Write the digits for one DDL
101    * @param eventNo    number of the event
102    * @param runLoader  AliRoot run loader instance
103    * @param hltddl     Number of DDL link within the range of HLT
104    * @param pBuffer    buffer to write
105    * @param size       size of the buffer
106    * @return neg. error if failed
107    */
108   int WriteDigits(int eventNo, AliRunLoader* runLoader, int hltddl, const AliHLTUInt8_t* pBuffer, int size);
109
110   /**
111    * Write the raw file for one DDL
112    * @param eventNo    number of the event
113    * @param runLoader  AliRoot run loader instance
114    * @param hltddl     Number of DDL link within the range of HLT
115    * @param pBuffer    buffer to write
116    * @param size       size of the buffer
117    * @return neg. error if failed
118    */
119   int WriteRawFile(int eventNo, AliRunLoader* runLoader, int hltddl, const AliHLTUInt8_t* pBuffer, int size);
120
121   /** list of HOMER writers */
122   AliHLTMonitoringWriterPVector fWriters; //!transient
123
124   /** number of DDLs used*/
125   int fNofDDLs; //!transient
126
127   /** equipment ID of first HLT DDL */
128   int fIdFirstDDL; //!transient
129
130   /** write digits or not */
131   Bool_t fWriteDigits; //!transient
132
133   /** write raw file or not */
134   Bool_t fWriteRaw; //!transient
135
136   /** output buffer, allocated once in order to avoid frequent alloc/dealloc */
137   vector<AliHLTUInt8_t> fBuffer; //!transient
138
139   /** instance of the HOMER library manager */
140   AliHLTHOMERLibManager* fpLibManager; // !transient
141
142   ClassDef(AliHLTOUTComponent, 0)
143 };
144 #endif