Line data Source code
1 : //-*- Mode: C++ -*-
2 : // $Id$
3 :
4 : #ifndef ALIHLTRAWREADERPUBLISHERCOMPONENT_H
5 : #define ALIHLTRAWREADERPUBLISHERCOMPONENT_H
6 : //* This file is property of and copyright by the *
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 : #include "AliHLTOfflineDataSource.h"
17 :
18 : /**
19 : * @class AliHLTRawReaderPublisherComponent
20 : * A general data publisher component for the AliRawReader.
21 : * The component publishs the data of a given detector and equipment ID.
22 : *
23 : * If no data specification is given, the equipment id is used as default.
24 : * A child class can implement @ref GetSpecificationFromEquipmentId to
25 : * provide a different rule.
26 : *
27 : * The component publishes one data block for each equipment id in the
28 : * give range. If the RawReader does not provide any data, an empty data
29 : * block consisting of the Common Data Header is produced.
30 : *
31 : * <h2>General properties:</h2>
32 : *
33 : * Component ID: \b AliRawReaderPublisher <br>
34 : * Library: \b libAliHLTUtil.so <br>
35 : * Input Data Types: none <br>
36 : * Output Data Types: according to parameters and available RAW data <br>
37 : *
38 : * <h2>Mandatory arguments:</h2>
39 : * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
40 : * The equipment id(s) must be defined by argument(s) out of:
41 : * \li -detector <i> detector name </i>
42 : * e.g. <tt> -detector TPC </tt>
43 : * \li -equipmentid <i> id </i>
44 : * the equipmentid within the detector, e.g. TPC 0 is 768
45 : * \li -minid <i> id </i>
46 : * the minimum equipmentid including detector offset, e.g. 768 is TPC 0<br>
47 : * if the -detector option is used, the id is without detector offset
48 : * \li -maxid <i> id </i>
49 : * the maximum equipmentid including detector offset (default = minid)<br>
50 : * if the -detector option is used, the id is without detector offset
51 : *
52 : * <h2>Optional arguments:</h2>
53 : * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
54 : * \li -verbose<br>
55 : * print out some more info messages, mainly for the sake of tutorials,
56 : * repetitive arguments increase the level each
57 : * \li -silent<br>
58 : * suppress all info messages
59 : * \li -skipempty
60 : * skip all empty ddls in the specified range; by default, the component
61 : * generates and inserts empty data blocks
62 : * \li -datatype <i> datatype dataorigin </i> <br>
63 : * data type ID and origin, e.g. <tt>-datatype DIGITS TPC </tt>
64 : * \li -dataspec <i> specification </i> <br>
65 : * data specification treated as decimal number or hex number if
66 : * prepended by '0x'
67 : *
68 : * <h2>Configuration:</h2>
69 : * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
70 : * Configuration by component arguments.
71 : *
72 : * <h2>Default CDB entries:</h2>
73 : * The component loads no CDB entries.
74 : *
75 : * <h2>Performance:</h2>
76 : * The component does not process any event data.
77 : *
78 : * <h2>Memory consumption:</h2>
79 : * The component does not process any event data.
80 : *
81 : * <h2>Output size:</h2>
82 : * According to the available data. The component is an AliHLTDataSource
83 : * and inteded to be used in the AliHLTSystem framework only. The component
84 : * implements the standard AliHLTSystem adaptive buffer allocation.
85 : *
86 : * @ingroup alihlt_util_components
87 : */
88 : class AliHLTRawReaderPublisherComponent : public AliHLTOfflineDataSource {
89 : public:
90 : /** standard constructor */
91 : AliHLTRawReaderPublisherComponent();
92 : /** destructor */
93 : virtual ~AliHLTRawReaderPublisherComponent();
94 :
95 : /**
96 : * Get the id of the component.
97 : * Each component is identified by a unique id.
98 : * The function is pure virtual and must be implemented by the child class.
99 : * @return component id (string)
100 : */
101 : const char* GetComponentID();
102 :
103 : /**
104 : * Get the output data type of the component.
105 : * The function is pure virtual and must be implemented by the child class.
106 : * @return output data type
107 : */
108 : virtual AliHLTComponentDataType GetOutputDataType();
109 :
110 : /**
111 : * Get a ratio by how much the data volume is shrinked or enhanced.
112 : * The function is pure virtual and must be implemented by the child class.
113 : * @param constBase <i>return</i>: additive part, independent of the
114 : * input data volume
115 : * @param inputMultiplier <i>return</i>: multiplication ratio
116 : * @return values in the reference variables
117 : */
118 : void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
119 :
120 : /**
121 : * Spawn function.
122 : * Each component must implement a spawn function to create a new instance of
123 : * the class. Basically the function must return <i>new <b>my_class_name</b></i>.
124 : * @return new class instance
125 : */
126 : virtual AliHLTComponent* Spawn();
127 :
128 : protected:
129 : /// inherited from AliHLTComponent: component initialisation and argument scan.
130 : int DoInit( int argc, const char** argv );
131 :
132 : /// inherited from AliHLTComponent: component cleanup
133 : int DoDeinit();
134 :
135 : /// inherited from AliHLTComponent: scan configuration argument
136 : int ScanConfigurationArgument(int argc, const char** argv);
137 :
138 : /**
139 : * Data source method.
140 : * @param [in] evtData event data structure
141 : * @param [in] trigData trigger data structure
142 : * @param [in] outputPtr pointer to target buffer
143 : * @param [in,out] size <i>input</i>: size of target buffer
144 : * <i>output</i>:size of produced data
145 : * @param [in] outputBlocks list to receive output block descriptors
146 : * @return neg. error code if failed
147 : */
148 : int GetEvent( const AliHLTComponentEventData& evtData,
149 : AliHLTComponentTriggerData& trigData,
150 : AliHLTUInt8_t* outputPtr,
151 : AliHLTUInt32_t& size,
152 : AliHLTComponentBlockDataList& outputBlocks );
153 :
154 : using AliHLTOfflineDataSource::GetEvent;
155 :
156 : /// check if block is selected for publishing
157 : /// default method returns true, childs can overload to discard blocks
158 0 : virtual bool IsSelected(int /*equipmentId*/) const {return true;}
159 :
160 0 : int GetVerbosity() const {return fVerbosity;}
161 :
162 : protected:
163 : /// get the data specification from the equipment id
164 : /// default method just returns the equipment id
165 : virtual int GetSpecificationFromEquipmentId(int id, AliHLTUInt32_t &specification) const;
166 :
167 : /** max output block size, estimated during DoInit */
168 : Int_t fMaxSize; //!transient
169 :
170 : private:
171 : /** copy constructor prohibited */
172 : AliHLTRawReaderPublisherComponent(const AliHLTRawReaderPublisherComponent&);
173 : /** assignment operator prohibited */
174 : AliHLTRawReaderPublisherComponent& operator=(const AliHLTRawReaderPublisherComponent&);
175 :
176 : /** detector string */
177 : TString fDetector; //!transient
178 :
179 : /** min equipment id */
180 : int fMinEquId; //!transient
181 :
182 : /** max equipment id */
183 : int fMaxEquId; //!transient
184 :
185 : /** verbosity */
186 : Int_t fVerbosity; //!transient
187 :
188 : /** data type */
189 : AliHLTComponentDataType fDataType; //!transient
190 :
191 : /** data specification */
192 : AliHLTUInt32_t fSpecification; //!transient
193 :
194 : /** skip the generation of empty data blocks */
195 : Bool_t fSkipEmpty; //!transient
196 :
197 8 : ClassDef(AliHLTRawReaderPublisherComponent, 0);
198 : };
199 :
200 : #endif
|