]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/BASE/util/AliHLTLoaderPublisherComponent.h
Major update required to handle old and new AliHLTEventDDL structures within HLT...
[u/mrichter/AliRoot.git] / HLT / BASE / util / AliHLTLoaderPublisherComponent.h
1 //-*- Mode: C++ -*-
2 // @(#) $Id$
3
4 #ifndef ALIHLTLOADERPUBLISHERCOMPONENT_H
5 #define ALIHLTLOADERPUBLISHERCOMPONENT_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   AliHLTLoaderPublisherComponent.h
11     @author Matthias Richter
12     @date   
13     @brief  A general tree publisher component for the AliLoader.
14 */
15
16 #include "AliHLTOfflineDataSource.h"
17
18 class AliLoader;
19
20 /**
21  * @class AliHLTLoaderPublisherComponent
22  * A general tree publisher component for the AliLoader.
23  * 
24  * <h2>General properties:</h2>
25  *
26  * Component ID: \b AliLoaderPublisher                                  <br>
27  * Library: \b libAliHLTUtil.so                                         <br>
28  * Input Data Types: none                                               <br>
29  * Output Data Types: according to parameter, suggested types:          <br>
30  * \li ::kAliHLTDataTypeAliTreeD for the digit tree
31  * \li ::kAliHLTDataTypeAliTreeR for the cluster tree
32  * , see @ref alihlt_component_datatypes                                <br>
33  *
34  * <h2>Mandatory arguments:</h2>
35  * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
36  * \li -loader       <i> loader name      </i>
37  *      e.g. <tt> -loader TPCLoader </tt>
38  *
39  * <h2>Optional arguments:</h2>
40  * \li -tree         <i> tree name </i> : digits (default), clusters     
41  *      e.g. <tt> -tree digits </tt>
42  * \li -verbose<br>
43  *      print out some more info messages, mainly for the sake of tutorials
44  * \li -datatype     <i> datatype   dataorigin </i> <br>
45  *      data type ID and origin, e.g. <tt>-datatype 'ALITREED' 'TPC ' </tt>
46  * \li -dataspec     <i> specification </i> <br>
47  *      data specification treated as decimal number or hex number if
48  *      prepended by '0x'
49  *
50  * <h2>Configuration:</h2>
51  * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
52  * no configuration
53  *
54  * <h2>Default CDB entries:</h2>
55  * The component loads no CDB entries.
56  *
57  * <h2>Performance:</h2>
58  * The component does not process any event data.
59  *
60  * <h2>Memory consumption:</h2>
61  * The component does not process any event data.
62  *
63  * <h2>Output size:</h2>
64  * According to the available data. The component is an AliHLTDataSource
65  * and inteded to be used in the AliHLTSystem framework only. The component
66  * implements the standard AliHLTSystem adaptive buffer allocation. 
67  *
68  *
69  * @ingroup alihlt_util_components
70  */
71 class AliHLTLoaderPublisherComponent : public AliHLTOfflineDataSource {
72  public:
73   /** standard constructor */
74   AliHLTLoaderPublisherComponent();
75   /** destructor */
76   virtual ~AliHLTLoaderPublisherComponent();
77
78   /**
79    * Get the id of the component.
80    * Each component is identified by a unique id.
81    * The function is pure virtual and must be implemented by the child class.
82    * @return component id (string)
83    */
84   const char* GetComponentID();
85
86   /**
87    * Get the output data type of the component.
88    * The function is pure virtual and must be implemented by the child class.
89    * @return output data type
90    */
91   AliHLTComponentDataType GetOutputDataType();
92
93   /**
94    * Get a ratio by how much the data volume is shrinked or enhanced.
95    * The function is pure virtual and must be implemented by the child class.
96    * @param constBase        <i>return</i>: additive part, independent of the
97    *                                   input data volume  
98    * @param inputMultiplier  <i>return</i>: multiplication ratio
99    * @return values in the reference variables
100    */
101   void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
102
103   /**
104    * Spawn function.
105    * Each component must implement a spawn function to create a new instance of 
106    * the class. Basically the function must return <i>new <b>my_class_name</b></i>.
107    * @return new class instance
108    */
109   virtual AliHLTComponent* Spawn();
110
111  protected:
112   /**
113    * Init method.
114    */
115   int DoInit( int argc, const char** argv );
116
117   /**
118    * Deinit method.
119    */
120   int DoDeinit();
121
122   /**
123    * Data source method.
124    * @param evtData       event data structure
125    * @param trigData      trigger data structure
126    * @return
127    */
128   int GetEvent(const AliHLTComponentEventData& evtData,
129                AliHLTComponentTriggerData& trigData);
130
131   using AliHLTOfflineDataSource::GetEvent;
132
133  private:
134   /** copy constructor prohibited */
135   AliHLTLoaderPublisherComponent(const AliHLTLoaderPublisherComponent&);
136   /** assignment operator prohibited */
137   AliHLTLoaderPublisherComponent& operator=(const AliHLTLoaderPublisherComponent&);
138
139   /**
140    * Get tree of type specified in fTreeType from loader.
141    */
142   TTree* GetTree();
143
144   /** max output block size, estimated during DoInit */
145   Int_t                   fMaxSize;                                //!transient
146
147   /** loader string */
148   TString                 fLoaderType;                             //!transient
149
150   /** tree string */
151   TString                 fTreeType;                               //!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   /** instance of the AliLoader */
163   AliLoader*              fpLoader;                                //!transient
164
165   ClassDef(AliHLTLoaderPublisherComponent, 0);
166 };
167
168 #endif