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;
26 * @class AliHLTTPCDataCompressionMonitorComponent
28 * <h2>General properties:</h2>
30 * Component ID: \b TPCDataCompressorMonitor <br>
31 * Library: \b libAliHLTTPC.so <br>
32 * Input Data Types: <br>
33 * Output Data Types: <br>
35 * <h2>Mandatory arguments:</h2>
36 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
38 * <h2>Optional arguments:</h2>
39 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
41 * <h2>Configuration:</h2>
42 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
44 * <h2>Default CDB entries:</h2>
46 * <h2>Performance:</h2>
48 * <h2>Memory consumption:</h2>
50 * <h2>Output size:</h2>
55 class AliHLTTPCDataCompressionMonitorComponent : public AliHLTProcessor {
57 /// standard constructor
58 AliHLTTPCDataCompressionMonitorComponent();
60 ~AliHLTTPCDataCompressionMonitorComponent();
62 /// inherited from AliHLTComponent: id of the component
63 virtual const char* GetComponentID();
65 /// inherited from AliHLTComponent: list of data types in the vector reference
66 void GetInputDataTypes( AliHLTComponentDataTypeList& );
68 /// inherited from AliHLTComponent: output data type of the component.
69 AliHLTComponentDataType GetOutputDataType();
71 /// inherited from AliHLTComponent: multiple output data types of the component.
72 int GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList);
74 /// inherited from AliHLTComponent: output data size estimator
75 void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
77 /// inherited from AliHLTComponent: spawn function.
78 virtual AliHLTComponent* Spawn();
93 kHistogramDeltaPadrow,
96 kHistogramDeltaSigmaY2,
97 kHistogramDeltaSigmaZ2,
98 kHistogramDeltaCharge,
100 kHistogramOutOfRange,
104 struct AliHistogramDefinition {
106 const char* fName; //!
107 const char* fTitle; //!
109 float fLowerBound; //!
110 float fUpperBound; //!
114 * @class AliDataContainer
115 * Cluster read interface for monitoring.
116 * The class implements the interface to be used in the decoding
117 * of compressed TPC data.
119 class AliDataContainer : public AliHLTLogging {
122 virtual ~AliDataContainer();
124 struct AliClusterIdBlock {
125 AliClusterIdBlock() : fIds(NULL), fSize(0) {}
126 AliHLTUInt32_t* fIds; //!
127 AliHLTUInt32_t fSize; //!
132 iterator() : fClusterNo(-1), fData(NULL), fClusterId(kAliHLTVoidDataSpec), fSlice(-1), fPartition(-1) {}
133 iterator(AliDataContainer* pData) : fClusterNo(-1), fData(pData), fClusterId(fData?fData->GetClusterId(fClusterNo):kAliHLTVoidDataSpec), fSlice(-1), fPartition(-1) {}
134 iterator(const iterator& other) : fClusterNo(other.fClusterNo), fData(other.fData), fClusterId(other.fClusterId), fSlice(other.fSlice), fPartition(other.fPartition) {}
135 iterator& operator=(const iterator& other) {
136 fClusterNo=other.fClusterNo; fData=other.fData; fClusterId=other.fClusterId; fSlice=other.fSlice; fPartition=other.fPartition; return *this;
140 void SetPadRow(int row) {if (fData) fData->FillPadRow(row, fClusterId);}
141 void SetPad(float pad) {if (fData) fData->FillPad(pad, fClusterId);}
142 void SetTime(float time) {if (fData) fData->FillTime(time, fClusterId);}
143 void SetSigmaY2(float sigmaY2) {if (fData) fData->FillSigmaY2(sigmaY2, fClusterId, fPartition);}
144 void SetSigmaZ2(float sigmaZ2) {if (fData) fData->FillSigmaZ2(sigmaZ2, fClusterId);}
145 void SetCharge(unsigned charge) {if (fData) fData->FillCharge(charge, fClusterId);}
146 void SetQMax(unsigned qmax) {if (fData) fData->FillQMax(qmax, fClusterId);}
148 // switch to next cluster
149 iterator& Next(int slice, int partition) {
150 fSlice=slice; fPartition=partition; return operator++();
153 iterator& operator++() {fClusterNo++; fClusterId=fData?fData->GetClusterId(fClusterNo):kAliHLTVoidDataSpec;return *this;}
154 iterator& operator--() {fClusterNo--; fClusterId=fData?fData->GetClusterId(fClusterNo):kAliHLTVoidDataSpec;return *this;}
156 iterator operator++(int) {iterator i(*this); fClusterNo++; return i;}
157 iterator operator--(int) {iterator i(*this); fClusterNo--; return i;}
159 bool operator==(const iterator other) const {return fData==other.fData;}
160 bool operator!=(const iterator other) const {return fData!=other.fData;}
163 int fClusterNo; //! cluster no in the current block
164 AliDataContainer* fData; //! pointer to actual data
165 AliHLTUInt32_t fClusterId; //! id of the cluster, from optional cluster id blocks
166 int fSlice; //! current slice
167 int fPartition; //! current partition
170 /// iterator of remaining clusters block of specification
171 iterator& BeginRemainingClusterBlock(int count, AliHLTUInt32_t specification);
172 /// iterator of track model clusters
173 iterator& BeginTrackModelClusterBlock(int count);
175 /// add raw data bloack
176 int AddRawData(const AliHLTComponentBlockData* pDesc);
177 /// add cluster id block for remaining or track model clusters
178 int AddClusterIds(const AliHLTComponentBlockData* pDesc);
179 /// get the cluster id from the current cluster id block (optional)
180 AliHLTUInt32_t GetClusterId(int clusterNo) const;
183 virtual void Clear(Option_t * option="");
184 /// get histogram object
185 virtual TObject* FindObject(const char *name) const;
188 void FillPadRow(int row, AliHLTUInt32_t clusterId);
189 void FillPad(float pad, AliHLTUInt32_t clusterId);
190 void FillTime(float time, AliHLTUInt32_t clusterId);
191 void FillSigmaY2(float sigmaY2, AliHLTUInt32_t clusterId, int partition);
192 void FillSigmaZ2(float sigmaZ2, AliHLTUInt32_t clusterId);
193 void FillCharge(unsigned charge, AliHLTUInt32_t clusterId);
194 void FillQMax(unsigned qmax, AliHLTUInt32_t clusterId);
197 AliDataContainer(const AliDataContainer&);
198 AliDataContainer& operator=(const AliDataContainer&);
200 TObjArray* fHistograms; //! array of histograms
201 vector<TH1*> fHistogramPointers; //! pointers to histograms
202 vector<AliClusterIdBlock> fRemainingClusterIds; //! clusters ids for remaining cluster ids
203 AliClusterIdBlock fTrackModelClusterIds; //! cluster ids for track model clusters
204 AliClusterIdBlock* fCurrentClusterIds; //! id block currently active in the iteration
205 AliHLTTPCHWCFSpacePointContainer* fRawData; //! raw data container
206 int fLastPadRow; //! last padrow
211 /// inherited from AliHLTProcessor: data processing
212 int DoEvent( const AliHLTComponentEventData& evtData,
213 const AliHLTComponentBlockData* blocks,
214 AliHLTComponentTriggerData& trigData,
215 AliHLTUInt8_t* outputPtr,
216 AliHLTUInt32_t& size,
217 AliHLTComponentBlockDataList& outputBlocks );
218 using AliHLTProcessor::DoEvent;
220 /// inherited from AliHLTComponent: component initialisation and argument scan.
221 int DoInit( int argc, const char** argv );
223 /// inherited from AliHLTComponent: component cleanup
226 /// inherited from AliHLTComponent: argument scan
227 int ScanConfigurationArgument(int argc, const char** argv);
230 AliHLTTPCDataCompressionMonitorComponent(const AliHLTTPCDataCompressionMonitorComponent&);
231 AliHLTTPCDataCompressionMonitorComponent& operator=(const AliHLTTPCDataCompressionMonitorComponent&);
233 AliHLTTPCHWCFData* fpHWClusterDecoder; //! data decoder for HW clusters
235 TH2* fHistoHWCFDataSize; //! hwcf data size vs. event size
236 TH2* fHistoHWCFReductionFactor; //! reduction factor vs. event size
237 TH2* fHistoNofClusters; //! number of clusters vs. event size
238 TString fHistogramFile; //! file to save histogram
239 AliDataContainer* fMonitoringContainer; //! cluster read interface for monitoring
242 int fVerbosity; //! verbosity for debug printout
243 unsigned fFlags; //! flags to indicate various conditions
245 static const AliHistogramDefinition fgkHistogramDefinitions[]; //! histogram definitions
247 ClassDef(AliHLTTPCDataCompressionMonitorComponent, 0)
250 #endif //ALIHLTTPCDATACOMPRESSIONMONITORCOMPONENT_H