]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/BASE/util/AliHLTRawReaderPublisherComponent.h
- added skeleton of of offline clusterizer and tracker components
[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 formatting -->
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 -skipempty
53  *      skip all empty ddls in the specified range; by default, the component
54  *      generates and inserts empty data blocks
55  * \li -datatype     <i> datatype   dataorigin </i> <br>
56  *      data type ID and origin, e.g. <tt>-datatype DIGITS TPC </tt>
57  * \li -dataspec     <i> specification </i> <br>
58  *      data specification treated as decimal number or hex number if
59  *      prepended by '0x'
60  *
61  * Optional arguments:<br>
62  *
63  *
64  * @ingroup alihlt_system
65  */
66 class AliHLTRawReaderPublisherComponent : public AliHLTOfflineDataSource {
67  public:
68   /** standard constructor */
69   AliHLTRawReaderPublisherComponent();
70   /** destructor */
71   virtual ~AliHLTRawReaderPublisherComponent();
72
73   /**
74    * Get the id of the component.
75    * Each component is identified by a unique id.
76    * The function is pure virtual and must be implemented by the child class.
77    * @return component id (string)
78    */
79   const char* GetComponentID();
80
81   /**
82    * Get the output data type of the component.
83    * The function is pure virtual and must be implemented by the child class.
84    * @return output data type
85    */
86   AliHLTComponentDataType GetOutputDataType();
87
88   /**
89    * Get a ratio by how much the data volume is shrinked or enhanced.
90    * The function is pure virtual and must be implemented by the child class.
91    * @param constBase        <i>return</i>: additive part, independent of the
92    *                                   input data volume  
93    * @param inputMultiplier  <i>return</i>: multiplication ratio
94    * @return values in the reference variables
95    */
96   void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
97
98   /**
99    * Spawn function.
100    * Each component must implement a spawn function to create a new instance of 
101    * the class. Basically the function must return <i>new <b>my_class_name</b></i>.
102    * @return new class instance
103    */
104   virtual AliHLTComponent* Spawn();
105
106  protected:
107   /**
108    * Init method.
109    */
110   int DoInit( int argc, const char** argv );
111
112   /**
113    * Deinit method.
114    */
115   int DoDeinit();
116
117   /**
118    * Data source method.
119    * @param evtData       event data structure
120    * @param trigData      trigger data structure
121    * @param outputPtr     pointer to target buffer
122    * @param size          <i>input</i>: size of target buffer
123    *                      <i>output</i>:size of produced data
124    * @param outputBlocks  list to receive output block descriptors
125    * @return neg. error code if failed
126    */
127   int GetEvent( const AliHLTComponentEventData& evtData,
128                 AliHLTComponentTriggerData& trigData,
129                 AliHLTUInt8_t* outputPtr, 
130                 AliHLTUInt32_t& size,
131                 vector<AliHLTComponentBlockData>& outputBlocks );
132
133   using AliHLTOfflineDataSource::GetEvent;
134
135  protected:
136   virtual int GetSpecificationFromEquipmentId(int id, AliHLTUInt32_t &specification) const;
137
138  private:
139   /** copy constructor prohibited */
140   AliHLTRawReaderPublisherComponent(const AliHLTRawReaderPublisherComponent&);
141   /** assignment operator prohibited */
142   AliHLTRawReaderPublisherComponent& operator=(const AliHLTRawReaderPublisherComponent&);
143
144   /** max output block size, estimated during DoInit */
145   Int_t                   fMaxSize;                                //!transient
146
147   /** detector string */
148   TString                 fDetector;                               //!transient
149
150   /** min equipment id */
151   int                     fMinEquId;                               //!transient
152
153   /** max equipment id */
154   int                     fMaxEquId;                               //!transient
155
156   /** be verbose: info printouts */
157   Bool_t                  fVerbose;                                //!transient
158
159   /** data type */
160   AliHLTComponentDataType fDataType;                               //!transient
161
162   /** data specification */
163   AliHLTUInt32_t          fSpecification;                          //!transient
164
165   /** skip the generation of empty data blocks */
166   Bool_t                  fSkipEmpty;                              //!transient
167
168   ClassDef(AliHLTRawReaderPublisherComponent, 1);
169 };
170
171 #endif