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 */
10 /** @file AliHLTRawReaderPublisherComponent.h
11 @author Matthias Richter
13 @brief A general data publisher component for the AliRawReader.
16 // see header file for class documentation
18 // refer to README to build package
20 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
22 #include "AliHLTOfflineDataSource.h"
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.
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.
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.
37 * Component ID: \b AliRawReaderPublisher <br>
38 * Library: \b libAliHLTUtil.
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)
51 * print out some more info messages, mainly for the sake of tutorials
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
61 * Optional arguments:<br>
64 * @ingroup alihlt_system
66 class AliHLTRawReaderPublisherComponent : public AliHLTOfflineDataSource {
68 /** standard constructor */
69 AliHLTRawReaderPublisherComponent();
71 virtual ~AliHLTRawReaderPublisherComponent();
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)
79 const char* GetComponentID();
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
86 AliHLTComponentDataType GetOutputDataType();
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
93 * @param inputMultiplier <i>return</i>: multiplication ratio
94 * @return values in the reference variables
96 void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
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
104 virtual AliHLTComponent* Spawn();
110 int DoInit( int argc, const char** argv );
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
127 int GetEvent( const AliHLTComponentEventData& evtData,
128 AliHLTComponentTriggerData& trigData,
129 AliHLTUInt8_t* outputPtr,
130 AliHLTUInt32_t& size,
131 vector<AliHLTComponentBlockData>& outputBlocks );
133 using AliHLTOfflineDataSource::GetEvent;
136 virtual int GetSpecificationFromEquipmentId(int id, AliHLTUInt32_t &specification) const;
139 /** copy constructor prohibited */
140 AliHLTRawReaderPublisherComponent(const AliHLTRawReaderPublisherComponent&);
141 /** assignment operator prohibited */
142 AliHLTRawReaderPublisherComponent& operator=(const AliHLTRawReaderPublisherComponent&);
144 /** max output block size, estimated during DoInit */
145 Int_t fMaxSize; //!transient
147 /** detector string */
148 TString fDetector; //!transient
150 /** min equipment id */
151 int fMinEquId; //!transient
153 /** max equipment id */
154 int fMaxEquId; //!transient
156 /** be verbose: info printouts */
157 Bool_t fVerbose; //!transient
160 AliHLTComponentDataType fDataType; //!transient
162 /** data specification */
163 AliHLTUInt32_t fSpecification; //!transient
165 /** skip the generation of empty data blocks */
166 Bool_t fSkipEmpty; //!transient
168 ClassDef(AliHLTRawReaderPublisherComponent, 1);