LCOV - code coverage report
Current view: top level - HMPID/HMPIDbase - AliHMPIDQAChecker.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 37 368 10.1 %
Date: 2016-06-14 17:26:59 Functions: 5 13 38.5 %

          Line data    Source code
       1             : /**************************************************************************
       2             :  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
       3             :  *                                                                        *
       4             :  * Author: The ALICE Off-line Project.                                    *
       5             :  * Contributors are mentioned in the code where appropriate.              *
       6             :  *                                                                        *
       7             :  * Permission to use, copy, modify and distribute this software and its   *
       8             :  * documentation strictly for non-commercial purposes is hereby granted   *
       9             :  * without fee, provided that the above copyright notice appears in all   *
      10             :  * copies and that both the copyright notice and this permission notice   *
      11             :  * appear in the supporting documentation. The authors make no claims     *
      12             :  * about the suitability of this software for any purpose. It is          *
      13             :  * provided "as is" without express or implied warranty.                  *
      14             :  **************************************************************************/
      15             : 
      16             : 
      17             : /* $Id$ */
      18             : 
      19             : //...
      20             : //  Checks the quality assurance. 
      21             : //  By comparing with reference data
      22             : //  Skeleton for HMPID
      23             : //...
      24             : 
      25             : // --- ROOT system ---
      26             : #include <TClass.h>
      27             : #include <TH1F.h> 
      28             : #include <TH1I.h>
      29             : #include <TH2.h> 
      30             : #include <TF1.h> 
      31             : #include <TIterator.h> 
      32             : #include <TKey.h> 
      33             : #include <TFile.h>
      34             : #include <TLine.h>
      35             : #include <TParameter.h> 
      36             : #include <TPaveText.h>
      37             : // --- Standard library ---
      38             : 
      39             : // --- AliRoot header files ---
      40             : #include "AliLog.h"
      41             : #include "AliQAv1.h"
      42             : #include "AliQAChecker.h"
      43             : #include "AliHMPIDQAChecker.h"
      44             : #include "AliCDBEntry.h"
      45             : #include "AliQAManager.h"
      46             : #include "AliQAThresholds.h"
      47             : 
      48          16 : ClassImp(AliHMPIDQAChecker)
      49             :  //_________________________________________________________________
      50             : AliHMPIDQAChecker::AliHMPIDQAChecker() : 
      51           3 : AliQACheckerBase("HMPID","HMPID Quality Assurance Data Checker"), 
      52           3 : fNoReference(kTRUE),
      53           3 : fQARefRec(NULL),
      54             : 
      55           3 : fHmpQaThr_NumberOfExcludedDDL(0),
      56           3 : fHmpQaThr_DataSizeLowerThreshold(900),
      57           3 : fHmpQaThr_DataSizeUpperThreshold(1500),
      58           3 : fHmpQaThr_PadOccupancyLowerThreshold(0.005),
      59           3 : fHmpQaThr_PadOccupancyUpperThreshold(0.8),
      60           3 : fHmpQaThr_SectorGainLossWarningThreshold(3),
      61           3 : fHmpQaThr_SectorGainLossErrorThreshold(6),
      62           3 : fHmpQaThr_MissingPadFractionWarningThreshold(0.3),
      63           3 : fHmpQaThr_MissingPadFractionErrorThreshold(0.5),
      64           3 : fIsOnlineThr(kFALSE)                                 
      65             :  
      66             : 
      67             : 
      68          15 : {
      69             :     //ctor, fetches the reference data from OCDB 
      70           9 :   char * detOCDBDir = Form("HMPID/%s/%s", AliQAv1::GetRefOCDBDirName(), AliQAv1::GetRefDataDirName()) ; 
      71          12 :   AliCDBEntry * QARefRec = AliQAManager::QAManager()->Get(detOCDBDir);
      72           3 :   if(QARefRec) {
      73           0 :     fQARefRec = dynamic_cast<TObjArray*> (QARefRec->GetObject()) ; 
      74           0 :     if (fQARefRec)
      75           0 :       if (fQARefRec->GetEntries()) 
      76           0 :         fNoReference = kFALSE ;            
      77           0 :     if (fNoReference) 
      78           0 :       AliInfo("QA reference data NOT retrieved for Reconstruction check. No HMPIDChecker!");
      79             :   }
      80             :     
      81           6 : }
      82             : 
      83             : //_________________________________________________________________
      84             : AliHMPIDQAChecker::~AliHMPIDQAChecker() 
      85           0 : {
      86           0 :   if(fQARefRec) { fQARefRec->Delete() ;   delete fQARefRec ; }
      87           0 : }
      88             : //_________________________________________________________________
      89             : void AliHMPIDQAChecker::Check(Double_t *  check, AliQAv1::ALITASK_t index, TObjArray ** list, const AliDetectorRecoParam * /*recoParam*/) 
      90             : {
      91             : //
      92             : // Main check function: Depending on the TASK, different checks are applied
      93             : // At the moment:       check for empty histograms and checks for RecPoints
      94             : 
      95          18 :   InitOnlineThresholds();    
      96             :   
      97           9 :   if(fNoReference)  
      98             : 
      99         108 :   for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
     100          45 :     check[specie] = 1.0;    
     101             :     //printf("+++++++++++++++++++++ specie %d name: %s \n",specie,AliRecoParam::GetEventSpecieName(specie));
     102          45 :     if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) ) continue ;     
     103             :     // checking for empy histograms
     104           0 :     if(CheckEntries(list[specie]) == 0)  {
     105           0 :       AliWarning("histograms are empty");
     106           0 :       check[specie] = 0.4;//-> Corresponds to kWARNING see AliQACheckerBase::Run
     107           0 :     }
     108             :   
     109           0 :     check[specie] = AliQAv1::kINFO ;
     110             :     
     111             :     
     112             :     //check sim
     113           0 :     if(index == AliQAv1::kSIM) check[specie] = CheckSim(list[specie], fQARefRec);
     114             : 
     115             :     // checking rec points
     116           0 :     if(index == AliQAv1::kREC) check[specie] = CheckRec(list[specie], fQARefRec);
     117             :    
     118             :     //checking raw data
     119           0 :     if(index == AliQAv1::kRAW) {       check[specie] = CheckRaw(specie,list[specie]);       }
     120             :                                
     121             :     
     122           9 :   } // species loop
     123           9 : }
     124             : //_________________________________________________________________
     125             : Double_t AliHMPIDQAChecker::CheckEntries(TObjArray * list) const
     126             : {
     127             :   //
     128             :   //  check on the QA histograms on the input list: 
     129             :   // 
     130             : 
     131             :   Double_t test = 0.0  ;
     132             :   Int_t count = 0 ; 
     133             :   
     134           0 :   if (list->GetEntries() == 0){  
     135             :     test = 1. ; // nothing to check
     136           0 :   }
     137             :   else {
     138           0 :     TIter next(list) ; 
     139             :     TH1 * hdata ;
     140             :     count = 0 ; 
     141           0 :     while ( (hdata = dynamic_cast<TH1 *>(next())) ) {
     142           0 :       if (hdata) { 
     143             :         Double_t rv = 0.;
     144           0 :         if(hdata->GetEntries()>0)rv=1; 
     145           0 :         count++ ; 
     146           0 :         test += rv ; 
     147           0 :       }
     148             :       else{
     149           0 :         AliError("Data type cannot be processed") ;
     150             :       }
     151             :       
     152             :     }
     153           0 :     if (count != 0) { 
     154           0 :       if (test==0) {
     155           0 :         AliWarning("Histograms are booked for THIS specific Task, but they are all empty: setting flag to kWARNING");
     156             :         test = 0.;  //upper limit value to set kWARNING flag for a task
     157           0 :       }
     158             :       else test = 1 ;
     159             :     }
     160           0 :   }
     161             : 
     162           0 :   return test ; 
     163           0 : }  
     164             : //_________________________________________________________________
     165             : Double_t AliHMPIDQAChecker::CheckSim(TObjArray *listsim, TObjArray *listref) const
     166             : {
     167             :   //
     168             :   //  check on the HMPID RecPoints by using expo fit and Kolmogorov Test:
     169             :   //
     170             : 
     171             :    Float_t checkresponse = 0;
     172             : 
     173             :    Float_t counter = 0 ;
     174           0 :    TIter next(listsim) ;
     175             :    TH1* histo;
     176           0 :    while ( (histo = dynamic_cast<TH1 *>(next())) ) {
     177             :      //PH The histogram should have at least 10 bins with at least 5 entries
     178             :      Int_t nbinsabove = 0;
     179           0 :      for (Int_t ibin=histo->FindBin(1); ibin<=histo->FindBin(50); ibin++) { 
     180           0 :        if (histo->GetBinContent(ibin)>5) nbinsabove++;
     181             :      }
     182             : 
     183           0 :    if( nbinsabove < 10 ) counter++;
     184             :    else {
     185           0 :     TString h = histo->GetTitle();
     186           0 :     if(h.Contains("Zoom")){
     187           0 :     histo->Fit("expo","LQ0","",5,50);
     188           0 :     if(histo->GetFunction("expo")->GetParameter(1) !=0 ) if(TMath::Abs((-1./(histo->GetFunction("expo"))->GetParameter(1)) - 35 ) > 5) counter++;
     189             :     }
     190           0 :     if(h.Contains("size  MIP"))   if(TMath::Abs(histo->GetMean()-5) > 2) counter++;
     191           0 :     if(h.Contains("size  Phots")) if(TMath::Abs(histo->GetMean()-2) > 2) counter++;
     192           0 :     if(h.Contains("distribution")) if(histo->KolmogorovTest((TH1F *)listref->At(0))<0.8) counter++;
     193           0 :     AliDebug(AliQAv1::GetQADebugLevel(),Form(" Kolm. test : %f ",histo->KolmogorovTest((TH1F *)listref->At(0))));  
     194           0 :    }
     195             :   }
     196           0 :  Float_t response = counter/(7.+7.+42.+42.); // 7.+7.+42 +42 = N checked histograms (-> To be replaced by listsim->GetEntries())
     197             :  
     198           0 :  if(response < 0.1) checkresponse = 0.7;      // <10% of the check histograms show a failing check -> Corresponds to kINFO see AliQACheckerBase::Run
     199           0 :  else if(response < 0.5) checkresponse = 0.4; //  50%  of the check histograms show a failing check -> Corresponds to kWARNING see AliQACheckerBase::Run
     200             :  else checkresponse = 0.001;                  // > 50% of the check histograms show a failing check -> Corresponds to kERROR see AliQACheckerBase::Run
     201           0 :  return checkresponse;
     202           0 : }
     203             : 
     204             : //___________________________________________________________________________________________________
     205             : Double_t AliHMPIDQAChecker::CheckRec(TObjArray *listrec, TObjArray *listref) const
     206             : {
     207             :   //
     208             :   //  check on the HMPID RecPoints by using expo fit and Kolmogorov Test:
     209             :   //
     210             : 
     211             :    Float_t checkresponse = 0;
     212             : 
     213             :    Float_t counter = 0 ;
     214           0 :    TIter next(listrec) ;
     215             :    TH1* histo;
     216           0 :    while ( (histo = dynamic_cast<TH1 *>(next())) ) {
     217             :      //PH The histogram should have at least 10 bins with at least 5 entries
     218             :      Int_t nbinsabove = 0;
     219           0 :      for (Int_t ibin=histo->FindBin(1); ibin<=histo->FindBin(50); ibin++) { 
     220           0 :        if (histo->GetBinContent(ibin)>5) nbinsabove++;
     221             :      }
     222             : 
     223           0 :    if( nbinsabove < 10 ) counter++;
     224             :    else {
     225           0 :     TString h = histo->GetTitle();
     226           0 :     if(h.Contains("Zoom")){
     227           0 :     histo->Fit("expo","LQ0","",5,50);
     228           0 :     if(histo->GetFunction("expo")->GetParameter(1) !=0 ) if(TMath::Abs((-1./(histo->GetFunction("expo"))->GetParameter(1)) - 35 ) > 5) counter++;
     229             :     }
     230           0 :     if(h.Contains("size  MIP"))   if(TMath::Abs(histo->GetMean()-5) > 2) counter++;
     231           0 :     if(h.Contains("size  Phots")) if(TMath::Abs(histo->GetMean()-2) > 2) counter++;
     232           0 :     if(h.Contains("distribution")) if(histo->KolmogorovTest((TH1F *)listref->At(0))<0.8) counter++;
     233           0 :     AliDebug(AliQAv1::GetQADebugLevel(),Form(" Kolm. test : %f ",histo->KolmogorovTest((TH1F *)listref->At(0))));  
     234           0 :    }
     235             :   }
     236           0 :  Float_t response = counter/(7.+7.+42.+42.); // 7.+7.+42 +42 = N checked histograms (-> To be replaced by listrec->GetEntries())
     237             :  
     238           0 :  if(response < 0.1) checkresponse = 0.7;      // <10% of the check histograms show a failing check -> Corresponds to kINFO see AliQACheckerBase::Run
     239           0 :  else if(response < 0.5) checkresponse = 0.4; //  50%  of the check histograms show a failing check -> Corresponds to kWARNING see AliQACheckerBase::Run
     240             :  else checkresponse = 0.001;                  // > 50% of the check histograms show a failing check -> Corresponds to kERROR see AliQACheckerBase::Run
     241           0 :  return checkresponse;
     242           0 : }
     243             : //___________________________________________________________________________________________________
     244             : Double_t AliHMPIDQAChecker::CheckRaw(Int_t specie, TObjArray* list)
     245             : {
     246             :   //
     247             :   // Check the raw data for offline / online using default or updated thresholds from AMORE
     248             :   // As of now (06/07/2012) the quality flag of all histos in raw will be est to the result of teh CheckRaw and displayed
     249             :   // in AMORE. But we can pu undividual labels.
     250             :   //
     251             :   
     252             :   //Int_t raqQualFlag = AliQAv1::kNULLBit;
     253             :   
     254           0 :   Int_t hmpQaFlags[4]={-1}; //init for the 4 shifter histos
     255             :   
     256           0 :   TString histname ="null";
     257           0 :   TPaveText text(0.65,0.8,0.9,0.99,"NDC"); 
     258           0 :   TPaveText text1(0.65,0.8,0.9,0.99,"NDC"); 
     259             :    
     260             :  
     261           0 :   Int_t entries = list->GetEntriesFast();
     262             :   
     263           0 :   if ( entries == 0 ) {
     264           0 :      AliWarning(Form("HMPID QA Checker RAWS: no object to analyse! Exiting..."));
     265           0 :      return AliQAv1::kFATAL;
     266             :   }
     267             :   
     268           0 :   TLine* lineDdlDataSizeMin = new TLine(1536,fHmpQaThr_DataSizeUpperThreshold,1548,fHmpQaThr_DataSizeUpperThreshold);
     269           0 :   TLine* lineDdlDataSizeMax = new TLine(1536,fHmpQaThr_DataSizeLowerThreshold,1548,fHmpQaThr_DataSizeLowerThreshold);
     270             :   
     271           0 :   TLine* linePadOccupMin = new TLine(1536,fHmpQaThr_PadOccupancyUpperThreshold,1548,fHmpQaThr_PadOccupancyUpperThreshold);
     272           0 :   TLine* linePadOccupMax = new TLine(1536,fHmpQaThr_PadOccupancyLowerThreshold,1548,fHmpQaThr_PadOccupancyLowerThreshold);
     273             :   
     274             :   
     275             :   Int_t badDdlCnt = 0, badOccCnt = 0;
     276             :   
     277             :   //___ check data size per ddl
     278           0 :   if( list->FindObject(Form("%s_hHmpDdlDataSize",AliRecoParam::GetEventSpecieName(specie)) )) 
     279             :     {
     280           0 :       TH1* h1 = dynamic_cast<TH1*>( list->FindObject(Form("%s_hHmpDdlDataSize",AliRecoParam::GetEventSpecieName(specie)))); 
     281           0 :       if(h1) {
     282           0 :       if( h1->Integral() > 1 ) {
     283             :       // no entres -> fatal
     284             :       //if( h1->GetEntries() == 0) {raqQualFlag = AliQAv1::kFATAL;}
     285           0 :       h1->SetStats(0);
     286             :       
     287             :       
     288             :       // clean up the text, stat, lines, ...
     289           0 :       if( h1->GetListOfFunctions() ) h1->GetListOfFunctions()->Clear();
     290             :       
     291           0 :       for ( Int_t iddl = 1 ; iddl <= 14; iddl++)
     292             :         {
     293           0 :           if( h1->GetBinContent(iddl) < fHmpQaThr_DataSizeLowerThreshold || h1->GetBinContent(iddl) > fHmpQaThr_DataSizeUpperThreshold ) badDdlCnt++; 
     294             :         }
     295             :       //___ check if one or more DDLs are excluded
     296             :         
     297             :       
     298           0 :       badDdlCnt -= fHmpQaThr_NumberOfExcludedDDL;
     299             :       
     300             :       
     301             :       
     302             :       //___ check how many are bad
     303           0 :       if ( badDdlCnt == 0 )  
     304             :         {         
     305           0 :           hmpQaFlags[0] = AliQAv1::kINFO;
     306           0 :           text1.Clear();
     307           0 :           text1.AddText(Form("OK (%d)",fIsOnlineThr));
     308           0 :           text1.SetFillColor(kGreen);
     309           0 :           h1->GetListOfFunctions()->Add((TPaveText*)text1.Clone());        
     310           0 :           lineDdlDataSizeMin->SetLineColor(kGreen);
     311           0 :           lineDdlDataSizeMax->SetLineColor(kGreen);
     312           0 :           h1->GetListOfFunctions()->Add((TLine*)lineDdlDataSizeMin->Clone());
     313           0 :           h1->GetListOfFunctions()->Add((TLine*)lineDdlDataSizeMax->Clone());
     314             :         }
     315           0 :       else if ( badDdlCnt == 1 )  
     316             :         {         
     317           0 :           hmpQaFlags[0]  = AliQAv1::kWARNING;
     318           0 :           text1.Clear();
     319           0 :           text1.AddText(Form("WARNING CHECK TWIKI (%d)",fIsOnlineThr));
     320           0 :           text1.SetFillColor(kOrange);
     321           0 :           h1->GetListOfFunctions()->Add((TPaveText*)text1.Clone());       
     322           0 :           lineDdlDataSizeMin->SetLineColor(kOrange);
     323           0 :           lineDdlDataSizeMax->SetLineColor(kOrange);
     324           0 :           h1->GetListOfFunctions()->Add((TLine*)lineDdlDataSizeMin->Clone());
     325           0 :           h1->GetListOfFunctions()->Add((TLine*)lineDdlDataSizeMax->Clone());   
     326             :         }
     327           0 :       else if (  badDdlCnt >= 2 )  
     328             :         {
     329           0 :           hmpQaFlags[0]  = AliQAv1::kERROR;         
     330           0 :           text1.Clear();
     331           0 :           text1.AddText(Form("ERROR CALL ONCALL (%d)",fIsOnlineThr));
     332           0 :           text1.SetFillColor(kRed);
     333           0 :           h1->GetListOfFunctions()->Add((TPaveText*)text1.Clone());             
     334           0 :           lineDdlDataSizeMin->SetLineColor(kRed);
     335           0 :           lineDdlDataSizeMax->SetLineColor(kRed);
     336           0 :           h1->GetListOfFunctions()->Add((TLine*)lineDdlDataSizeMin->Clone());
     337           0 :           h1->GetListOfFunctions()->Add((TLine*)lineDdlDataSizeMax->Clone());   
     338             :         }
     339             :       else 
     340             :         {
     341           0 :           hmpQaFlags[0]  = AliQAv1::kFATAL;
     342           0 :           text1.Clear();
     343           0 :           text1.AddText(Form("FATAL CALL ONCALL (%d)",fIsOnlineThr));
     344           0 :           text1.SetFillColor(kRed);
     345           0 :           h1->GetListOfFunctions()->Add((TPaveText*)text1.Clone());             
     346           0 :           lineDdlDataSizeMin->SetLineColor(kRed);
     347           0 :           lineDdlDataSizeMax->SetLineColor(kRed);
     348           0 :           h1->GetListOfFunctions()->Add((TLine*)lineDdlDataSizeMin->Clone());
     349           0 :           h1->GetListOfFunctions()->Add((TLine*)lineDdlDataSizeMax->Clone());   
     350             :         }
     351             :       }
     352             :       }//the histo is filled
     353           0 :     }//___hHmpDdlDataSize
     354             :   
     355             :   
     356             :   
     357           0 :   if( list->FindObject(Form("%s_fHmpPadOcc",AliRecoParam::GetEventSpecieName(specie)) )) 
     358             :     {
     359             :      
     360             :       
     361           0 :       TH1* h1 = dynamic_cast<TH1*>( list->FindObject(Form("%s_fHmpPadOcc",AliRecoParam::GetEventSpecieName(specie)))); 
     362           0 :        if(h1) {
     363           0 :        if( h1->Integral() > 1 ) {
     364             :       // no entres -> fatal
     365             :       //if( h1->GetEntries() == 0) {raqQualFlag = AliQAv1::kFATAL;}
     366           0 :        h1->SetStats(0);
     367             :       // clean up the text, stat, lines, ...
     368           0 :       if( h1->GetListOfFunctions() ) h1->GetListOfFunctions()->Clear();
     369             :       
     370           0 :       for ( Int_t iddl = 1 ; iddl <= 14; iddl++)
     371             :         {
     372           0 :           if( h1->GetBinContent(iddl) < fHmpQaThr_PadOccupancyLowerThreshold || h1->GetBinContent(iddl) > fHmpQaThr_PadOccupancyUpperThreshold ) badOccCnt++; 
     373             :         }
     374             :        
     375           0 :       badOccCnt -= fHmpQaThr_NumberOfExcludedDDL;
     376             :          
     377             :       //___ check how many are bad
     378           0 :       if ( badOccCnt == 0 )  
     379             :         {
     380           0 :           hmpQaFlags[1]  = AliQAv1::kINFO;
     381           0 :           text.Clear();
     382           0 :           text.AddText(Form("OK (%d)",fIsOnlineThr));
     383           0 :           text.SetFillColor(kGreen);
     384           0 :           h1->GetListOfFunctions()->Add((TPaveText*)text.Clone());        
     385           0 :           linePadOccupMin->SetLineColor(kGreen);
     386           0 :           linePadOccupMax->SetLineColor(kGreen);
     387           0 :           h1->GetListOfFunctions()->Add((TLine*)linePadOccupMin->Clone());
     388           0 :           h1->GetListOfFunctions()->Add((TLine*)linePadOccupMax->Clone());         
     389             :         }
     390           0 :       else if ( badOccCnt == 1 )  
     391             :         {
     392           0 :           hmpQaFlags[1]  = AliQAv1::kWARNING;
     393           0 :           text.Clear();
     394           0 :           text.AddText(Form("WARNING CHECK TWIKI (%d)",fIsOnlineThr));
     395           0 :           text.SetFillColor(kOrange);
     396           0 :           h1->GetListOfFunctions()->Add((TPaveText*)text.Clone());        
     397           0 :           linePadOccupMin->SetLineColor(kGreen);
     398           0 :           linePadOccupMax->SetLineColor(kGreen);
     399           0 :           h1->GetListOfFunctions()->Add((TLine*)linePadOccupMin->Clone());
     400           0 :           h1->GetListOfFunctions()->Add((TLine*)linePadOccupMax->Clone());
     401             :         }
     402           0 :       else if (  badOccCnt == 2 )  
     403             :         {
     404           0 :           hmpQaFlags[1]  = AliQAv1::kERROR;
     405           0 :           text.Clear();
     406           0 :           text.AddText(Form("ERROR CALL ONCALL (%d)",fIsOnlineThr));
     407           0 :           text.SetFillColor(kRed);
     408           0 :           h1->GetListOfFunctions()->Add((TPaveText*)text.Clone());              
     409           0 :           linePadOccupMin->SetLineColor(kGreen);
     410           0 :           linePadOccupMax->SetLineColor(kGreen);
     411           0 :           h1->GetListOfFunctions()->Add((TLine*)linePadOccupMin->Clone());
     412           0 :           h1->GetListOfFunctions()->Add((TLine*)linePadOccupMax->Clone());
     413             :         }
     414             :       else 
     415             :         {
     416           0 :           hmpQaFlags[1] = AliQAv1::kFATAL;
     417           0 :           text.Clear();
     418           0 :           text.AddText(Form("FATAL CALL ONCALL (%d)",fIsOnlineThr));
     419           0 :           text.SetFillColor(kRed);
     420           0 :           h1->GetListOfFunctions()->Add((TPaveText*)text.Clone());              
     421           0 :           linePadOccupMin->SetLineColor(kGreen);
     422           0 :           linePadOccupMax->SetLineColor(kGreen);
     423           0 :           h1->GetListOfFunctions()->Add((TLine*)linePadOccupMin->Clone());
     424           0 :           h1->GetListOfFunctions()->Add((TLine*)linePadOccupMax->Clone());   
     425             :         }
     426             :       }
     427             :     }
     428           0 :     }//___HmpPadOcc
     429             :   
     430           0 :   Int_t sumPadMapChROR[7]={0};
     431           0 :   Int_t sumPadMapChROL[7]={0};
     432             :   Int_t bigMapFlag =  AliQAv1::kINFO;
     433             :   Int_t errCntBigMap = 0;
     434             : 
     435           0 :   if( list->FindObject(Form("%s_hHmpBigMap",AliRecoParam::GetEventSpecieName(specie)) )) 
     436             :     {
     437           0 :       TH2* h2 = dynamic_cast<TH2*>( list->FindObject(Form("%s_hHmpBigMap",AliRecoParam::GetEventSpecieName(specie)))); 
     438           0 :       if(h2) {
     439           0 :         if( h2->Integral() > 1 ) {
     440             :       // no entres -> fatal
     441             :      // if( h2->GetEntries() == 0) {raqQualFlag = AliQAv1::kFATAL;}
     442           0 :        h2->SetStats(0);
     443             :       // clean up the text, stat, lines, ...
     444           0 :       if( h2->GetListOfFunctions() ) h2->GetListOfFunctions()->Clear();
     445             : 
     446             :       //calculate missing pad fraction
     447           0 :       for(Int_t ich = 0; ich < 7; ich++)
     448             :         {
     449           0 :           for(Int_t iy=1+ich*144;iy<=144+ich*144;iy++) {
     450           0 :             for(Int_t ix=1;ix<=80;ix++)    if(h2->GetBinContent(ix,iy) > 0) sumPadMapChROL[ich]++;
     451           0 :             for(Int_t ix=81;ix<=160;ix++)  if(h2->GetBinContent(ix,iy) > 0) sumPadMapChROR[ich]++;        
     452             :           }
     453             :         }//ch loop
     454             :        //check the calculated missing pad fraction
     455           0 :       for(Int_t ich = 0; ich < 7; ich++)
     456             :         {
     457             :           
     458             :           bigMapFlag =  AliQAv1::kINFO; 
     459           0 :           if( (1-sumPadMapChROL[ich]/1.0/11520) > fHmpQaThr_MissingPadFractionWarningThreshold ||
     460           0 :               (1-sumPadMapChROR[ich]/1.0/11520) > fHmpQaThr_MissingPadFractionWarningThreshold ) 
     461             :           {
     462             :             bigMapFlag =  AliQAv1::kWARNING;
     463           0 :             }
     464           0 :           if( (1-sumPadMapChROL[ich]/1.0/11520) > fHmpQaThr_MissingPadFractionErrorThreshold ||
     465           0 :               (1-sumPadMapChROR[ich]/1.0/11520) > fHmpQaThr_MissingPadFractionErrorThreshold ) {
     466             :              bigMapFlag =  AliQAv1::kERROR; 
     467           0 :              errCntBigMap++;
     468           0 :            }      
     469             :           
     470             :         }//ch loop
     471           0 :       if( errCntBigMap > 0 ) bigMapFlag =  AliQAv1::kERROR;
     472             : 
     473             :       //update labels
     474           0 :        if (  bigMapFlag == AliQAv1::kINFO )  
     475             :         {
     476           0 :           hmpQaFlags[2]  = AliQAv1::kINFO;
     477           0 :           text.Clear();
     478           0 :           text.AddText(Form("OK (%d)",fIsOnlineThr));
     479           0 :           text.SetFillColor(kGreen);
     480           0 :           h2->GetListOfFunctions()->Add((TPaveText*)text.Clone());        
     481             :         }
     482           0 :        else if (  bigMapFlag == AliQAv1::kWARNING )  
     483             :         {
     484           0 :           hmpQaFlags[2]  = AliQAv1::kWARNING;
     485           0 :           text.Clear();
     486           0 :           text.AddText(Form("WARNING CHECK TWIKI (%d)",fIsOnlineThr));
     487           0 :           text.SetFillColor(kOrange);
     488           0 :           h2->GetListOfFunctions()->Add((TPaveText*)text.Clone());        
     489             :         }
     490           0 :        else if (  bigMapFlag == AliQAv1::kERROR )  
     491             :         {
     492           0 :           hmpQaFlags[2]  = AliQAv1::kERROR;
     493           0 :           text.Clear();
     494           0 :           text.AddText(Form("ERROR CALL ONCALL (%d)",fIsOnlineThr));
     495           0 :           text.SetFillColor(kRed);
     496           0 :           h2->GetListOfFunctions()->Add((TPaveText*)text.Clone());        
     497             :         }
     498             :        else
     499             :          {
     500           0 :            hmpQaFlags[2]  = AliQAv1::kFATAL;
     501           0 :            text.Clear();
     502           0 :            text.AddText(Form("FATAL CALL ONCALL (%d)",fIsOnlineThr));
     503           0 :            text.SetFillColor(kRed);
     504           0 :            h2->GetListOfFunctions()->Add((TPaveText*)text.Clone());       
     505             :          }      
     506             :         }       
     507             :      }
     508           0 :     }//___HmpBigMap
     509             :   
     510             : 
     511             :   Int_t numSectorsMissing = 0, numSectorsGainLoss = 0;
     512           0 :   Double_t  hSumQPerSector[42]={0};
     513             : 
     514           0 :   if( list->FindObject(Form("%s_fHmpHvSectorQ",AliRecoParam::GetEventSpecieName(specie))))
     515             :     {
     516             :       
     517           0 :       TH2* h2 = dynamic_cast<TH2*>( list->FindObject(Form("%s_fHmpHvSectorQ",AliRecoParam::GetEventSpecieName(specie)))); 
     518           0 :       if(h2) {
     519           0 :         if(h2->Integral() > 0 ) {
     520             :       // no entres -> fatal
     521             :      // if( h2->GetEntries() == 0) {raqQualFlag = AliQAv1::kFATAL;}
     522           0 :              h2->SetStats(0);
     523             :       // clean up the text, stat, lines, ...
     524           0 :       if( h2->GetListOfFunctions() ) h2->GetListOfFunctions()->Clear();
     525             :      
     526             :       //___ check sectors 
     527           0 :       for(Int_t isec = 1 ; isec <= 42; isec++)
     528             :         {
     529           0 :           for(Int_t ibiny=100;ibiny<410;ibiny++) {hSumQPerSector[isec-1] += h2->GetBinContent(ibiny,isec); }
     530           0 :           if(hSumQPerSector[isec-1]  < 0.001) {numSectorsGainLoss++;}  // there is no photon and mip peak, gain loss
     531           0 :           if(h2->GetBinContent(1,isec) < 0.01 ) {numSectorsMissing++; } //practically there is no charge , the sector is missing
     532             :         }
     533           0 :       Int_t  sectorErrors = numSectorsGainLoss+numSectorsMissing;
     534             :      
     535             :       
     536           0 :         if ( sectorErrors <=  3)
     537             :           {
     538           0 :             hmpQaFlags[3]  = AliQAv1::kINFO;
     539           0 :             text.Clear();
     540           0 :             text.AddText(Form("OK (%d)",fIsOnlineThr));
     541           0 :             text.SetFillColor(kGreen);
     542           0 :             h2->GetListOfFunctions()->Add((TPaveText*)text.Clone());         
     543             :           }
     544           0 :         else if ( sectorErrors > fHmpQaThr_SectorGainLossWarningThreshold)
     545             :           {
     546           0 :             hmpQaFlags[3]  = AliQAv1::kWARNING;
     547           0 :             text.Clear();
     548           0 :             text.AddText(Form("WARNING CHECK TWIKI (%d)",fIsOnlineThr));
     549           0 :             if(numSectorsMissing > 0 ) text.AddText(Form("MISSING SECTOR?"));              
     550           0 :             text.SetFillColor(kOrange);
     551           0 :             h2->GetListOfFunctions()->Add((TPaveText*)text.Clone());
     552             :           }
     553           0 :         else if ( sectorErrors > fHmpQaThr_SectorGainLossErrorThreshold)
     554             :           {
     555           0 :             hmpQaFlags[3]  = AliQAv1::kERROR;
     556           0 :             text.Clear();
     557           0 :             text.AddText(Form("ERROR CALL ONCALL (%d)",fIsOnlineThr));
     558           0 :             if(numSectorsMissing > 0 ) text.AddText(Form("MISSING SECTOR?"));
     559           0 :             text.SetFillColor(kRed);
     560           0 :             h2->GetListOfFunctions()->Add((TPaveText*)text.Clone());      
     561             :           }
     562             :         else
     563             :           {
     564           0 :             hmpQaFlags[3]  = AliQAv1::kFATAL;
     565           0 :             text.Clear();
     566           0 :             text.AddText(Form("FATAL CALL ONCALL (%d)",fIsOnlineThr));
     567           0 :             text.SetFillColor(kRed);
     568           0 :             h2->GetListOfFunctions()->Add((TPaveText*)text.Clone());      
     569             :           }
     570           0 :         }
     571             :     }
     572           0 :   }
     573             :   
     574             :   
     575             :   //del lines, ...
     576           0 :   lineDdlDataSizeMin->Delete();
     577           0 :   lineDdlDataSizeMax->Delete();
     578           0 :   linePadOccupMin->Delete();
     579           0 :   linePadOccupMax->Delete();
     580             :   
     581             :   Double_t dflag = -1;
     582           0 :   switch ( TMath::MaxElement(4,hmpQaFlags))
     583             :     {
     584             :     case  AliQAv1::kINFO:
     585             :       dflag = 1.0;
     586             :       
     587           0 :       break;
     588             :     case AliQAv1::kWARNING:
     589             :       dflag = 0.75;
     590             :       
     591           0 :       break;
     592             :     case AliQAv1::kERROR:
     593             :       dflag = 0.25;
     594             :       
     595           0 :       break;
     596             :     case AliQAv1::kFATAL:
     597             :       dflag = -1.0;
     598             :      
     599           0 :       break;
     600             :     default:
     601             :       dflag = AliQAv1::kNULLBit;
     602             :      
     603           0 :       break;
     604             :     }     
     605             :      
     606             :   return dflag;
     607             :   
     608             :   
     609             :   
     610           0 : }
     611             : //___________________________________________________________________________________________________
     612             : void AliHMPIDQAChecker::InitOnlineThresholds()
     613             : {
     614             :   //
     615             :   // Init the online thresholds from GRP generated by AMORE
     616             :   //
     617             :   
     618          18 :   AliCDBManager* man = AliCDBManager::Instance(); 
     619           9 :   if(!man)  {     fIsOnlineThr = kFALSE;     return;   }
     620             :   
     621             : 
     622          18 :   if(!man->Get("GRP/Calib/QAThresholds"))  {     fIsOnlineThr = kFALSE;    return;    }
     623             :  
     624          18 :   AliCDBEntry* entry = man->Get("GRP/Calib/QAThresholds");
     625           9 :   if(!entry)    {     fIsOnlineThr = kFALSE;    return;    }
     626             :   
     627           9 :   TObjArray* branch = (TObjArray*) entry->GetObject();
     628           9 :   if(!branch ) {     fIsOnlineThr = kFALSE;     return;    }
     629             : 
     630           9 :   AliQAThresholds* thresholds = (AliQAThresholds*) branch->FindObject("HMP");  
     631          27 :   if(!thresholds) { fIsOnlineThr = kFALSE; return;   }
     632             :   else 
     633           9 :      fIsOnlineThr = kTRUE; 
     634             :   
     635             :   
     636             :   Int_t teCnt = 0;
     637           0 :   TString parName = "zero";
     638           0 :   while ( thresholds->GetThreshold(teCnt)) 
     639             :   {
     640           0 :      if(!((thresholds->GetThreshold(teCnt))->GetName())) return;
     641             :          
     642           0 :      parName = (thresholds->GetThreshold(teCnt))->GetName();
     643             :      
     644           0 :      if( parName.Contains("HmpNumberOfExcludedDDLthreshold") )
     645             :      {
     646           0 :        TParameter<int>* myParam = (TParameter<int>*) thresholds->GetThreshold(teCnt); 
     647           0 :        fHmpQaThr_NumberOfExcludedDDL = myParam->GetVal();
     648           0 :      }
     649             :    
     650             :      
     651           0 :      if( parName.Contains("HmpDataSizeLowerThreshold") ) 
     652             :      {
     653           0 :        TParameter<int>* myParam = (TParameter<int>*) thresholds->GetThreshold(teCnt); 
     654           0 :        fHmpQaThr_DataSizeLowerThreshold = myParam->GetVal();
     655           0 :      }
     656             :              
     657           0 :      if( parName.Contains("HmpDataSizeUpperThreshold") ) 
     658             :      {
     659           0 :        TParameter<int>* myParam = (TParameter<int>*) thresholds->GetThreshold(teCnt); 
     660           0 :        fHmpQaThr_DataSizeUpperThreshold = myParam->GetVal();
     661           0 :      }
     662             :           
     663           0 :      if( parName.Contains("HmpPadOccupancyLowerThreshold") ) 
     664             :      {
     665           0 :        TParameter<float>* myParam = (TParameter<float>*) thresholds->GetThreshold(teCnt); 
     666           0 :        fHmpQaThr_PadOccupancyLowerThreshold = myParam->GetVal();
     667           0 :      }
     668             :            
     669           0 :      if( parName.Contains("HmpPadOccupancyUpperThreshold") ) 
     670             :      {
     671           0 :        TParameter<float>* myParam = (TParameter<float>*) thresholds->GetThreshold(teCnt); 
     672           0 :        fHmpQaThr_PadOccupancyUpperThreshold = myParam->GetVal();
     673           0 :      }
     674             :                     
     675           0 :      if( parName.Contains("HmpSectorGainLossWarningThreshold") ) 
     676             :       {
     677           0 :        TParameter<int>* myParam = (TParameter<int>*) thresholds->GetThreshold(teCnt); 
     678           0 :        fHmpQaThr_SectorGainLossWarningThreshold = myParam->GetVal();
     679           0 :      } 
     680             :        
     681           0 :      if( parName.Contains("HmpSectorGainLossErrorThreshold") ) 
     682             :        {
     683           0 :        TParameter<int>* myParam = (TParameter<int>*) thresholds->GetThreshold(teCnt); 
     684           0 :        fHmpQaThr_SectorGainLossErrorThreshold = myParam->GetVal();
     685           0 :      } 
     686             :        
     687           0 :      if( parName.Contains("HmpMissingPadFractionWarningThreshold") ) 
     688             :        {
     689           0 :        TParameter<float>* myParam = (TParameter<float>*) thresholds->GetThreshold(teCnt); 
     690           0 :        fHmpQaThr_MissingPadFractionWarningThreshold = myParam->GetVal();
     691           0 :      }
     692             :      
     693           0 :      if( parName.Contains("HmpMissingPadFractionErrorThreshold") ) 
     694             :          {
     695           0 :        TParameter<float>* myParam = (TParameter<float>*) thresholds->GetThreshold(teCnt); 
     696           0 :        fHmpQaThr_MissingPadFractionErrorThreshold = myParam->GetVal();
     697           0 :      }
     698             :       
     699           0 :      teCnt++;    
     700             :   }//while
     701             :   
     702             :   
     703             :   // PrintThresholds();
     704           9 : }
     705             : //___________________________________________________________________________________________________
     706             : void AliHMPIDQAChecker::PrintThresholds()
     707             : {
     708           0 :   Printf("--- Printing thresholds ---");  
     709           0 :   Printf("--- Default or online: %i ---",fIsOnlineThr);  
     710           0 :   Printf("--- fHmpQaThr_NumberOfExcludedDDL: %i ---",fHmpQaThr_NumberOfExcludedDDL);
     711           0 :   Printf("--- fHmpQaThr_DataSizeLowerThreshold: %i ---",fHmpQaThr_DataSizeLowerThreshold);
     712           0 :   Printf("--- fHmpQaThr_DataSizeUpperThreshold: %i ---",fHmpQaThr_DataSizeUpperThreshold);
     713           0 :   Printf("--- fHmpQaThr_PadOccupancyLowerThreshold: %f ---",fHmpQaThr_PadOccupancyLowerThreshold);
     714           0 :   Printf("--- fHmpQaThr_PadOccupancyUpperThreshold: %f ---",fHmpQaThr_PadOccupancyUpperThreshold);
     715           0 :   Printf("--- fHmpQaThr_SectorGainLossWarningThreshold: %i ---",fHmpQaThr_SectorGainLossWarningThreshold);
     716           0 :   Printf("--- fHmpQaThr_SectorGainLossErrorThreshold: %i ---",fHmpQaThr_SectorGainLossErrorThreshold);
     717           0 :   Printf("--- fHmpQaThr_MissingPadFractionWarningThreshold: %f ---",fHmpQaThr_MissingPadFractionWarningThreshold);
     718           0 :   Printf("--- fHmpQaThr_MissingPadFractionErrorThreshold: %f ---",fHmpQaThr_MissingPadFractionErrorThreshold);
     719           0 :   Printf("--- Printing thresholds done ---");  
     720             : 
     721             :   
     722             :   
     723             :   
     724           0 : }
     725             : //___________________________________________________________________________________________________
     726             : 
     727             : 

Generated by: LCOV version 1.11