]>
Commit | Line | Data |
---|---|---|
76c437dc | 1 | //-*- Mode: C++ -*- |
2 | // $Id$ | |
3 | #ifndef ALIHLTTPCDATACOMPRESSIONMONITORCOMPONENT_H | |
4 | #define ALIHLTTPCDATACOMPRESSIONMONITORCOMPONENT_H | |
5 | //* This file is property of and copyright by the ALICE HLT Project * | |
6 | //* ALICE Experiment at CERN, All rights reserved. * | |
7 | //* See cxx source for full Copyright notice * | |
8 | ||
9 | /// @file AliHLTTPCDataCompressionMonitorComponent.h | |
10 | /// @author Matthias Richter | |
11 | /// @date 2011-09-12 | |
12 | /// @brief TPC component for monitoring of data compression | |
13 | /// | |
14 | ||
15 | #include "AliHLTProcessor.h" | |
16 | #include "TString.h" | |
17 | ||
18 | class AliHLTTPCHWCFData; | |
6776da52 | 19 | class AliHLTDataInflater; |
eb51a006 | 20 | class AliHLTTPCTrackGeometry; |
779a5a62 | 21 | class AliHLTTPCHWCFSpacePointContainer; |
76c437dc | 22 | class TH1; |
23 | class TH2; | |
69d38ee6 | 24 | class TH3; |
76c437dc | 25 | |
26 | /** | |
27 | * @class AliHLTTPCDataCompressionMonitorComponent | |
28 | * | |
29 | * <h2>General properties:</h2> | |
30 | * | |
31 | * Component ID: \b TPCDataCompressorMonitor <br> | |
32 | * Library: \b libAliHLTTPC.so <br> | |
33 | * Input Data Types: <br> | |
34 | * Output Data Types: <br> | |
35 | * | |
36 | * <h2>Mandatory arguments:</h2> | |
37 | * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting --> | |
38 | * | |
39 | * <h2>Optional arguments:</h2> | |
40 | * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting --> | |
41 | ||
42 | * <h2>Configuration:</h2> | |
43 | * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting --> | |
44 | * | |
45 | * <h2>Default CDB entries:</h2> | |
46 | * | |
47 | * <h2>Performance:</h2> | |
48 | * | |
49 | * <h2>Memory consumption:</h2> | |
50 | * | |
51 | * <h2>Output size:</h2> | |
52 | * | |
53 | * | |
54 | * @ingroup alihlt_tpc | |
55 | */ | |
56 | class AliHLTTPCDataCompressionMonitorComponent : public AliHLTProcessor { | |
57 | public: | |
58 | /// standard constructor | |
59 | AliHLTTPCDataCompressionMonitorComponent(); | |
60 | /// destructor | |
61 | ~AliHLTTPCDataCompressionMonitorComponent(); | |
62 | ||
63 | /// inherited from AliHLTComponent: id of the component | |
64 | virtual const char* GetComponentID(); | |
65 | ||
66 | /// inherited from AliHLTComponent: list of data types in the vector reference | |
67 | void GetInputDataTypes( AliHLTComponentDataTypeList& ); | |
68 | ||
69 | /// inherited from AliHLTComponent: output data type of the component. | |
70 | AliHLTComponentDataType GetOutputDataType(); | |
71 | ||
72 | /// inherited from AliHLTComponent: multiple output data types of the component. | |
73 | int GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList); | |
74 | ||
75 | /// inherited from AliHLTComponent: output data size estimator | |
76 | void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ); | |
77 | ||
78 | /// inherited from AliHLTComponent: spawn function. | |
79 | virtual AliHLTComponent* Spawn(); | |
80 | ||
81 | enum { | |
82 | kHaveRawData = 0x1, | |
83 | kHaveHWClusters = 0x2 | |
84 | }; | |
85 | ||
779a5a62 | 86 | enum { |
87 | kHistogramPadrow, | |
88 | kHistogramPad, | |
89 | kHistogramTime, | |
90 | kHistogramSigmaY2, | |
91 | kHistogramSigmaZ2, | |
92 | kHistogramCharge, | |
93 | kHistogramQMax, | |
94 | kHistogramDeltaPadrow, | |
95 | kHistogramDeltaPad, | |
96 | kHistogramDeltaTime, | |
97 | kHistogramDeltaSigmaY2, | |
98 | kHistogramDeltaSigmaZ2, | |
99 | kHistogramDeltaCharge, | |
100 | kHistogramDeltaQMax, | |
ac30bb87 | 101 | kHistogramOutOfRange, |
779a5a62 | 102 | kNumberOfHistograms |
103 | }; | |
69d38ee6 | 104 | enum { |
105 | kHistogramQMaxSector, | |
106 | kHistogramSigmaY2Sector, | |
107 | kHistogramSigmaZ2Sector, | |
108 | kNumberOfHistograms2D | |
109 | }; | |
110 | enum { | |
111 | kHistogramPadrowPadSector, | |
112 | kNumberOfHistograms3D | |
113 | }; | |
779a5a62 | 114 | |
115 | struct AliHistogramDefinition { | |
116 | int fId; //! | |
117 | const char* fName; //! | |
118 | const char* fTitle; //! | |
119 | int fBins; //! | |
120 | float fLowerBound; //! | |
121 | float fUpperBound; //! | |
122 | }; | |
69d38ee6 | 123 | struct AliHistogramDefinition2D { |
124 | int fId; //! | |
125 | const char* fName; //! | |
126 | const char* fTitle; //! | |
127 | int fBinsX; //! | |
128 | float fLowerBoundX; //! | |
129 | float fUpperBoundX; //! | |
130 | int fBinsY; //! | |
131 | float fLowerBoundY; //! | |
132 | float fUpperBoundY; //! | |
133 | }; | |
134 | struct AliHistogramDefinition3D { | |
135 | int fId; //! | |
136 | const char* fName; //! | |
137 | const char* fTitle; //! | |
138 | int fBinsX; //! | |
139 | float fLowerBoundX; //! | |
140 | float fUpperBoundX; //! | |
141 | int fBinsY; //! | |
142 | float fLowerBoundY; //! | |
143 | float fUpperBoundY; //! | |
144 | int fBinsZ; //! | |
145 | float fLowerBoundZ; //! | |
146 | float fUpperBoundZ; //! | |
147 | }; | |
779a5a62 | 148 | |
149 | /** | |
150 | * @class AliDataContainer | |
151 | * Cluster read interface for monitoring. | |
152 | * The class implements the interface to be used in the decoding | |
153 | * of compressed TPC data. | |
154 | */ | |
ac30bb87 | 155 | class AliDataContainer : public AliHLTLogging { |
779a5a62 | 156 | public: |
157 | AliDataContainer(); | |
158 | virtual ~AliDataContainer(); | |
159 | ||
160 | struct AliClusterIdBlock { | |
161 | AliClusterIdBlock() : fIds(NULL), fSize(0) {} | |
162 | AliHLTUInt32_t* fIds; //! | |
163 | AliHLTUInt32_t fSize; //! | |
164 | }; | |
165 | ||
166 | class iterator { | |
167 | public: | |
ac30bb87 | 168 | iterator() : fClusterNo(-1), fData(NULL), fClusterId(kAliHLTVoidDataSpec), fSlice(-1), fPartition(-1) {} |
169 | iterator(AliDataContainer* pData) : fClusterNo(-1), fData(pData), fClusterId(fData?fData->GetClusterId(fClusterNo):kAliHLTVoidDataSpec), fSlice(-1), fPartition(-1) {} | |
170 | iterator(const iterator& other) : fClusterNo(other.fClusterNo), fData(other.fData), fClusterId(other.fClusterId), fSlice(other.fSlice), fPartition(other.fPartition) {} | |
779a5a62 | 171 | iterator& operator=(const iterator& other) { |
ac30bb87 | 172 | fClusterNo=other.fClusterNo; fData=other.fData; fClusterId=other.fClusterId; fSlice=other.fSlice; fPartition=other.fPartition; return *this; |
779a5a62 | 173 | } |
174 | ~iterator() {} | |
175 | ||
69d38ee6 | 176 | void SetPadRow(int row) {if (fData) fData->FillPadRow(row, fSlice, fClusterId);} |
177 | void SetPad(float pad) {if (fData) fData->FillPad(pad, fClusterId);} | |
178 | void SetTime(float time) {if (fData) fData->FillTime(time, fClusterId);} | |
179 | void SetSigmaY2(float sigmaY2) {if (fData) fData->FillSigmaY2(sigmaY2, fClusterId, fPartition);} | |
180 | void SetSigmaZ2(float sigmaZ2) {if (fData) fData->FillSigmaZ2(sigmaZ2, fClusterId);} | |
181 | void SetCharge(unsigned charge) {if (fData) fData->FillCharge(charge, fClusterId);} | |
182 | void SetQMax(unsigned qmax) {if (fData) fData->FillQMax(qmax, fClusterId);} | |
779a5a62 | 183 | |
f899e060 | 184 | // switch to next cluster |
ac30bb87 | 185 | iterator& Next(int slice, int partition) { |
186 | fSlice=slice; fPartition=partition; return operator++(); | |
187 | } | |
779a5a62 | 188 | // prefix operators |
189 | iterator& operator++() {fClusterNo++; fClusterId=fData?fData->GetClusterId(fClusterNo):kAliHLTVoidDataSpec;return *this;} | |
190 | iterator& operator--() {fClusterNo--; fClusterId=fData?fData->GetClusterId(fClusterNo):kAliHLTVoidDataSpec;return *this;} | |
191 | // postfix operators | |
192 | iterator operator++(int) {iterator i(*this); fClusterNo++; return i;} | |
193 | iterator operator--(int) {iterator i(*this); fClusterNo--; return i;} | |
194 | ||
195 | bool operator==(const iterator other) const {return fData==other.fData;} | |
196 | bool operator!=(const iterator other) const {return fData!=other.fData;} | |
197 | ||
198 | private: | |
199 | int fClusterNo; //! cluster no in the current block | |
200 | AliDataContainer* fData; //! pointer to actual data | |
201 | AliHLTUInt32_t fClusterId; //! id of the cluster, from optional cluster id blocks | |
ac30bb87 | 202 | int fSlice; //! current slice |
203 | int fPartition; //! current partition | |
779a5a62 | 204 | }; |
205 | ||
206 | /// iterator of remaining clusters block of specification | |
207 | iterator& BeginRemainingClusterBlock(int count, AliHLTUInt32_t specification); | |
208 | /// iterator of track model clusters | |
209 | iterator& BeginTrackModelClusterBlock(int count); | |
779a5a62 | 210 | |
211 | /// add raw data bloack | |
212 | int AddRawData(const AliHLTComponentBlockData* pDesc); | |
213 | /// add cluster id block for remaining or track model clusters | |
214 | int AddClusterIds(const AliHLTComponentBlockData* pDesc); | |
215 | /// get the cluster id from the current cluster id block (optional) | |
216 | AliHLTUInt32_t GetClusterId(int clusterNo) const; | |
217 | ||
218 | /// internal cleanup | |
219 | virtual void Clear(Option_t * option=""); | |
220 | /// get histogram object | |
221 | virtual TObject* FindObject(const char *name) const; | |
222 | ||
223 | protected: | |
69d38ee6 | 224 | void FillPadRow(int row, int slice, AliHLTUInt32_t clusterId); |
779a5a62 | 225 | void FillPad(float pad, AliHLTUInt32_t clusterId); |
226 | void FillTime(float time, AliHLTUInt32_t clusterId); | |
ac30bb87 | 227 | void FillSigmaY2(float sigmaY2, AliHLTUInt32_t clusterId, int partition); |
779a5a62 | 228 | void FillSigmaZ2(float sigmaZ2, AliHLTUInt32_t clusterId); |
229 | void FillCharge(unsigned charge, AliHLTUInt32_t clusterId); | |
230 | void FillQMax(unsigned qmax, AliHLTUInt32_t clusterId); | |
231 | ||
232 | private: | |
233 | AliDataContainer(const AliDataContainer&); | |
234 | AliDataContainer& operator=(const AliDataContainer&); | |
235 | ||
236 | TObjArray* fHistograms; //! array of histograms | |
69d38ee6 | 237 | TObjArray* fHistograms2D; //! array of histograms |
238 | TObjArray* fHistograms3D; //! array of histograms | |
779a5a62 | 239 | vector<TH1*> fHistogramPointers; //! pointers to histograms |
69d38ee6 | 240 | vector<TH2*> fHistogram2DPointers; //! pointers to histograms |
241 | vector<TH3*> fHistogram3DPointers; //! pointers to histograms | |
779a5a62 | 242 | vector<AliClusterIdBlock> fRemainingClusterIds; //! clusters ids for remaining cluster ids |
243 | AliClusterIdBlock fTrackModelClusterIds; //! cluster ids for track model clusters | |
244 | AliClusterIdBlock* fCurrentClusterIds; //! id block currently active in the iteration | |
245 | AliHLTTPCHWCFSpacePointContainer* fRawData; //! raw data container | |
ac30bb87 | 246 | int fLastPadRow; //! last padrow |
69d38ee6 | 247 | int fSector; //! sector |
779a5a62 | 248 | iterator fBegin; //! |
779a5a62 | 249 | }; |
250 | ||
76c437dc | 251 | protected: |
252 | /// inherited from AliHLTProcessor: data processing | |
253 | int DoEvent( const AliHLTComponentEventData& evtData, | |
254 | const AliHLTComponentBlockData* blocks, | |
255 | AliHLTComponentTriggerData& trigData, | |
256 | AliHLTUInt8_t* outputPtr, | |
257 | AliHLTUInt32_t& size, | |
258 | AliHLTComponentBlockDataList& outputBlocks ); | |
259 | using AliHLTProcessor::DoEvent; | |
260 | ||
261 | /// inherited from AliHLTComponent: component initialisation and argument scan. | |
262 | int DoInit( int argc, const char** argv ); | |
263 | ||
264 | /// inherited from AliHLTComponent: component cleanup | |
265 | int DoDeinit(); | |
266 | ||
267 | /// inherited from AliHLTComponent: argument scan | |
268 | int ScanConfigurationArgument(int argc, const char** argv); | |
269 | ||
270 | private: | |
271 | AliHLTTPCDataCompressionMonitorComponent(const AliHLTTPCDataCompressionMonitorComponent&); | |
272 | AliHLTTPCDataCompressionMonitorComponent& operator=(const AliHLTTPCDataCompressionMonitorComponent&); | |
273 | ||
274 | AliHLTTPCHWCFData* fpHWClusterDecoder; //! data decoder for HW clusters | |
275 | ||
276 | TH2* fHistoHWCFDataSize; //! hwcf data size vs. event size | |
277 | TH2* fHistoHWCFReductionFactor; //! reduction factor vs. event size | |
278 | TH2* fHistoNofClusters; //! number of clusters vs. event size | |
279 | TString fHistogramFile; //! file to save histogram | |
779a5a62 | 280 | AliDataContainer* fMonitoringContainer; //! cluster read interface for monitoring |
76c437dc | 281 | |
282 | /// verbosity | |
283 | int fVerbosity; //! verbosity for debug printout | |
284 | unsigned fFlags; //! flags to indicate various conditions | |
285 | ||
779a5a62 | 286 | static const AliHistogramDefinition fgkHistogramDefinitions[]; //! histogram definitions |
69d38ee6 | 287 | static const AliHistogramDefinition2D fgkHistogramDefinitions2D[]; //! histogram definitions |
288 | static const AliHistogramDefinition3D fgkHistogramDefinitions3D[]; //! histogram definitions | |
779a5a62 | 289 | |
76c437dc | 290 | ClassDef(AliHLTTPCDataCompressionMonitorComponent, 0) |
291 | }; | |
292 | ||
293 | #endif //ALIHLTTPCDATACOMPRESSIONMONITORCOMPONENT_H |