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