When geometry is loaded, the call to MeanMaterialBudget will lead to AliFatal
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDQAChecker.cxx
index 2486562..bd28aea 100644 (file)
 // --- ROOT system ---
 #include <TClass.h>
 #include <TH1F.h> 
-#include <TH1I.h> 
+#include <TH1I.h>
+#include <TH2.h> 
 #include <TF1.h> 
 #include <TIterator.h> 
 #include <TKey.h> 
-#include <TFile.h> 
-
+#include <TFile.h>
+#include <TLine.h>
+#include <TParameter.h> 
+#include <TPaveText.h>
 // --- Standard library ---
 
 // --- AliRoot header files ---
 #include "AliHMPIDQAChecker.h"
 #include "AliCDBEntry.h"
 #include "AliQAManager.h"
+#include "AliQAThresholds.h"
 
 ClassImp(AliHMPIDQAChecker)
  //_________________________________________________________________
 AliHMPIDQAChecker::AliHMPIDQAChecker() : 
 AliQACheckerBase("HMPID","HMPID Quality Assurance Data Checker"), 
-fNoReference(kTRUE), 
-fQARefRec(NULL)
+fNoReference(kTRUE),
+fQARefRec(NULL),
+
+fHmpQaThr_NumberOfExcludedDDL(0),
+fHmpQaThr_DataSizeLowerThreshold(900),
+fHmpQaThr_DataSizeUpperThreshold(1500),
+fHmpQaThr_PadOccupancyLowerThreshold(0.005),
+fHmpQaThr_PadOccupancyUpperThreshold(0.8),
+fHmpQaThr_SectorGainLossWarningThreshold(3),
+fHmpQaThr_SectorGainLossErrorThreshold(6),
+fHmpQaThr_MissingPadFractionWarningThreshold(0.3),
+fHmpQaThr_MissingPadFractionErrorThreshold(0.5),
+fIsOnlineThr(kFALSE)                                 
+
+
 {
     //ctor, fetches the reference data from OCDB 
   char * detOCDBDir = Form("HMPID/%s/%s", AliQAv1::GetRefOCDBDirName(), AliQAv1::GetRefDataDirName()) ; 
@@ -59,73 +77,49 @@ fQARefRec(NULL)
     if (fNoReference) 
       AliInfo("QA reference data NOT retrieved for Reconstruction check. No HMPIDChecker!");
   }
+    
 }
 
 //_________________________________________________________________
-AliHMPIDQAChecker::AliHMPIDQAChecker(const AliHMPIDQAChecker& qac) : 
-AliQACheckerBase(qac.GetName(), qac.GetTitle()), 
-fNoReference(qac.fNoReference), 
-fQARefRec(NULL)
-{
-  fNoReference = qac.fNoReference ; 
-  if (qac.fQARefRec) {
-    fQARefRec = new TObjArray(qac.fQARefRec->GetEntries()) ; 
-    for (Int_t index=0; index < qac.fQARefRec->GetEntries(); index++) 
-      fQARefRec->Add(qac.fQARefRec->At(index)) ; 
-  }
-}
-
-//_________________________________________________________________
-AliHMPIDQAChecker& AliHMPIDQAChecker::operator=(const AliHMPIDQAChecker& qac) 
-{
-  //
-  // Assignment operator
-  //
-  if (this!=&qac) {
-    AliQACheckerBase::operator=(qac) ;
-    fNoReference = qac.fNoReference  ;
-    fQARefRec    = qac.fQARefRec     ;    
-  }
-  return *this;
-}   
-//_______________________________________________________________________________________________
 AliHMPIDQAChecker::~AliHMPIDQAChecker() 
 {
-  fQARefRec->Delete() ; 
-  delete fQARefRec ; 
+  if(fQARefRec) { fQARefRec->Delete() ;   delete fQARefRec ; }
 }
 //_________________________________________________________________
-Double_t * AliHMPIDQAChecker::Check(AliQAv1::ALITASK_t index, TObjArray ** list, const AliDetectorRecoParam * /*recoParam*/) 
+void AliHMPIDQAChecker::Check(Double_t *  check, AliQAv1::ALITASK_t index, TObjArray ** list, const AliDetectorRecoParam * /*recoParam*/) 
 {
 //
 // Main check function: Depending on the TASK, different checks are applied
 // At the moment:       check for empty histograms and checks for RecPoints
 
-  Double_t * check = new Double_t[AliRecoParam::kNSpecies] ; 
+  InitOnlineThresholds();    
+  
   if(fNoReference)  
-  return check;
 
   for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
-    check[specie] = 1.0;
-    if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) ) 
-      continue ; 
+    check[specie] = 1.0;    
+    //printf("+++++++++++++++++++++ specie %d name: %s \n",specie,AliRecoParam::GetEventSpecieName(specie));
+    if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) ) continue ;     
     // checking for empy histograms
     if(CheckEntries(list[specie]) == 0)  {
       AliWarning("histograms are empty");
       check[specie] = 0.4;//-> Corresponds to kWARNING see AliQACheckerBase::Run
     }
   
+    check[specie] = AliQAv1::kINFO ;
+    
+    
     //check sim
     if(index == AliQAv1::kSIM) check[specie] = CheckSim(list[specie], fQARefRec);
 
     // checking rec points
     if(index == AliQAv1::kREC) check[specie] = CheckRec(list[specie], fQARefRec);
    
-    //default check response. It will be changed when reasonable checks will be considered
-    else check[specie] = 0.7 ; // /-> Corresponds to kINFO see AliQACheckerBase::Run 
+    //checking raw data
+    if(index == AliQAv1::kRAW) {       check[specie] = CheckRaw(specie,list[specie]);       }
+                               
+    
   } // species loop
-
-  return check;
 }
 //_________________________________________________________________
 Double_t AliHMPIDQAChecker::CheckEntries(TObjArray * list) const
@@ -147,7 +141,6 @@ Double_t AliHMPIDQAChecker::CheckEntries(TObjArray * list) const
     while ( (hdata = dynamic_cast<TH1 *>(next())) ) {
       if (hdata) { 
        Double_t rv = 0.;
-        //Printf("hitogram %s     has entries: %f ",hdata->GetName(),hdata->GetEntries());
        if(hdata->GetEntries()>0)rv=1; 
        count++ ; 
        test += rv ; 
@@ -247,4 +240,488 @@ Double_t AliHMPIDQAChecker::CheckRec(TObjArray *listrec, TObjArray *listref) con
  else checkresponse = 0.001;                  // > 50% of the check histograms show a failing check -> Corresponds to kERROR see AliQACheckerBase::Run
  return checkresponse;
 }
+//___________________________________________________________________________________________________
+Double_t AliHMPIDQAChecker::CheckRaw(Int_t specie, TObjArray* list)
+{
+  //
+  // Check the raw data for offline / online using default or updated thresholds from AMORE
+  // 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
+  // in AMORE. But we can pu undividual labels.
+  //
+  
+  Int_t raqQualFlag = AliQAv1::kNULLBit;
+  
+  Int_t hmpQaFlags[4]={-1}; //init for the 4 shifter histos
+  
+  TString histname ="null";
+  TPaveText text(0.65,0.8,0.9,0.99,"NDC"); 
+  TPaveText text1(0.65,0.8,0.9,0.99,"NDC"); 
+   
+  Int_t entries = list->GetEntriesFast();
+  
+  if ( entries == 0 ) {
+     AliWarning(Form("HMPID QA Checker RAWS: no object to analyse! Exiting..."));
+     return AliQAv1::kFATAL;
+  }
+  
+  TLine* lineDdlDataSizeMin = new TLine(1536,fHmpQaThr_DataSizeUpperThreshold,1548,fHmpQaThr_DataSizeUpperThreshold);
+  TLine* lineDdlDataSizeMax = new TLine(1536,fHmpQaThr_DataSizeLowerThreshold,1548,fHmpQaThr_DataSizeLowerThreshold);
+  
+  TLine* linePadOccupMin = new TLine(1536,fHmpQaThr_PadOccupancyUpperThreshold,1548,fHmpQaThr_PadOccupancyUpperThreshold);
+  TLine* linePadOccupMax = new TLine(1536,fHmpQaThr_PadOccupancyLowerThreshold,1548,fHmpQaThr_PadOccupancyLowerThreshold);
+  
+  
+  Int_t badDdlCnt = 0, badOccCnt = 0;
+  
+  //___ check data size per ddl
+  if( list->FindObject(Form("%s_hHmpDdlDataSize",AliRecoParam::GetEventSpecieName(specie)) )) 
+    {
+      TH1* h1 = dynamic_cast<TH1*>( list->FindObject(Form("%s_hHmpDdlDataSize",AliRecoParam::GetEventSpecieName(specie)))); 
+      if(h1) {
+      if( h1->Integral() > 1 ) {
+      // no entres -> fatal
+      if( h1->GetEntries() == 0) {raqQualFlag = AliQAv1::kFATAL;}
+      h1->SetStats(0);
+      
+      
+      // clean up the text, stat, lines, ...
+      if( h1->GetListOfFunctions() ) h1->GetListOfFunctions()->Clear();
+      
+      for ( Int_t iddl = 1 ; iddl <= 14; iddl++)
+       {
+         if( h1->GetBinContent(iddl) < fHmpQaThr_DataSizeLowerThreshold || h1->GetBinContent(iddl) > fHmpQaThr_DataSizeUpperThreshold ) badDdlCnt++; 
+       }
+      //___ check if one or more DDLs are excluded
+        
+      
+      badDdlCnt -= fHmpQaThr_NumberOfExcludedDDL;
+      
+      
+      
+      //___ check how many are bad
+      if ( badDdlCnt == 0 )  
+       {         
+         hmpQaFlags[0] = AliQAv1::kINFO;
+         text1.Clear();
+         text1.AddText(Form("OK (%d)",fIsOnlineThr));
+         text1.SetFillColor(kGreen);
+         h1->GetListOfFunctions()->Add((TPaveText*)text1.Clone());      
+         lineDdlDataSizeMin->SetLineColor(kGreen);
+         lineDdlDataSizeMax->SetLineColor(kGreen);
+         h1->GetListOfFunctions()->Add((TLine*)lineDdlDataSizeMin->Clone());
+         h1->GetListOfFunctions()->Add((TLine*)lineDdlDataSizeMax->Clone());
+       }
+      else if ( badDdlCnt == 1 )  
+       {         
+         hmpQaFlags[0]  = AliQAv1::kWARNING;
+         text1.Clear();
+         text1.AddText(Form("WARNING CHECK TWIKI (%d)",fIsOnlineThr));
+         text1.SetFillColor(kOrange);
+         h1->GetListOfFunctions()->Add((TPaveText*)text1.Clone());     
+         lineDdlDataSizeMin->SetLineColor(kOrange);
+         lineDdlDataSizeMax->SetLineColor(kOrange);
+         h1->GetListOfFunctions()->Add((TLine*)lineDdlDataSizeMin->Clone());
+         h1->GetListOfFunctions()->Add((TLine*)lineDdlDataSizeMax->Clone());   
+       }
+      else if (  badDdlCnt >= 2 )  
+       {
+         hmpQaFlags[0]  = AliQAv1::kERROR;         
+         text1.Clear();
+         text1.AddText(Form("ERROR CALL ONCALL (%d)",fIsOnlineThr));
+         text1.SetFillColor(kRed);
+         h1->GetListOfFunctions()->Add((TPaveText*)text1.Clone());           
+         lineDdlDataSizeMin->SetLineColor(kRed);
+         lineDdlDataSizeMax->SetLineColor(kRed);
+         h1->GetListOfFunctions()->Add((TLine*)lineDdlDataSizeMin->Clone());
+         h1->GetListOfFunctions()->Add((TLine*)lineDdlDataSizeMax->Clone());   
+       }
+      else 
+       {
+         hmpQaFlags[0]  = AliQAv1::kFATAL;
+         text1.Clear();
+         text1.AddText(Form("FATAL CALL ONCALL (%d)",fIsOnlineThr));
+         text1.SetFillColor(kRed);
+         h1->GetListOfFunctions()->Add((TPaveText*)text1.Clone());           
+         lineDdlDataSizeMin->SetLineColor(kRed);
+         lineDdlDataSizeMax->SetLineColor(kRed);
+         h1->GetListOfFunctions()->Add((TLine*)lineDdlDataSizeMin->Clone());
+         h1->GetListOfFunctions()->Add((TLine*)lineDdlDataSizeMax->Clone());   
+       }
+      }
+      }//the histo is filled
+    }//___hHmpDdlDataSize
+  
+  
+  
+  if( list->FindObject(Form("%s_fHmpPadOcc",AliRecoParam::GetEventSpecieName(specie)) )) 
+    {
+     
+      
+      TH1* h1 = dynamic_cast<TH1*>( list->FindObject(Form("%s_fHmpPadOcc",AliRecoParam::GetEventSpecieName(specie)))); 
+       if(h1) {
+       if( h1->Integral() > 1 ) {
+      // no entres -> fatal
+      if( h1->GetEntries() == 0) {raqQualFlag = AliQAv1::kFATAL;}
+       h1->SetStats(0);
+      // clean up the text, stat, lines, ...
+      if( h1->GetListOfFunctions() ) h1->GetListOfFunctions()->Clear();
+      
+      for ( Int_t iddl = 1 ; iddl <= 14; iddl++)
+       {
+         if( h1->GetBinContent(iddl) < fHmpQaThr_PadOccupancyLowerThreshold || h1->GetBinContent(iddl) > fHmpQaThr_PadOccupancyUpperThreshold ) badOccCnt++; 
+       }
+       
+      badOccCnt -= fHmpQaThr_NumberOfExcludedDDL;
+         
+      //___ check how many are bad
+      if ( badOccCnt == 0 )  
+       {
+         hmpQaFlags[1]  = AliQAv1::kINFO;
+         text.Clear();
+         text.AddText(Form("OK (%d)",fIsOnlineThr));
+         text.SetFillColor(kGreen);
+         h1->GetListOfFunctions()->Add((TPaveText*)text.Clone());      
+         linePadOccupMin->SetLineColor(kGreen);
+         linePadOccupMax->SetLineColor(kGreen);
+         h1->GetListOfFunctions()->Add((TLine*)linePadOccupMin->Clone());
+         h1->GetListOfFunctions()->Add((TLine*)linePadOccupMax->Clone());         
+       }
+      else if ( badOccCnt == 1 )  
+       {
+         hmpQaFlags[1]  = AliQAv1::kWARNING;
+         text.Clear();
+         text.AddText(Form("WARNING CHECK TWIKI (%d)",fIsOnlineThr));
+         text.SetFillColor(kOrange);
+         h1->GetListOfFunctions()->Add((TPaveText*)text.Clone());      
+         linePadOccupMin->SetLineColor(kGreen);
+         linePadOccupMax->SetLineColor(kGreen);
+         h1->GetListOfFunctions()->Add((TLine*)linePadOccupMin->Clone());
+         h1->GetListOfFunctions()->Add((TLine*)linePadOccupMax->Clone());
+       }
+      else if (  badOccCnt == 2 )  
+       {
+         hmpQaFlags[1]  = AliQAv1::kERROR;
+         text.Clear();
+         text.AddText(Form("ERROR CALL ONCALL (%d)",fIsOnlineThr));
+         text.SetFillColor(kRed);
+         h1->GetListOfFunctions()->Add((TPaveText*)text.Clone());            
+         linePadOccupMin->SetLineColor(kGreen);
+         linePadOccupMax->SetLineColor(kGreen);
+         h1->GetListOfFunctions()->Add((TLine*)linePadOccupMin->Clone());
+         h1->GetListOfFunctions()->Add((TLine*)linePadOccupMax->Clone());
+       }
+      else 
+       {
+         hmpQaFlags[1] = AliQAv1::kFATAL;
+         text.Clear();
+         text.AddText(Form("FATAL CALL ONCALL (%d)",fIsOnlineThr));
+         text.SetFillColor(kRed);
+         h1->GetListOfFunctions()->Add((TPaveText*)text.Clone());            
+         linePadOccupMin->SetLineColor(kGreen);
+         linePadOccupMax->SetLineColor(kGreen);
+         h1->GetListOfFunctions()->Add((TLine*)linePadOccupMin->Clone());
+         h1->GetListOfFunctions()->Add((TLine*)linePadOccupMax->Clone());   
+       }
+      }
+    }
+    }//___HmpPadOcc
+  
+  Int_t sumPadMapChROR[7]={0};
+  Int_t sumPadMapChROL[7]={0};
+  Int_t bigMapFlag =  AliQAv1::kINFO;
+  Int_t errCntBigMap = 0;
+
+  if( list->FindObject(Form("%s_hHmpBigMap",AliRecoParam::GetEventSpecieName(specie)) )) 
+    {
+      TH2* h2 = dynamic_cast<TH2*>( list->FindObject(Form("%s_hHmpBigMap",AliRecoParam::GetEventSpecieName(specie)))); 
+      if(h2) {
+        if( h2->Integral() > 1 ) {
+      // no entres -> fatal
+      if( h2->GetEntries() == 0) {raqQualFlag = AliQAv1::kFATAL;}
+       h2->SetStats(0);
+      // clean up the text, stat, lines, ...
+      if( h2->GetListOfFunctions() ) h2->GetListOfFunctions()->Clear();
+
+      //calculate missing pad fraction
+      for(Int_t ich = 0; ich < 7; ich++)
+       {
+         for(Int_t iy=1+ich*144;iy<=144+ich*144;iy++) {
+           for(Int_t ix=1;ix<=80;ix++)    if(h2->GetBinContent(ix,iy) > 0) sumPadMapChROL[ich]++;
+           for(Int_t ix=81;ix<=160;ix++)  if(h2->GetBinContent(ix,iy) > 0) sumPadMapChROR[ich]++;        
+         }
+       }//ch loop
+       //check the calculated missing pad fraction
+      for(Int_t ich = 0; ich < 7; ich++)
+       {
+          
+          bigMapFlag =  AliQAv1::kINFO; 
+         if( (1-sumPadMapChROL[ich]/1.0/11520) > fHmpQaThr_MissingPadFractionWarningThreshold ||
+             (1-sumPadMapChROR[ich]/1.0/11520) > fHmpQaThr_MissingPadFractionWarningThreshold ) 
+          {
+            bigMapFlag =  AliQAv1::kWARNING;
+            }
+         if( (1-sumPadMapChROL[ich]/1.0/11520) > fHmpQaThr_MissingPadFractionErrorThreshold ||
+             (1-sumPadMapChROR[ich]/1.0/11520) > fHmpQaThr_MissingPadFractionErrorThreshold ) {
+             bigMapFlag =  AliQAv1::kERROR; 
+             errCntBigMap++;
+           }     
+          
+       }//ch loop
+      if( errCntBigMap > 0 ) bigMapFlag =  AliQAv1::kERROR;
+
+      //update labels
+       if (  bigMapFlag == AliQAv1::kINFO )  
+       {
+         hmpQaFlags[2]  = AliQAv1::kINFO;
+         text.Clear();
+         text.AddText(Form("OK (%d)",fIsOnlineThr));
+         text.SetFillColor(kGreen);
+         h2->GetListOfFunctions()->Add((TPaveText*)text.Clone());      
+       }
+       else if (  bigMapFlag == AliQAv1::kWARNING )  
+       {
+         hmpQaFlags[2]  = AliQAv1::kWARNING;
+         text.Clear();
+         text.AddText(Form("WARNING CHECK TWIKI (%d)",fIsOnlineThr));
+         text.SetFillColor(kOrange);
+         h2->GetListOfFunctions()->Add((TPaveText*)text.Clone());      
+       }
+       else if (  bigMapFlag == AliQAv1::kERROR )  
+       {
+         hmpQaFlags[2]  = AliQAv1::kERROR;
+         text.Clear();
+         text.AddText(Form("ERROR CALL ONCALL (%d)",fIsOnlineThr));
+         text.SetFillColor(kRed);
+         h2->GetListOfFunctions()->Add((TPaveText*)text.Clone());      
+       }
+       else
+        {
+          hmpQaFlags[2]  = AliQAv1::kFATAL;
+          text.Clear();
+          text.AddText(Form("FATAL CALL ONCALL (%d)",fIsOnlineThr));
+          text.SetFillColor(kRed);
+          h2->GetListOfFunctions()->Add((TPaveText*)text.Clone());     
+        }      
+        }       
+     }
+    }//___HmpBigMap
+  
+
+  Int_t numSectorsMissing = 0, numSectorsGainLoss = 0;
+  Double_t  hSumQPerSector[42]={0};
+
+  if( list->FindObject(Form("%s_fHmpHvSectorQ",AliRecoParam::GetEventSpecieName(specie))))
+    {
+      
+      TH2* h2 = dynamic_cast<TH2*>( list->FindObject(Form("%s_fHmpHvSectorQ",AliRecoParam::GetEventSpecieName(specie)))); 
+      if(h2) {
+        if(h2->Integral() > 0 ) {
+      // no entres -> fatal
+      if( h2->GetEntries() == 0) {raqQualFlag = AliQAv1::kFATAL;}
+             h2->SetStats(0);
+      // clean up the text, stat, lines, ...
+      if( h2->GetListOfFunctions() ) h2->GetListOfFunctions()->Clear();
+     
+      //___ check sectors 
+      for(Int_t isec = 1 ; isec <= 42; isec++)
+       {
+         for(Int_t ibiny=100;ibiny<410;ibiny++) {hSumQPerSector[isec-1] += h2->GetBinContent(ibiny,isec); }
+         if(hSumQPerSector[isec-1]  < 0.001) {numSectorsGainLoss++;}  // there is no photon and mip peak, gain loss
+         if(h2->GetBinContent(1,isec) < 0.01 ) {numSectorsMissing++; } //practically there is no charge , the sector is missing
+       }
+      Int_t  sectorErrors = numSectorsGainLoss+numSectorsMissing;
+     
+      
+       if ( sectorErrors <=  3)
+         {
+           hmpQaFlags[3]  = AliQAv1::kINFO;
+           text.Clear();
+           text.AddText(Form("OK (%d)",fIsOnlineThr));
+           text.SetFillColor(kGreen);
+           h2->GetListOfFunctions()->Add((TPaveText*)text.Clone());       
+         }
+       else if ( sectorErrors > fHmpQaThr_SectorGainLossWarningThreshold)
+         {
+           hmpQaFlags[3]  = AliQAv1::kWARNING;
+           text.Clear();
+           text.AddText(Form("WARNING CHECK TWIKI (%d)",fIsOnlineThr));
+            if(numSectorsMissing > 0 ) text.AddText(Form("MISSING SECTOR?"));              
+           text.SetFillColor(kOrange);
+           h2->GetListOfFunctions()->Add((TPaveText*)text.Clone());
+         }
+       else if ( sectorErrors > fHmpQaThr_SectorGainLossErrorThreshold)
+         {
+           hmpQaFlags[3]  = AliQAv1::kERROR;
+           text.Clear();
+           text.AddText(Form("ERROR CALL ONCALL (%d)",fIsOnlineThr));
+            if(numSectorsMissing > 0 ) text.AddText(Form("MISSING SECTOR?"));
+           text.SetFillColor(kRed);
+           h2->GetListOfFunctions()->Add((TPaveText*)text.Clone());    
+         }
+       else
+         {
+           hmpQaFlags[3]  = AliQAv1::kFATAL;
+           text.Clear();
+           text.AddText(Form("FATAL CALL ONCALL (%d)",fIsOnlineThr));
+           text.SetFillColor(kRed);
+           h2->GetListOfFunctions()->Add((TPaveText*)text.Clone());    
+         }
+        }
+    }
+  }
+  
+  
+  //del lines, ...
+  lineDdlDataSizeMin->Delete();
+  lineDdlDataSizeMax->Delete();
+  linePadOccupMin->Delete();
+  linePadOccupMax->Delete();
+  
+  Double_t dflag = -1;
+  switch ( TMath::MaxElement(4,hmpQaFlags))
+    {
+    case  AliQAv1::kINFO:
+      dflag = 1.0;
+      
+      break;
+    case AliQAv1::kWARNING:
+      dflag = 0.75;
+      
+      break;
+    case AliQAv1::kERROR:
+      dflag = 0.25;
+      
+      break;
+    case AliQAv1::kFATAL:
+      dflag = -1.0;
+     
+      break;
+    default:
+      dflag = AliQAv1::kNULLBit;
+     
+      break;
+    }    
+     
+  return dflag;
+  
+  
+  
+}
+//___________________________________________________________________________________________________
+void AliHMPIDQAChecker::InitOnlineThresholds()
+{
+  //
+  // Init the online thresholds from GRP generated by AMORE
+  //
+  
+  AliCDBManager* man = AliCDBManager::Instance(); 
+  if(!man)  {     fIsOnlineThr = kFALSE;     return;   }
+  
+
+  if(!man->Get("GRP/Calib/QAThresholds"))  {     fIsOnlineThr = kFALSE;    return;    }
+  AliCDBEntry* entry = man->Get("GRP/Calib/QAThresholds");
+  if(!entry)    {     fIsOnlineThr = kFALSE;    return;    }
+  
+  TObjArray* branch = (TObjArray*) entry->GetObject();
+  if(!branch ) {     fIsOnlineThr = kFALSE;     return;    }
+
+  AliQAThresholds* thresholds = (AliQAThresholds*) branch->FindObject("HMP");  
+  if(!thresholds) { fIsOnlineThr = kFALSE; return;   }
+  else 
+     fIsOnlineThr = kTRUE; 
+  
+  
+  Int_t teCnt = 0;
+  TString parName = "zero";
+  while ( thresholds->GetThreshold(teCnt)) 
+  {
+     if(!((thresholds->GetThreshold(teCnt))->GetName())) return;
+         
+     parName = (thresholds->GetThreshold(teCnt))->GetName();
+     
+     if( parName.Contains("HmpNumberOfExcludedDDLthreshold") )
+     {
+       TParameter<int>* myParam = (TParameter<int>*) thresholds->GetThreshold(teCnt); 
+       fHmpQaThr_NumberOfExcludedDDL = myParam->GetVal();
+     }
+   
+     
+     if( parName.Contains("HmpDataSizeLowerThreshold") ) 
+     {
+       TParameter<int>* myParam = (TParameter<int>*) thresholds->GetThreshold(teCnt); 
+       fHmpQaThr_DataSizeLowerThreshold = myParam->GetVal();
+     }
+             
+     if( parName.Contains("HmpDataSizeUpperThreshold") ) 
+     {
+       TParameter<int>* myParam = (TParameter<int>*) thresholds->GetThreshold(teCnt); 
+       fHmpQaThr_DataSizeUpperThreshold = myParam->GetVal();
+     }
+          
+     if( parName.Contains("HmpPadOccupancyLowerThreshold") ) 
+     {
+       TParameter<float>* myParam = (TParameter<float>*) thresholds->GetThreshold(teCnt); 
+       fHmpQaThr_PadOccupancyLowerThreshold = myParam->GetVal();
+     }
+           
+     if( parName.Contains("HmpPadOccupancyUpperThreshold") ) 
+     {
+       TParameter<float>* myParam = (TParameter<float>*) thresholds->GetThreshold(teCnt); 
+       fHmpQaThr_PadOccupancyUpperThreshold = myParam->GetVal();
+     }
+                    
+     if( parName.Contains("HmpSectorGainLossWarningThreshold") ) 
+      {
+       TParameter<int>* myParam = (TParameter<int>*) thresholds->GetThreshold(teCnt); 
+       fHmpQaThr_SectorGainLossWarningThreshold = myParam->GetVal();
+     } 
+       
+     if( parName.Contains("HmpSectorGainLossErrorThreshold") ) 
+       {
+       TParameter<int>* myParam = (TParameter<int>*) thresholds->GetThreshold(teCnt); 
+       fHmpQaThr_SectorGainLossErrorThreshold = myParam->GetVal();
+     } 
+       
+     if( parName.Contains("HmpMissingPadFractionWarningThreshold") ) 
+       {
+       TParameter<float>* myParam = (TParameter<float>*) thresholds->GetThreshold(teCnt); 
+       fHmpQaThr_MissingPadFractionWarningThreshold = myParam->GetVal();
+     }
+     
+     if( parName.Contains("HmpMissingPadFractionErrorThreshold") ) 
+         {
+       TParameter<float>* myParam = (TParameter<float>*) thresholds->GetThreshold(teCnt); 
+       fHmpQaThr_MissingPadFractionErrorThreshold = myParam->GetVal();
+     }
+      
+     teCnt++;    
+  }//while
+  
+  
+  // PrintThresholds();
+}
+//___________________________________________________________________________________________________
+void AliHMPIDQAChecker::PrintThresholds()
+{
+  Printf("--- Printing thresholds ---");  
+  Printf("--- Default or online: %i ---",fIsOnlineThr);  
+  Printf("--- fHmpQaThr_NumberOfExcludedDDL: %i ---",fHmpQaThr_NumberOfExcludedDDL);
+  Printf("--- fHmpQaThr_DataSizeLowerThreshold: %i ---",fHmpQaThr_DataSizeLowerThreshold);
+  Printf("--- fHmpQaThr_DataSizeUpperThreshold: %i ---",fHmpQaThr_DataSizeUpperThreshold);
+  Printf("--- fHmpQaThr_PadOccupancyLowerThreshold: %f ---",fHmpQaThr_PadOccupancyLowerThreshold);
+  Printf("--- fHmpQaThr_PadOccupancyUpperThreshold: %f ---",fHmpQaThr_PadOccupancyUpperThreshold);
+  Printf("--- fHmpQaThr_SectorGainLossWarningThreshold: %i ---",fHmpQaThr_SectorGainLossWarningThreshold);
+  Printf("--- fHmpQaThr_SectorGainLossErrorThreshold: %i ---",fHmpQaThr_SectorGainLossErrorThreshold);
+  Printf("--- fHmpQaThr_MissingPadFractionWarningThreshold: %f ---",fHmpQaThr_MissingPadFractionWarningThreshold);
+  Printf("--- fHmpQaThr_MissingPadFractionErrorThreshold: %f ---",fHmpQaThr_MissingPadFractionErrorThreshold);
+  Printf("--- Printing thresholds done ---");  
+
+  
+  
+  
+}
+//___________________________________________________________________________________________________
+