4 #ifndef ALIHLTCOMPSTATCOLLECTOR_H
5 #define ALIHLTCOMPSTATCOLLECTOR_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 AliHLTCompStatCollector.h
11 @author Matthias Richter
13 @brief Collector component for the component statistics information.
16 #include "AliHLTProcessor.h"
28 * @class AliHLTCompStatCollector
29 * Collector component for the statistics entries produced by the
30 * AliHLTComponent base class.
32 * <h2>General properties:</h2>
33 * This components collects all data blocks of types
34 * ::kAliHLTDataTypeComponentStatistics and ::kAliHLTDataTypeComponentTable
35 * which can be produced by the AliHLTComponent base class for every component
36 * and event. Component statistics entries are data blocks of
37 * ::AliHLTComponentStatistics arrays containing a couple of informations
38 * about each component. The information is extracted and stored into a
39 * TTree. The component table entries (AliHLTComponentTable structs) are sent
40 * on SOR and EOR events and are arranged in a TFolder hierarchy.
42 * The objects are published or/and saved according to the setup. An
43 * event modulo marameter can be used to publish every nth event, a period
44 * argument to publish every nth second. The objects can be optionally saved
45 * directly to file and the publishing can be suppressed. The objects are
46 * published/saved at the EOR event.
48 * Component ID: \b StatisticsCollector <br>
49 * Library: \b libAliHLTUtil.so <br>
50 * Input Data Types: ::kAliHLTDataTypeComponentStatistics <br>
51 * Output Data Types: ::kAliHLTDataTypeHistogram, ::kAliHLTDataTypeTNtuple <br>
53 * <h2>Mandatory arguments:</h2>
54 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
56 * <h2>Optional arguments:</h2>
57 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
58 * \li -file <i> filename </i> <br>
60 * \li -publish <i> 0/1 </i> <br>
61 * enable/disable publishing to HLT output, default is on
62 * \li -period <i> n </i> <br>
63 * publish/save every n-th second
64 * \li -modulo <i> n </i> <br>
65 * publish/save every n-th event
67 * <h2>Configuration:</h2>
68 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
69 * Configuration by component arguments.
71 * <h2>Default CDB entries:</h2>
72 * The component loads no CDB entries.
74 * <h2>Performance:</h2>
76 * <h2>Memory consumption:</h2>
78 * <h2>Output size:</h2>
80 * @ingroup alihlt_util_components
82 class AliHLTCompStatCollector : public AliHLTProcessor
85 /** standard constructor */
86 AliHLTCompStatCollector();
88 virtual ~AliHLTCompStatCollector();
90 const char* GetComponentID() {return "StatisticsCollector";};
91 AliHLTComponent* Spawn() {return new AliHLTCompStatCollector;}
92 void GetInputDataTypes( vector<AliHLTComponentDataType>& );
93 AliHLTComponentDataType GetOutputDataType();
94 int GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList);
95 void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
98 int DoInit( int argc, const char** argv );
100 int DoEvent( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData);
102 using AliHLTProcessor::DoEvent;
104 /** mode definition */
106 /** publish objects according to the given period */
107 kPublishObjects = 0x1,
109 /** save objects according to the given period */
114 /** not a valid copy constructor, defined according to effective C++ style */
115 AliHLTCompStatCollector(const AliHLTCompStatCollector&);
116 /** not a valid assignment op, but defined according to effective C++ style */
117 AliHLTCompStatCollector& operator=(const AliHLTCompStatCollector&);
120 * Reset all filling variables and lists.
122 void ResetFillingVariables();
125 * Fill the lists from the component statistics block.
127 int FillVariablesSorted(void* ptr, int size, AliHLTUInt32_t eventType);
129 /** delete all internal objects */
133 * Remove entries from the parent list if they occur further down in the
136 int RemoveRecurrence(TFolder* pRoot) const;
139 * Check event modulo and time period.
140 * If the result is true, the internal counter and time backup is
142 * @param bUpdate update internal backups if condition was true
143 * @return true if period has excceded
145 bool CheckPeriod(bool bUpdate=true);
147 /** event cycle timer */
148 TStopwatch* fpTimer; //!transient
151 TFolder* fpFolder; //!transient
153 /** statistics tree */
154 TTree* fpStatTree; //!transient
156 /** branch filling variable */
157 Float_t fCycleTime; //!transient
158 /** branch filling variable */
159 Int_t fNofSets; //!transient
161 UInt_t fArraySize; //!transient
162 /** current position */
163 UInt_t fPosition; //!transient
164 /** branch filling variable */
165 UInt_t* fpLevelArray; //!transient
166 /** branch filling variable */
167 UInt_t* fpSpecArray; //!transient
168 /** branch filling variable */
169 UInt_t* fpBlockNoArray; //!transient
170 /** branch filling variable */
171 UInt_t* fpIdArray; //!transient
172 /** branch filling variable */
173 UInt_t* fpTimeArray; //!transient
174 /** branch filling variable */
175 UInt_t* fpCTimeArray; //!transient
176 /** branch filling variable */
177 UInt_t* fpInputBlockCountArray; //!transient
178 /** branch filling variable */
179 UInt_t* fpTotalInputSizeArray; //!transient
180 /** branch filling variable */
181 UInt_t* fpNormalizedInputSizeArray; //!transient
182 /** branch filling variable */
183 UInt_t* fpOutputBlockCountArray; //!transient
184 /** branch filling variable */
185 UInt_t* fpTotalOutputSizeArray; //!transient
186 /** branch filling variable */
187 UInt_t* fpInputOutputRatioArray; //!transient
188 /** branch filling variable */
189 UInt_t* fpNormalizedInputOutputRatioArray; //!transient
190 /** branch filling variable */
191 UInt_t* fpComponentCycleTimeArray; //!transient
192 /** branch filling variable */
193 UInt_t* fpEventTypeArray; //!transient
194 /** branch filling variable */
195 UInt_t* fpEventCountArray; //!transient
197 /** const base of GetOutputSize, updated on error in DoEvent */
198 int fSizeEstimator; //! transient
201 unsigned int fMode; //! transient
203 /** file name to store the objects */
204 string fFileName; //! transient
206 /** root file to save objects */
207 TFile* fFile; // !transient
209 /** last time, objects have been published or saved */
210 time_t fLastTime; //! transient
212 /** period in seconds to save/publish objects */
213 unsigned int fPeriod; //! transient
215 /** event modulo to save/publish onjects */
216 unsigned int fEventModulo; //! transient
218 ClassDef(AliHLTCompStatCollector, 4)