4 #ifndef ALIHLTBENCHEXTERNALTRACKCOMPONENT_H
5 #define ALIHLTBENCHEXTERNALTRACKCOMPONENT_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 AliHLTBenchExternalTrackComponent.h
11 @author Matthias Richter
13 @brief Benchmark component for AliExternalTrackParam transportation.
16 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
18 #include "AliHLTProcessor.h"
20 class AliExternalTrackParam;
21 class AliHLTExternalTrackParam;
28 * @class AliHLTBenchExternalTrackComponent
29 * A component publishing arrays of randomly filled AliExternalTrackParam
30 * structures in different forms. Currently supported is TClonesArray,
31 * TObjArray, and C Array.
33 * The component can both publish and receive data blocks. If data blocks
34 * are available on the input, the array is restored and forwarded in the
35 * specified publishing mode with specified compression level.
37 * <h2>General properties:</h2>
39 * Component ID: \b BenchmarkAliExternalTrackParam <br>
40 * Library: \b libAliHLTBenchmark.so <br>
41 * Input Data Types: ::kAliHLTDataTypeTrack, ::kAliHLTDataTypeTObjArray <br>
42 * Output Data Types: ::kAliHLTDataTypeTrack, ::kAliHLTDataTypeTObjArray <br>
44 * <h2>Mandatory arguments:</h2>
45 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
46 * By default, publishing of the array is switched off. It has to be enabled
47 * by one of the three options
50 * \li -tclonesarray <br>
51 * publish TClonesArray
55 * <h2>Optional arguments:</h2>
56 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
57 * \li -maxsize <i> max array size </i> <br>
58 * \li -minsize <i> min array size </i> <br>
60 * \li -rangemodulo <i> count </i> <br>
61 * number of events after which the range is changed
62 * \li -rangeoffset <i> offset </i> <br>
63 * offset is added to min and max range after the specified number of
64 * events. Idially, this offset is negative, causing decreasing range
66 * \li -rangefactor <i> factor </i> <br>
67 * min and max range are multiplied by the factor (float) after the
68 * specified number of events.
70 * \li -verbosity <i> level </i> <br>
71 * different levels of verbosity: 0 (default) is silent
73 * <h2>Configuration:</h2>
74 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
76 * <h2>Default CDB entries:</h2>
77 * The component has no default CDB entries.
79 * <h2>Performance:</h2>
82 * <h2>Memory consumption:</h2>
85 * <h2>Output size:</h2>
88 * By using the range alterator options, the range can be changed after a
89 * certain number of events.
91 * @ingroup alihlt_benchmark_components
93 class AliHLTBenchExternalTrackComponent : public AliHLTProcessor {
95 /** default constructor */
96 AliHLTBenchExternalTrackComponent();
98 virtual ~AliHLTBenchExternalTrackComponent();
100 // interface functions: property getters
101 const char* GetComponentID();
102 void GetInputDataTypes(AliHLTComponentDataTypeList& list);
103 AliHLTComponentDataType GetOutputDataType();
104 int GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList);
105 void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
106 AliHLTComponent* Spawn();
109 * Fill members of the track object with random float values.
110 * @param track reference to AliExternalTrackParam object
111 * @param fillCov number of elements of the covar members to be filled
114 static int FillRandom(AliExternalTrackParam* track, int fillCov=15);
117 * Serialize an object or clones array of AliExternalTrackParam objects
118 * to a buffer using the definition AliHLTExternalTrackParam.
119 * @param pArray the array
120 * @param buffer target buffer
121 * @param size buffer size
122 * @return bytes filled to the buffer, neg. error code if failed
124 static int SerializeToStruct(const TObjArray* pArray, AliHLTUInt8_t* buffer, unsigned int size);
127 * Translate AliHLTExternalTrackParam struct into objects.
128 * The TObjArray can also be a TClonesArray and must have enough capacity.
130 static int ReadFromStruct(TObjArray* pTgtArray, AliHLTExternalTrackParam* pArray, unsigned int arraySize);
133 * Calculate a crc checksum for the object array
135 static AliHLTUInt32_t CalcChecksum(const TObjArray* pArray);
138 * Compare two arrays of AliExternalTrackParamElements
140 static bool Compare(const TObjArray* array1, const TObjArray* array2);
143 * Find object in the registry
145 static TObject* FindObject(AliHLTUInt32_t id);
155 // interface functions: processing
156 int DoInit(int argc, const char** argv);
158 int DoEvent( const AliHLTComponentEventData& evtData,
159 const AliHLTComponentBlockData* blocks,
160 AliHLTComponentTriggerData& trigData,
161 AliHLTUInt8_t* outputPtr,
162 AliHLTUInt32_t& size,
163 AliHLTComponentBlockDataList& outputBlocks );
166 * Register object and create reference id
167 * The registry is used for consistency checks in a single threaded system.
168 * The dump component can access the original object and compare the two.
170 AliHLTUInt32_t Register(TObject* pObject);
173 * Remove object from registry
175 int Unregister(TObject* pObject);
178 /** copy constructor prohibited */
179 AliHLTBenchExternalTrackComponent(const AliHLTBenchExternalTrackComponent&);
180 /** assignment operator prohibited */
181 AliHLTBenchExternalTrackComponent& operator=(const AliHLTBenchExternalTrackComponent&);
184 int fVerbosity; //!transient
186 /** disable global object registry, no check pf received objects */
187 bool fDisableRegistry; //! transient
189 /** publishing mode: off, ktclonesarray, ktobjarray, kcarray */
190 int fMode; //! transient
192 /** maximum array size */
193 int fMaxSize; //! transient
195 /** minimum array size */
196 int fMinSize; //! transient
198 /** event count for the next automatic change of range */
201 /** offset is added to range after fEventModulo events */
204 /** range is multiplied after fEventModulo events */
205 float fRangeMultiplicator;
207 /** the internal array */
208 TClonesArray* fpTcArray; //! transient
210 /** TObjArray this publishing mode was used */
211 TObjArray* fpTObjArray; //! transient
213 /** random number generator */
214 TRandom* fpDice; //! transient
216 /** registry of object arrays */
217 static TList* fgpRegistry; //! transient
219 ClassDef(AliHLTBenchExternalTrackComponent, 0);