4 #ifndef ALIHLTDATAGENERATOR_H
5 #define ALIHLTDATAGENERATOR_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 AliHLTDataGenerator.h
11 @author Matthias Richter
13 @brief An HLT file publishing (data source) component.
14 @note The class is used in Offline (AliRoot) context
17 #include "AliHLTProcessor.h"
20 * @class AliHLTDataGenerator
21 * An HLT data source component to produce random data.
23 * Component ID: \b DataGenerator <br>
24 * Library: \b libAliHLTUtil.
26 * Mandatory arguments: <br>
27 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
28 * \li -datatype <i> datatype dataorigin </i> <br>
29 * data type ID and origin, e.g. <tt>-datatype 'CLUSTERS' 'TPC ' </tt>
30 * \li -dataspec <i> specification </i> <br>
31 * data specification treated as decimal number or hex number if
33 * \li -minsize <i> size </i> <br>
34 * the minimum size of the data to be produced
35 * \li -maxsize <i> size </i> <br>
36 * the maximum size of the data to be produced, default = minsize
38 * Optional arguments:<br>
39 * \li -divisor <i> m </i> <br>
40 * a divisor to shrink the size after \em modulo events
41 * \li -offset <i> m </i> <br>
42 * an offset to subtract from the size after \em modulo events
43 * \li -modulo <i> n </i> <br>
44 * size manipulated by the disisor or subtractor after \em n events
46 * The component produces data blocks of random content and random size in the
47 * range of [\em minsize , \em maxsize ]. The size arguments can contain 'k' or
48 * 'M' to indicate kByte or MByte.
50 * @ingroup alihlt_util_components
52 class AliHLTDataGenerator : public AliHLTProcessor {
54 /** standard constructor */
55 AliHLTDataGenerator();
57 virtual ~AliHLTDataGenerator();
59 const char* GetComponentID();
60 void GetInputDataTypes( AliHLTComponentDataTypeList& list);
61 AliHLTComponentDataType GetOutputDataType();
62 int GetOutputDataTypes(vector<AliHLTComponentDataType>& tgtList);
63 void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
64 AliHLTComponent* Spawn();
67 int DoInit( int argc, const char** argv );
69 int DoEvent( const AliHLTComponentEventData& evtData,
70 const AliHLTComponentBlockData* blocks,
71 AliHLTComponentTriggerData& trigData,
72 AliHLTUInt8_t* outputPtr,
74 AliHLTComponentBlockDataList& outputBlocks );
76 using AliHLTProcessor::DoEvent;
79 * Scan one argument and adjacent parameters.
80 * Can be overloaded by child classes in order to add additional arguments
81 * beyond the standard arguments of the file publisher. The method is called
82 * whenever a non-standard argument is recognized.
83 * @param argc size of the argument array
84 * @param argv agument array for component initialization
85 * @return number of processed members of the argv <br>
86 * -EINVAL unknown argument <br>
87 * -EPROTO parameter for argument missing <br>
89 virtual int ScanArgument(int argc, const char** argv);
93 * Scan a size argument.
94 * The argument is expected to be an integer, which can be suffixed by 'k'
95 * or 'M' in order to indicate the base, kByte or MByte.
96 * @param size target to store the size
97 * @param arg the argument to scan
99 int ScanSizeArgument(AliHLTUInt32_t &size, const char* arg);
102 * Scan a float argument.
103 * @param value target to store the size
104 * @param arg the argument to scan
106 int ScanFloatArgument(float &value, const char* arg);
109 /** prohibit copy constructor */
110 AliHLTDataGenerator(const AliHLTDataGenerator&);
111 /** prohibit assignment operator */
112 AliHLTDataGenerator& operator=(const AliHLTDataGenerator&);
115 AliHLTComponentDataType fDataType; //! transient
118 AliHLTUInt32_t fSpecification; //! transient
120 // mode 1: just fake data independent of the input data
122 /** the original size size */
123 AliHLTUInt32_t fSize; //! transient
124 /** the manipulated size */
125 AliHLTUInt32_t fCurrSize; //! transient
126 /** divisor: each modulo event ignoring the input data size) */
127 AliHLTUInt32_t fDivisor; //! transient
128 /** decrement: each modulo event ignoring the input data size */
129 AliHLTUInt32_t fDecrement; //! transient
130 /** modulo for size manipulation */
131 AliHLTUInt32_t fModulo; //! transient
133 // mode 2: generate data depending on input data size
135 /** offset (generation of data from input data size) */
136 AliHLTUInt32_t fOffset; //! transient
137 /** multiplier (generation of data from input data size) */
138 float fMultiplier; //! transient
140 /** range: +/- *size */
141 float fRange; //! transient
143 ClassDef(AliHLTDataGenerator, 0)