LCOV - code coverage report
Current view: top level - TPC/TPCutil - AliTPCCalibQAChecker.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 30 3.3 %
Date: 2016-06-14 17:26:59 Functions: 1 25 4.0 %

          Line data    Source code
       1             : #ifndef ALITPCCALIBQACHECKER_H
       2             : #define ALITPCCALIBQACHECKER_H
       3             : /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
       4             :  * See cxx source for full Copyright notice                               */
       5             : 
       6             : /////////////////////////////////////////////////////////////////////////////////////////
       7             : //                                                                                     //
       8             : //                  QA checking class                                                  //
       9             : //                                                                                     //
      10             : /////////////////////////////////////////////////////////////////////////////////////////
      11             : 
      12             : #include <TNamed.h>
      13             : #include <TString.h>
      14             : #include <TH1.h>
      15             : 
      16             : class TTree;
      17             : class TIterator;
      18             : class TGraph;
      19             : class TObjArray;
      20             : class TVirtualPad;
      21             : 
      22             : class AliTPCCalibQAChecker : public TNamed {
      23             : public:
      24             :   enum { kNQualityFlags=5 };
      25             :   enum QualityFlag_t { kNULLFLAG=-1, kINFO, kWARNING, kERROR, kFATAL, kNFLAG };
      26             :   enum AlarmType_t   { kMean=0, kBinAny, kBinAll, kNentries};
      27             : 
      28             :   AliTPCCalibQAChecker();
      29             :   AliTPCCalibQAChecker(const char* name, const char *title);
      30             :   
      31             :   virtual ~AliTPCCalibQAChecker();
      32             :   
      33             :   void Process();
      34             : 
      35           0 :   void SetTreeChecker(TTree* &tree)       {fTreePtr=&tree;}
      36           0 :   void SetHistChecker(TH1* &hist)         {fHistPtr=&hist;}
      37           0 :   void SetGraphChecker(TGraph* &graph)    {fGraphPtr=&graph;}
      38           0 :   void SetNumberChecker(Double_t & number) {fNumberPtr=&number;}
      39             : 
      40             :   const AliTPCCalibQAChecker* GetSubChecker(const char* name, Bool_t recursive=kTRUE) const;
      41             :   AliTPCCalibQAChecker* NextSubChecker();
      42             :   Int_t GetNumberOfSubCheckers(Bool_t recursive=kTRUE) const;
      43           0 :   Bool_t HasSubCheckers() const {return GetNumberOfSubCheckers(kFALSE)>0;}
      44             :   
      45             :   void AddSubChecker(AliTPCCalibQAChecker *alarm);
      46             : 
      47             :   //getters
      48           0 :   void GetAlarmThreshold(Double_t &min, Double_t &max, QualityFlag_t quality=kERROR) const {min=fThresMin[quality]; max=fThresMax[quality];}
      49             :   //
      50           0 :   const char* GetDrawString() { return fStrDraw.Data(); }
      51           0 :   const char* GetCutsString() { return fStrCuts.Data(); }
      52           0 :   const char* GetDrawOptString() {return fStrDrawOpt.Data(); }
      53             :   
      54             :   //tree related
      55           0 :   void SetDrawRepresentation(const char *draw, const char* drawOpt="") {fStrDrawRep=draw; fStrDrawRepOpt=drawOpt;}
      56           0 :   void SetDrawAlarm(const char *draw, const char* drawOpt="")          {fStrDraw=draw; fStrDrawOpt=drawOpt;}
      57           0 :   void SetCutString(const char *cutString )                            {fStrCuts=cutString;}
      58             : 
      59             :   //general thresholds for the different qualities
      60             :   void SetAlarmThreshold(Double_t min, Double_t max, QualityFlag_t quality=kERROR);
      61             :   void ResetAlarmThreshold(QualityFlag_t quality);
      62             :   void ResetAlarmThresholds();
      63             : 
      64             :   //descriptions
      65             :   void SetQualityDescription(const char* text, QualityFlag_t quality=kERROR);
      66             :   
      67             :   //alarm type
      68           0 :   void SetAlarmType(AlarmType_t type) {fAlarmType=type;}
      69             :   
      70             : 
      71           0 :   QualityFlag_t GetQuality()      const {return fQualityLevel;}
      72           0 :   Color_t       GetQualityColor() const {return AliTPCCalibQAChecker::QualityColor(fQualityLevel);}
      73           0 :   const char*   GetQualityName()  const {return AliTPCCalibQAChecker::QualityName(fQualityLevel);}
      74           0 :   const char*   GetQualityDescription() const { return QualityDescription(fQualityLevel);}
      75             :   
      76             :   static const char* QualityName(AliTPCCalibQAChecker::QualityFlag_t quality);
      77             :   static Color_t QualityColor(AliTPCCalibQAChecker::QualityFlag_t quality);
      78             :   const char* QualityDescription(QualityFlag_t quality) const;
      79             :   
      80             :   virtual void Draw(Option_t *option="");
      81             :   virtual void Print(Option_t *option="") const;  
      82             : 
      83             :  private:
      84             :   //alarm decision variables
      85             :   TTree   **fTreePtr;                    //! Pointer to the Tree pointer
      86             :   TH1     **fHistPtr;                    //! Pointer to the hist pointer
      87             :   TGraph  **fGraphPtr;                   //! Pointer to the graph pointer
      88             :   Double_t *fNumberPtr;                  //! Pointer to number
      89             :   TH1      *fHist;                       //! Hist pointer for tree processing
      90             : 
      91             :   TIterator *fIterSubCheckers;           //! iterator over sub checkers
      92             : 
      93             :   TObjArray *fArrSubCheckers;      //array with checkers to process
      94             :   TObjArray *fArrAlarmDescriptions; //array with alarm descriptions
      95             :   
      96             :   TString fStrDrawRep;             //draw string for representation histogram to visualise
      97             :   TString fStrDrawRepOpt;          //draw option for representation histogram
      98             :   
      99             :   TString fStrDraw;                //draw string for alarm histogram
     100             :   TString fStrDrawOpt;             //draw option for alarm histogram
     101             : 
     102             :   TString fStrCuts;                //cut string
     103             :   
     104             :   AlarmType_t fAlarmType;          //type of the alarm
     105             :   QualityFlag_t fQualityLevel;     //quality level
     106             :   
     107             :   TObject* fHistRep;                   //visualised histogram
     108             : 
     109             :   Double_t fThresMin[kNQualityFlags];//minimum thresholds
     110             :   Double_t fThresMax[kNQualityFlags];//maximum thresholds
     111             :   
     112             :   void CreateRepresentationHist();
     113           0 :   void ResetRepresentationHist() {if (fHistRep) {delete fHistRep; fHistRep=0x0;}}
     114             :   //general processing
     115             :   void ProcessTree();
     116             :   void ProcessHist();
     117             :   void ProcessGraph();
     118             :   void ProcessNumber();
     119             :   void ProcessSub();
     120             :   //special processing
     121             :   void ProcessEntries();
     122             :   void ProcessMean();
     123             :   void ProcessBin();
     124             :   //
     125             :   void CreateAlarmHist();
     126             :   void ResetAlarmHist();
     127             :   //
     128             :   Int_t DrawInPad(TVirtualPad *pad, Int_t sub=1);
     129             :   void DrawSubNodes(Option_t *option);
     130             :   void DrawRepresentationHist(const Option_t *option);
     131             :   void AddQualityLines(TH1 *hist);
     132             :   //
     133             :   AliTPCCalibQAChecker(const AliTPCCalibQAChecker &cfg);
     134             :   AliTPCCalibQAChecker& operator = (const AliTPCCalibQAChecker &cfg);
     135             :   
     136             :   QualityFlag_t GetQuality(Double_t value) const;
     137             :   QualityFlag_t GetQuality(Int_t n, const Double_t *arr) const;
     138             :   
     139          12 :   ClassDef(AliTPCCalibQAChecker,1);
     140             : };
     141             : 
     142             : //
     143             : //inline functions
     144             : //
     145             : 
     146             : //_________________________________________________________________________
     147             : inline AliTPCCalibQAChecker::QualityFlag_t AliTPCCalibQAChecker::GetQuality(Double_t value) const
     148             : {
     149             :   //
     150             :   // check quality of a value
     151             :   //
     152             : 
     153             :   QualityFlag_t quality=kINFO;
     154             :   //loop over Quality levels
     155           0 :   for (Int_t i=(Int_t)kINFO; i<kNQualityFlags; ++i){
     156           0 :     if (fThresMin[i]>=fThresMax[i]) continue;
     157           0 :     if (value<fThresMin[i]||value>fThresMax[i]) quality=(QualityFlag_t)i;
     158             :   }
     159           0 :   return quality;
     160             : }
     161             : //_________________________________________________________________________
     162             : inline AliTPCCalibQAChecker::QualityFlag_t AliTPCCalibQAChecker::GetQuality(Int_t n, const Double_t *arr) const
     163             : {
     164             :   //
     165             :   // check quality of an array
     166             :   //
     167             :   
     168             :   QualityFlag_t quality=kINFO;
     169             :   //loop over Quality levels
     170           0 :   for (Int_t i=(Int_t)kINFO; i<kNQualityFlags; ++i){
     171           0 :     if (fThresMin[i]>=fThresMax[i]) continue;
     172           0 :     for (Int_t ientry=0; ientry<n; ++ientry){
     173           0 :       Double_t value=arr[ientry];
     174           0 :       if (value<fThresMin[i]||value>fThresMax[i]) quality=(QualityFlag_t)i;
     175             :     }
     176           0 :   }
     177           0 :   return quality;
     178             : }
     179             : 
     180             : #endif

Generated by: LCOV version 1.11