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 *
9 /// @file AliHLTTPCDataCompressionMonitorComponent.h
10 /// @author Matthias Richter
12 /// @brief TPC component for monitoring of data compression
15 #include "AliHLTProcessor.h"
18 class AliHLTTPCHWCFData;
19 class AliHLTDataInflater;
20 class AliHLTTPCTrackGeometry;
21 class AliHLTTPCHWCFSpacePointContainer;
27 * @class AliHLTTPCDataCompressionMonitorComponent
29 * <h2>General properties:</h2>
31 * Component ID: \b TPCDataCompressorMonitor <br>
32 * Library: \b libAliHLTTPC.so <br>
33 * Input Data Types: <br>
34 * Output Data Types: <br>
36 * <h2>Mandatory arguments:</h2>
37 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
39 * <h2>Optional arguments:</h2>
40 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
42 * <h2>Configuration:</h2>
43 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
45 * <h2>Default CDB entries:</h2>
47 * <h2>Performance:</h2>
49 * <h2>Memory consumption:</h2>
51 * <h2>Output size:</h2>
56 class AliHLTTPCDataCompressionMonitorComponent : public AliHLTProcessor {
58 /// standard constructor
59 AliHLTTPCDataCompressionMonitorComponent();
61 ~AliHLTTPCDataCompressionMonitorComponent();
63 /// inherited from AliHLTComponent: id of the component
64 virtual const char* GetComponentID();
66 /// inherited from AliHLTComponent: list of data types in the vector reference
67 void GetInputDataTypes( AliHLTComponentDataTypeList& );
69 /// inherited from AliHLTComponent: output data type of the component.
70 AliHLTComponentDataType GetOutputDataType();
72 /// inherited from AliHLTComponent: multiple output data types of the component.
73 int GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList);
75 /// inherited from AliHLTComponent: output data size estimator
76 void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
78 /// inherited from AliHLTComponent: spawn function.
79 virtual AliHLTComponent* Spawn();
102 kHistogramDeltaPadrow,
105 kHistogramDeltaSigmaY2,
106 kHistogramDeltaSigmaZ2,
107 kHistogramDeltaCharge,
109 kHistogramOutOfRange,
113 kHistogramQMaxSector,
114 kHistogramSigmaY2Sector,
115 kHistogramSigmaZ2Sector,
117 kNumberOfHistograms2D
120 kHistogramPadrowPadSector,
121 kNumberOfHistograms3D
124 struct AliHistogramDefinition {
126 const char* fName; //!
127 const char* fTitle; //!
129 float fLowerBound; //!
130 float fUpperBound; //!
132 struct AliHistogramDefinition2D {
134 const char* fName; //!
135 const char* fTitle; //!
137 float fLowerBoundX; //!
138 float fUpperBoundX; //!
140 float fLowerBoundY; //!
141 float fUpperBoundY; //!
143 struct AliHistogramDefinition3D {
145 const char* fName; //!
146 const char* fTitle; //!
148 float fLowerBoundX; //!
149 float fUpperBoundX; //!
151 float fLowerBoundY; //!
152 float fUpperBoundY; //!
154 float fLowerBoundZ; //!
155 float fUpperBoundZ; //!
159 * @class AliDataContainer
160 * Cluster read interface for monitoring.
161 * The class implements the interface to be used in the decoding
162 * of compressed TPC data.
164 class AliDataContainer : public AliHLTLogging {
167 virtual ~AliDataContainer();
169 struct AliClusterIdBlock {
170 AliClusterIdBlock() : fIds(NULL), fSize(0) {}
171 AliHLTUInt32_t* fIds; //!
172 AliHLTUInt32_t fSize; //!
177 iterator() : fClusterNo(-1), fData(NULL), fClusterId(kAliHLTVoidDataSpec), fSlice(-1), fPartition(-1) {}
178 iterator(AliDataContainer* pData) : fClusterNo(-1), fData(pData), fClusterId(fData?fData->GetClusterId(fClusterNo):kAliHLTVoidDataSpec), fSlice(-1), fPartition(-1) {}
179 iterator(const iterator& other) : fClusterNo(other.fClusterNo), fData(other.fData), fClusterId(other.fClusterId), fSlice(other.fSlice), fPartition(other.fPartition) {}
180 iterator& operator=(const iterator& other) {
181 fClusterNo=other.fClusterNo; fData=other.fData; fClusterId=other.fClusterId; fSlice=other.fSlice; fPartition=other.fPartition; return *this;
185 void SetPadRow(int row) {if (fData) fData->FillPadRow(row, fSlice, fClusterId);}
186 void SetPad(float pad) {if (fData) fData->FillPad(pad, fClusterId);}
187 void SetTime(float time) {if (fData) fData->FillTime(time, fClusterId);}
188 void SetSigmaY2(float sigmaY2) {if (fData) fData->FillSigmaY2(sigmaY2, fClusterId, fPartition);}
189 void SetSigmaZ2(float sigmaZ2) {if (fData) fData->FillSigmaZ2(sigmaZ2, fClusterId);}
190 void SetCharge(unsigned charge) {if (fData) fData->FillCharge(charge, fClusterId);}
191 void SetQMax(unsigned qmax) {if (fData) fData->FillQMax(qmax, fClusterId);}
193 // switch to next cluster
194 iterator& Next(int slice, int partition) {
195 fSlice=slice; fPartition=partition; return operator++();
198 iterator& operator++() {fClusterNo++; fClusterId=fData?fData->GetClusterId(fClusterNo):kAliHLTVoidDataSpec;return *this;}
199 iterator& operator--() {fClusterNo--; fClusterId=fData?fData->GetClusterId(fClusterNo):kAliHLTVoidDataSpec;return *this;}
201 iterator operator++(int) {iterator i(*this); fClusterNo++; return i;}
202 iterator operator--(int) {iterator i(*this); fClusterNo--; return i;}
204 bool operator==(const iterator other) const {return fData==other.fData;}
205 bool operator!=(const iterator other) const {return fData!=other.fData;}
208 int fClusterNo; //! cluster no in the current block
209 AliDataContainer* fData; //! pointer to actual data
210 AliHLTUInt32_t fClusterId; //! id of the cluster, from optional cluster id blocks
211 int fSlice; //! current slice
212 int fPartition; //! current partition
215 /// iterator of remaining clusters block of specification
216 iterator& BeginRemainingClusterBlock(int count, AliHLTUInt32_t specification);
217 /// iterator of track model clusters
218 iterator& BeginTrackModelClusterBlock(int count);
220 /// add raw data bloack
221 int AddRawData(const AliHLTComponentBlockData* pDesc);
222 /// add cluster id block for remaining or track model clusters
223 int AddClusterIds(const AliHLTComponentBlockData* pDesc);
224 /// get the cluster id from the current cluster id block (optional)
225 AliHLTUInt32_t GetClusterId(int clusterNo) const;
228 virtual void Clear(Option_t * option="");
229 /// get histogram object
230 virtual TObject* FindObject(const char *name) const;
233 void FillPadRow(int row, int slice, AliHLTUInt32_t clusterId);
234 void FillPad(float pad, AliHLTUInt32_t clusterId);
235 void FillTime(float time, AliHLTUInt32_t clusterId);
236 void FillSigmaY2(float sigmaY2, AliHLTUInt32_t clusterId, int partition);
237 void FillSigmaZ2(float sigmaZ2, AliHLTUInt32_t clusterId);
238 void FillCharge(unsigned charge, AliHLTUInt32_t clusterId);
239 void FillQMax(unsigned qmax, AliHLTUInt32_t clusterId);
242 AliDataContainer(const AliDataContainer&);
243 AliDataContainer& operator=(const AliDataContainer&);
245 TObjArray* fHistograms; //! array of histograms
246 TObjArray* fHistograms2D; //! array of histograms
247 TObjArray* fHistograms3D; //! array of histograms
248 vector<TH1*> fHistogramPointers; //! pointers to histograms
249 vector<TH2*> fHistogram2DPointers; //! pointers to histograms
250 vector<TH3*> fHistogram3DPointers; //! pointers to histograms
251 vector<AliClusterIdBlock> fRemainingClusterIds; //! clusters ids for remaining cluster ids
252 AliClusterIdBlock fTrackModelClusterIds; //! cluster ids for track model clusters
253 AliClusterIdBlock* fCurrentClusterIds; //! id block currently active in the iteration
254 AliHLTTPCHWCFSpacePointContainer* fRawData; //! raw data container
255 int fLastPadRow; //! last padrow
256 int fSector; //! sector
261 /// inherited from AliHLTProcessor: data processing
262 int DoEvent( const AliHLTComponentEventData& evtData,
263 const AliHLTComponentBlockData* blocks,
264 AliHLTComponentTriggerData& trigData,
265 AliHLTUInt8_t* outputPtr,
266 AliHLTUInt32_t& size,
267 AliHLTComponentBlockDataList& outputBlocks );
268 using AliHLTProcessor::DoEvent;
270 /// inherited from AliHLTComponent: component initialisation and argument scan.
271 int DoInit( int argc, const char** argv );
273 /// inherited from AliHLTComponent: component cleanup
276 /// inherited from AliHLTComponent: argument scan
277 int ScanConfigurationArgument(int argc, const char** argv);
279 /// publish to output
280 int Publish(int mode);
283 AliHLTTPCDataCompressionMonitorComponent(const AliHLTTPCDataCompressionMonitorComponent&);
284 AliHLTTPCDataCompressionMonitorComponent& operator=(const AliHLTTPCDataCompressionMonitorComponent&);
286 AliHLTTPCHWCFData* fpHWClusterDecoder; //! data decoder for HW clusters
288 TH2* fHistoHWCFDataSize; //! hwcf data size vs. event size
289 TH2* fHistoHWCFReductionFactor; //! reduction factor vs. event size
290 TH2* fHistoNofClusters; //! number of clusters vs. event size
291 TH2* fHistoNofClustersReductionFactor; //! reduction factor vs. number of clusters
292 TString fHistogramFile; //! file to save histogram
293 AliDataContainer* fMonitoringContainer; //! cluster read interface for monitoring
296 int fVerbosity; //! verbosity for debug printout
297 unsigned fFlags; //! flags to indicate various conditions
298 int fPublishingMode; //! publishing mode
300 static const AliHistogramDefinition fgkHistogramDefinitions[]; //! histogram definitions
301 static const AliHistogramDefinition2D fgkHistogramDefinitions2D[]; //! histogram definitions
302 static const AliHistogramDefinition3D fgkHistogramDefinitions3D[]; //! histogram definitions
304 ClassDef(AliHLTTPCDataCompressionMonitorComponent, 0)
307 #endif //ALIHLTTPCDATACOMPRESSIONMONITORCOMPONENT_H