]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/BASE/util/AliHLTRawReaderPublisherComponent.h
- The default value of useFastDecoder in ctor changed to kFALSE,
[u/mrichter/AliRoot.git] / HLT / BASE / util / AliHLTRawReaderPublisherComponent.h
1 //-*- Mode: C++ -*-
2 // @(#) $Id$
3
4 #ifndef ALIHLTRAWREADERPUBLISHERCOMPONENT_H
5 #define ALIHLTRAWREADERPUBLISHERCOMPONENT_H
6 /* This file is property of and copyright by the ALICE HLT Project        * 
7  * ALICE Experiment at CERN, All rights reserved.                         *
8  * See cxx source for full Copyright notice                               */
9
10 /** @file   AliHLTRawReaderPublisherComponent.h
11     @author Matthias Richter
12     @date   
13     @brief  A general data publisher component for the AliRawReader.
14 */
15
16 // see header file for class documentation
17 // or
18 // refer to README to build package
19 // or
20 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
21
22 #include "AliHLTOfflineDataSource.h"
23
24 /**
25  * @class AliHLTRawReaderPublisherComponent
26  * A general data publisher component for the AliRawReader.
27  * The component publishs the data of a given detector and equipment ID.
28  * 
29  * If no data specification is given, the equipment id is used as default.
30  * A child class can implement @ref GetSpecificationFromEquipmentId to
31  * provide a different rule.
32  *
33  * The component publishes one data block for each equipment id in the
34  * give range. If the RawReader does not provide any data, an empty data
35  * block consisting of the Common Data Header is produced. 
36  * 
37  * Component ID: \b AliRawReaderPublisher <br>
38  * Library: \b libAliHLTUtil.
39  *
40  * Mandatory arguments: <br>
41  * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formating -->
42  * \li -detector     <i> detector name      </i>
43  *      e.g. <tt> -detector TPC </tt>
44  * \li -equipmentid  <i> id      </i>
45  *      the equipmentid within the detector, e.g. TPC 0 is 768
46  * \li -minid  <i> id      </i>
47  *      the minimum equipmentid including detector offset, e.g. 768 is TPC 0
48  * \li -maxid  <i> id      </i>
49  *      the maximum equipmentid including detector offset (default = minid)
50  * \li -verbose<br>
51  *      print out some more info messages, mainly for the sake of tutorials
52  * \li -datatype     <i> datatype   dataorigin </i> <br>
53  *      data type ID and origin, e.g. <tt>-datatype DIGITS TPC </tt>
54  * \li -dataspec     <i> specification </i> <br>
55  *      data specification treated as decimal number or hex number if
56  *      prepended by '0x'
57  *
58  * Optional arguments:<br>
59  *
60  *
61  * @ingroup alihlt_system
62  */
63 class AliHLTRawReaderPublisherComponent : public AliHLTOfflineDataSource {
64  public:
65   /** standard constructor */
66   AliHLTRawReaderPublisherComponent();
67   /** destructor */
68   virtual ~AliHLTRawReaderPublisherComponent();
69
70   /**
71    * Get the id of the component.
72    * Each component is identified by a unique id.
73    * The function is pure virtual and must be implemented by the child class.
74    * @return component id (string)
75    */
76   const char* GetComponentID();
77
78   /**
79    * Get the output data type of the component.
80    * The function is pure virtual and must be implemented by the child class.
81    * @return output data type
82    */
83   AliHLTComponentDataType GetOutputDataType();
84
85   /**
86    * Get a ratio by how much the data volume is shrinked or enhanced.
87    * The function is pure virtual and must be implemented by the child class.
88    * @param constBase        <i>return</i>: additive part, independent of the
89    *                                   input data volume  
90    * @param inputMultiplier  <i>return</i>: multiplication ratio
91    * @return values in the reference variables
92    */
93   void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
94
95   /**
96    * Spawn function.
97    * Each component must implement a spawn function to create a new instance of 
98    * the class. Basically the function must return <i>new <b>my_class_name</b></i>.
99    * @return new class instance
100    */
101   virtual AliHLTComponent* Spawn();
102
103  protected:
104   /**
105    * Init method.
106    */
107   int DoInit( int argc, const char** argv );
108
109   /**
110    * Deinit method.
111    */
112   int DoDeinit();
113
114   /**
115    * Data source method.
116    * @param evtData       event data structure
117    * @param trigData      trigger data structure
118    * @param outputPtr     pointer to target buffer
119    * @param size          <i>input</i>: size of target buffer
120    *                      <i>output</i>:size of produced data
121    * @param outputBlocks  list to receive output block descriptors
122    * @return neg. error code if failed
123    */
124   int GetEvent( const AliHLTComponentEventData& evtData,
125                 AliHLTComponentTriggerData& trigData,
126                 AliHLTUInt8_t* outputPtr, 
127                 AliHLTUInt32_t& size,
128                 vector<AliHLTComponentBlockData>& outputBlocks );
129
130   using AliHLTOfflineDataSource::GetEvent;
131
132  protected:
133   virtual int GetSpecificationFromEquipmentId(int id, AliHLTUInt32_t &specification) const;
134
135  private:
136   /** copy constructor prohibited */
137   AliHLTRawReaderPublisherComponent(const AliHLTRawReaderPublisherComponent&);
138   /** assignment operator prohibited */
139   AliHLTRawReaderPublisherComponent& operator=(const AliHLTRawReaderPublisherComponent&);
140
141   /** max output block size, estimated during DoInit */
142   Int_t                   fMaxSize;                                //!transient
143
144   /** detector string */
145   TString                 fDetector;                               //!transient
146
147   /** min equipment id */
148   int                     fMinEquId;                               //!transient
149
150   /** max equipment id */
151   int                     fMaxEquId;                               //!transient
152
153   /** be verbose: info printouts */
154   Bool_t                  fVerbose;                                //!transient
155
156   /** data type */
157   AliHLTComponentDataType fDataType;                               //!transient
158
159   /** data specification */
160   AliHLTUInt32_t          fSpecification;                          //!transient
161
162   ClassDef(AliHLTRawReaderPublisherComponent, 0);
163 };
164
165 #endif