LCOV - code coverage report
Current view: top level - HLT/TPCLib/comp - AliHLTTPCDataCompressionMonitorComponent.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 48 2.1 %
Date: 2016-06-14 17:26:59 Functions: 1 36 2.8 %

          Line data    Source code
       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 "AliHLTTPCRawCluster.h"
      17             : #include "AliHLTSpacePointContainer.h"
      18             : #include "TString.h"
      19             : 
      20             : struct AliHLTTPCClusterMCLabel;
      21             : class AliHLTTPCHWCFData;
      22             : class AliHLTDataInflater;
      23             : class AliHLTTPCTrackGeometry;
      24             : class AliHLTComponentBenchmark;
      25             : class AliHLTTPCDataCompressionDecoder;
      26             : class TH1;
      27             : class TH2;
      28             : class TH3;
      29             : 
      30             : /**
      31             :  * @class AliHLTTPCDataCompressionMonitorComponent
      32             :  *
      33             :  * <h2>General properties:</h2>
      34             :  *
      35             :  * Component ID: \b TPCDataCompressorMonitor      <br>
      36             :  * Library: \b libAliHLTTPC.so     <br>
      37             :  * Input Data Types:  <br>
      38             :  * Output Data Types: <br>
      39             :  *
      40             :  * <h2>Mandatory arguments:</h2>
      41             :  * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
      42             :  *
      43             :  * <h2>Optional arguments:</h2>
      44             :  * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
      45             : 
      46             :  * <h2>Configuration:</h2>
      47             :  * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
      48             :  *
      49             :  * <h2>Default CDB entries:</h2>
      50             :  *
      51             :  * <h2>Performance:</h2>
      52             :  *
      53             :  * <h2>Memory consumption:</h2>
      54             :  *
      55             :  * <h2>Output size:</h2>
      56             :  *
      57             :  *
      58             :  * @ingroup alihlt_tpc
      59             :  */
      60             : class AliHLTTPCDataCompressionMonitorComponent : public AliHLTProcessor {
      61             : public:
      62             :   /// standard constructor
      63             :   AliHLTTPCDataCompressionMonitorComponent();
      64             :   /// destructor
      65             :   ~AliHLTTPCDataCompressionMonitorComponent();
      66             : 
      67             :   /// inherited from AliHLTComponent: id of the component
      68             :   virtual const char* GetComponentID();
      69             : 
      70             :   /// inherited from AliHLTComponent: list of data types in the vector reference
      71             :   void GetInputDataTypes( AliHLTComponentDataTypeList& );
      72             : 
      73             :   /// inherited from AliHLTComponent: output data type of the component.
      74             :   AliHLTComponentDataType GetOutputDataType();
      75             : 
      76             :   /// inherited from AliHLTComponent: multiple output data types of the component.
      77             :   int GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList);
      78             : 
      79             :   /// inherited from AliHLTComponent: output data size estimator
      80             :   void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
      81             : 
      82             :   /// inherited from AliHLTComponent: spawn function.
      83             :   virtual AliHLTComponent* Spawn();
      84             : 
      85             :   enum {
      86             :     kHaveRawData = 0x1,
      87             :     kHaveHWClusters = 0x2
      88             :   };
      89             : 
      90             :   enum {
      91             :     kPublishOff      = 0,
      92             :     kPublishSeparate = 1,
      93             :     kPublishList     = 2,
      94             :     kPublishArray    = 3,
      95             :     kPublishInvalid  = 4    
      96             :   };
      97             : 
      98             :   enum {
      99             :     kHistogramPadrow,
     100             :     kHistogramHWCFPad,
     101             :     kHistogramPad,
     102             :     kHistogramTime,
     103             :     kHistogramSigmaY2,
     104             :     kHistogramSigmaZ2,
     105             :     kHistogramCharge,
     106             :     kHistogramQMax,
     107             :     kHistogramDeltaPadrow,
     108             :     kHistogramDeltaPad,
     109             :     kHistogramDeltaTime,
     110             :     kHistogramDeltaSigmaY2,
     111             :     kHistogramDeltaSigmaZ2,
     112             :     kHistogramDeltaCharge,
     113             :     kHistogramDeltaQMax,
     114             :     kHistogramOutOfRange,
     115             :     kNumberOfHistograms
     116             :   };
     117             :   enum {
     118             :     kHistogramQMaxSector,
     119             :     kHistogramSigmaY2Sector,
     120             :     kHistogramSigmaZ2Sector,
     121             :     kHistogramXYA,
     122             :     kHistogramXYC,
     123             :     kNumberOfHistograms2D
     124             :   };
     125             :   enum {
     126             :     kHistogramPadrowPadSector,
     127             :     kNumberOfHistograms3D
     128             :   };
     129             : 
     130             :   struct AliHistogramDefinition {
     131             :     int fId; //!
     132             :     const char* fName; //!
     133             :     const char* fTitle; //!
     134             :     int fBins; //!
     135             :     float fLowerBound; //!
     136             :     float fUpperBound; //!
     137             :     const char* fDrawOptions; //!
     138             :   };
     139             :   struct AliHistogramDefinition2D {
     140             :     int fId; //!
     141             :     const char* fName; //!
     142             :     const char* fTitle; //!
     143             :     int fBinsX; //!
     144             :     float fLowerBoundX; //!
     145             :     float fUpperBoundX; //!
     146             :     int fBinsY; //!
     147             :     float fLowerBoundY; //!
     148             :     float fUpperBoundY; //!
     149             :     const char* fDrawOptions; //!
     150             :   };
     151             :   struct AliHistogramDefinition3D {
     152             :     int fId; //!
     153             :     const char* fName; //!
     154             :     const char* fTitle; //!
     155             :     int fBinsX; //!
     156             :     float fLowerBoundX; //!
     157             :     float fUpperBoundX; //!
     158             :     int fBinsY; //!
     159             :     float fLowerBoundY; //!
     160             :     float fUpperBoundY; //!
     161             :     int fBinsZ; //!
     162             :     float fLowerBoundZ; //!
     163             :     float fUpperBoundZ; //!
     164             :     const char* fDrawOptions; //!
     165             :   };
     166             : 
     167             :   /**
     168             :    * @class AliDataContainer
     169             :    * Cluster read interface for monitoring.
     170             :    * The class implements the interface to be used in the decoding
     171             :    * of compressed TPC data.
     172             :    */
     173             :   class AliDataContainer : public AliHLTLogging {
     174             :   public:
     175             :     AliDataContainer();
     176             :     virtual ~AliDataContainer();
     177             : 
     178             :     struct AliClusterIdBlock {
     179           0 :       AliClusterIdBlock() : fIds(NULL), fSize(0) {}
     180             :       AliHLTUInt32_t* fIds; //!
     181             :       AliHLTUInt32_t  fSize; //!
     182             :     };
     183             : 
     184             :     class iterator {
     185             :     public:
     186           0 :       iterator() : fClusterNo(-1), fData(NULL), fClusterId(kAliHLTVoidDataSpec), fSlice(-1), fPartition(-1) {}
     187           0 :       iterator(AliDataContainer* pData) : fClusterNo(-1), fData(pData), fClusterId(fData?fData->GetClusterId(fClusterNo):kAliHLTVoidDataSpec), fSlice(-1), fPartition(-1) {}
     188             :       iterator(const iterator& other) : fClusterNo(other.fClusterNo), fData(other.fData), fClusterId(other.fClusterId), fSlice(other.fSlice), fPartition(other.fPartition) {}
     189             :       iterator& operator=(const iterator& other) {
     190           0 :         if (this==&other) return *this;
     191           0 :         fClusterNo=other.fClusterNo; fData=other.fData; fClusterId=other.fClusterId; fSlice=other.fSlice; fPartition=other.fPartition; return *this;
     192           0 :       }
     193           0 :       ~iterator() {}
     194             : 
     195           0 :       void SetPadRow(int row)             {if (fData) fData->FillPadRow(row, fSlice, fClusterId);}
     196           0 :       void SetPad(float pad)              {if (fData) fData->FillPad(pad, fClusterId);}
     197           0 :       void SetTime(float time)            {if (fData) fData->FillTime(time, fClusterId);}
     198           0 :       void SetSigmaY2(float sigmaY2)      {if (fData) fData->FillSigmaY2(sigmaY2, fClusterId, fPartition);}
     199           0 :       void SetSigmaZ2(float sigmaZ2)      {if (fData) fData->FillSigmaZ2(sigmaZ2, fClusterId);}
     200           0 :       void SetCharge(unsigned charge)     {if (fData) fData->FillCharge(charge, fClusterId);}
     201           0 :       void SetFlags(unsigned short flags)   {if (fData) fData->FillFlags(flags, fClusterId);}
     202           0 :       void SetQMax(unsigned qmax)         {if (fData) {fData->FillQMax(qmax, fClusterId);fData->Fill(fSlice, fPartition, fClusterId);}}
     203             :       iterator& operator=(const AliHLTTPCRawCluster& cluster) {if (fData) {
     204             :           fData->FillPadRow(cluster.GetPadRow(), fSlice, fClusterId);
     205             :           fData->FillPad(cluster.GetPad(), fClusterId);
     206             :           fData->FillTime(cluster.GetTime(), fClusterId);
     207             :           fData->FillSigmaY2(cluster.GetSigmaPad2(), fClusterId, fPartition);
     208             :           fData->FillSigmaZ2(cluster.GetSigmaTime2(), fClusterId);
     209             :           fData->FillCharge(cluster.GetCharge(), fClusterId);
     210             :           fData->FillQMax(cluster.GetQMax(), fClusterId);
     211             :           fData->FillFlags(cluster.GetFlags(), fClusterId);
     212             :           fData->Fill(fSlice, fPartition, fClusterId);
     213             :         } return *this;}
     214           0 :       void SetMC(const AliHLTTPCClusterMCLabel* /*pMC*/) {/* nop */}
     215             : 
     216             :       // switch to next cluster
     217             :       iterator& Next(int slice, int partition) {
     218           0 :         fSlice=slice; fPartition=partition; return operator++();
     219             :       }
     220             :       // prefix operators
     221           0 :       iterator& operator++() {fClusterNo++; fClusterId=fData?fData->GetClusterId(fClusterNo):kAliHLTVoidDataSpec;return *this;}
     222             :       iterator& operator--() {fClusterNo--; fClusterId=fData?fData->GetClusterId(fClusterNo):kAliHLTVoidDataSpec;return *this;}
     223             :       // postfix operators
     224             :       iterator operator++(int) {iterator i(*this); fClusterNo++; return i;}
     225             :       iterator operator--(int) {iterator i(*this); fClusterNo--; return i;}
     226             : 
     227             :       bool operator==(const iterator other) const {return fData==other.fData;}
     228             :       bool operator!=(const iterator other) const {return fData!=other.fData;}
     229             : 
     230             :     private:
     231             :       int fClusterNo; //! cluster no in the current block
     232             :       AliDataContainer* fData; //! pointer to actual data
     233             :       AliHLTUInt32_t fClusterId; //! id of the cluster, from optional cluster id blocks
     234             :       int fSlice;     //! current slice
     235             :       int fPartition; //! current partition
     236             :     };
     237             : 
     238             :     /// legacy, to be removed later
     239             :     iterator& BeginRemainingClusterBlock(int count, AliHLTUInt32_t specification) {
     240           0 :       return BeginPartitionClusterBlock(count, specification);
     241             :     }
     242             :     /// iterator of partition clusters block of specification
     243             :     iterator& BeginPartitionClusterBlock(int count, AliHLTUInt32_t specification);
     244             :     /// iterator of track model clusters
     245             :     iterator& BeginTrackModelClusterBlock(int count);
     246             : 
     247             :     /// add raw data bloack
     248             :     int AddRawData(const AliHLTComponentBlockData* pDesc);
     249             :     /// add cluster id block for remaining or track model clusters
     250             :     int AddClusterIds(const AliHLTComponentBlockData* pDesc);
     251             :     /// get the cluster id from the current cluster id block (optional)
     252             :     AliHLTUInt32_t GetClusterId(int clusterNo) const;
     253             :     /// get the cluster id of the nearest original cluster
     254             :     AliHLTUInt32_t FindNearestCluster(int slice, int partition, const AliHLTTPCRawCluster& cluster) const;
     255             : 
     256             :     bool CheckClusterID(AliHLTUInt32_t clusterID) const {
     257           0 :       if (fRawData) return fRawData->Check(clusterID);
     258           0 :       return false;
     259           0 :     }
     260             :     float GetClusterX(AliHLTUInt32_t clusterID) const {
     261           0 :       if (fRawData) return fRawData->GetX(clusterID);
     262           0 :       return false;
     263           0 :     }
     264             :     float GetClusterXWidth(AliHLTUInt32_t clusterID) const {
     265             :       if (fRawData) return fRawData->GetXWidth(clusterID);
     266             :       return false;
     267             :     }
     268             :     float GetClusterY(AliHLTUInt32_t clusterID) const {
     269           0 :       if (fRawData) return fRawData->GetY(clusterID);
     270           0 :       return false;
     271           0 :     }
     272             :     float GetClusterYWidth(AliHLTUInt32_t clusterID) const {
     273           0 :       if (fRawData) return fRawData->GetYWidth(clusterID);
     274           0 :       return false;
     275           0 :     }
     276             :     float GetClusterZ(AliHLTUInt32_t clusterID) const {
     277           0 :       if (fRawData) return fRawData->GetZ(clusterID);
     278           0 :       return false;
     279           0 :     }
     280             :     float GetClusterZWidth(AliHLTUInt32_t clusterID) const {
     281           0 :       if (fRawData) return fRawData->GetZWidth(clusterID);
     282           0 :       return false;
     283           0 :     }
     284             :     float GetClusterCharge(AliHLTUInt32_t clusterID) const {
     285           0 :       if (fRawData) return fRawData->GetCharge(clusterID);
     286           0 :       return false;
     287           0 :     }
     288             :     float GetClusterQMax(AliHLTUInt32_t clusterID) const {
     289           0 :       if (fRawData) return fRawData->GetMaxSignal(clusterID);
     290           0 :       return false;
     291           0 :     }
     292             :     const AliHLTSpacePointContainer::AliHLTSpacePointPropertyGrid* GetClusterSpacePointPropertyGrid(AliHLTUInt32_t mask) const {
     293           0 :       if (fRawData) return fRawData->GetSpacePointPropertyGrid(mask);
     294           0 :       return NULL;
     295           0 :     }
     296             : 
     297             :     /// internal cleanup
     298             :     virtual void  Clear(Option_t * option="");
     299             :     /// get histogram object
     300             :     virtual TObject* FindObject(const char *name) const;
     301             :     
     302             :   protected:
     303             :     void FillPadRow(int row, int slice, AliHLTUInt32_t clusterId);
     304             :     void FillPad(float pad, AliHLTUInt32_t clusterId);
     305             :     void FillTime(float time, AliHLTUInt32_t clusterId);
     306             :     void FillSigmaY2(float sigmaY2, AliHLTUInt32_t clusterId, int partition);
     307             :     void FillSigmaZ2(float sigmaZ2, AliHLTUInt32_t clusterId);
     308             :     void FillCharge(unsigned charge, AliHLTUInt32_t clusterId);
     309             :     void FillQMax(unsigned qmax, AliHLTUInt32_t clusterId);
     310             :     void FillFlags(unsigned short flags, AliHLTUInt32_t clusterId);
     311             :     void Fill(int slice, int partition, AliHLTUInt32_t clusterId);
     312             : 
     313             :   private:
     314             :     AliDataContainer(const AliDataContainer&);
     315             :     AliDataContainer& operator=(const AliDataContainer&);
     316             : 
     317             :     TObjArray* fHistograms;     //! array of histograms
     318             :     TObjArray* fHistograms2D;     //! array of histograms
     319             :     TObjArray* fHistograms3D;     //! array of histograms
     320             :     vector<TH1*> fHistogramPointers; //! pointers to histograms
     321             :     vector<TH2*> fHistogram2DPointers; //! pointers to histograms
     322             :     vector<TH3*> fHistogram3DPointers; //! pointers to histograms
     323             :     vector<AliClusterIdBlock> fRemainingClusterIds; //! clusters ids for remaining cluster ids
     324             :     AliClusterIdBlock fTrackModelClusterIds; //! cluster ids for track model clusters
     325             :     AliClusterIdBlock* fCurrentClusterIds; //! id block currently active in the iteration
     326             :     AliHLTSpacePointContainer* fRawData; //! raw data container
     327             :     AliHLTTPCRawCluster fCurrentCluster; //! current cluster
     328             :     int fSector; //! sector
     329             :     iterator fBegin; //!
     330             :     int fMaxSigmaY2Scaled; //! maximum scaled sigmaY2 value determined by the available bit length
     331             :     int fMaxSigmaZ2Scaled; //! maximum scaled sigmaZ2 value determined by the available bit length
     332             :   };
     333             : 
     334             : protected:
     335             :   /// inherited from AliHLTProcessor: data processing
     336             :   int DoEvent( const AliHLTComponentEventData& evtData, 
     337             :                const AliHLTComponentBlockData* blocks, 
     338             :                AliHLTComponentTriggerData& trigData,
     339             :                AliHLTUInt8_t* outputPtr, 
     340             :                AliHLTUInt32_t& size,
     341             :                AliHLTComponentBlockDataList& outputBlocks );
     342             :   using AliHLTProcessor::DoEvent;
     343             : 
     344             :   /// inherited from AliHLTComponent: component initialisation and argument scan.
     345             :   int DoInit( int argc, const char** argv );
     346             : 
     347             :   /// inherited from AliHLTComponent: component cleanup
     348             :   int DoDeinit();
     349             : 
     350             :   /// inherited from AliHLTComponent: argument scan
     351             :   int ScanConfigurationArgument(int argc, const char** argv);
     352             : 
     353             :   /// publish to output
     354             :   int Publish(int mode);
     355             : 
     356           0 :   AliHLTComponentBenchmark* GetBenchmarkInstance() const {return fpBenchmark;}
     357             :     
     358             : private:
     359             :   AliHLTTPCDataCompressionMonitorComponent(const AliHLTTPCDataCompressionMonitorComponent&);
     360             :   AliHLTTPCDataCompressionMonitorComponent& operator=(const AliHLTTPCDataCompressionMonitorComponent&);
     361             : 
     362             :   /// benchmark instance
     363             :   AliHLTComponentBenchmark* fpBenchmark; //! benchmark instance
     364             :   /// cluster decoder instance
     365             :   AliHLTTPCDataCompressionDecoder* fpDecoder; //! cluster decoder instance
     366             :   /// data decoder for HW clusters
     367             :   AliHLTTPCHWCFData* fpHWClusterDecoder; //! data decoder for HW clusters
     368             : 
     369             :   TH2* fHistoHWCFDataSize;         //! hwcf data size vs. event size
     370             :   TH2* fHistoHWCFReductionFactor;  //! reduction factor vs. event size
     371             :   TH2* fHistoTotalReductionFactor;  //! reduction factor vs. event size
     372             :   TH2* fHistoNofClusters; //! number of clusters vs. event size
     373             :   TH2* fHistoNofClustersReductionFactor;  //! reduction factor wrp to hwcf vs. number of clusters
     374             :   TString fHistogramFile; //! file to save histogram
     375             :   AliDataContainer* fMonitoringContainer; //! cluster read interface for monitoring
     376             : 
     377             :   /// verbosity
     378             :   int fVerbosity;  //! verbosity for debug printout
     379             :   unsigned fFlags; //! flags to indicate various conditions
     380             :   int fPublishingMode; //! publishing mode
     381             : 
     382             :   static const AliHistogramDefinition fgkHistogramDefinitions[]; //! histogram definitions
     383             :   static const AliHistogramDefinition2D fgkHistogramDefinitions2D[]; //! histogram definitions
     384             :   static const AliHistogramDefinition3D fgkHistogramDefinitions3D[]; //! histogram definitions
     385             : 
     386           6 :   ClassDef(AliHLTTPCDataCompressionMonitorComponent, 0)
     387             : };
     388             : 
     389             : #endif //ALIHLTTPCDATACOMPRESSIONMONITORCOMPONENT_H

Generated by: LCOV version 1.11