]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
QA local OCDB
authordibari <dibari@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 10 Jun 2008 11:24:27 +0000 (11:24 +0000)
committerdibari <dibari@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 10 Jun 2008 11:24:27 +0000 (11:24 +0000)
HMPID/AliHMPIDQAChecker.cxx
HMPID/AliHMPIDQAChecker.h
HMPID/AliHMPIDQADataMakerRec.cxx

index 314eae55b40b8cd9f4b970af8efc89ecad1a7a41..08a141c4311988a61fb7a8ed59ab8f36f8dff35d 100644 (file)
@@ -26,6 +26,7 @@
 #include <TClass.h>
 #include <TH1F.h> 
 #include <TH1I.h> 
+#include <TF1.h> 
 #include <TIterator.h> 
 #include <TKey.h> 
 #include <TFile.h> 
@@ -37,6 +38,8 @@
 #include "AliQA.h"
 #include "AliQAChecker.h"
 #include "AliHMPIDQAChecker.h"
+#include "AliCDBEntry.h"
+#include "AliCDBManager.h"
 
 ClassImp(AliHMPIDQAChecker)
 
@@ -48,4 +51,108 @@ AliHMPIDQAChecker& AliHMPIDQAChecker::operator = (const AliHMPIDQAChecker& qac )
   new(this) AliHMPIDQAChecker(qac);
   return *this;
 }
+//_________________________________________________________________
+const Double_t AliHMPIDQAChecker::Check(AliQA::ALITASK_t index, TObjArray * list) 
+{
+//
+// Main check function: Depending on the TASK, different checks are applied
+// At the moment:       check for empty histograms and checks for RecPoints
+
+  AliDebug(1,Form("AliHMPIDChecker"));
+  AliCDBEntry *QARefRec = AliCDBManager::Instance()->Get("HMPID/QARef/Rec");
+  if( !QARefRec){
+    AliInfo("QA reference data NOT retrieved for Recostruction check. No HMPIDChecker  ...exiting");
+    return 1.;
+  }
+
+// checking for empy histograms
+  Double_t check =0;
+  if(CheckEntries(list) == 0)  {
+  AliWarning("histograms are empty");
+  check = 0.4;//-> Corresponds to kWARNING see AliQACheckerBase::Run
+  return check;
+ }
+
+// checking rec points
+  if(index == AliQA::kREC) check = CheckRecPoints(list,(TObjArray *)QARefRec->GetObject());
+
+//default check response. It will be changed when reasonable checks will be considered
+  else check = 0.7 ; // /-> Corresponds to kINFO see AliQACheckerBase::Run 
+
+  return check;
+
+}
+//_________________________________________________________________
+Double_t AliHMPIDQAChecker::CheckEntries(TObjArray * list) const
+{
+  //
+  //  check on the QA histograms on the input list: 
+  // 
+
+  Double_t test = 0.0  ;
+  Int_t count = 0 ; 
+  
+  if (list->GetEntries() == 0){  
+    test = 1. ; // nothing to check
+  }
+  else {
+    TIter next(list) ; 
+    TH1 * hdata ;
+    count = 0 ; 
+    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 ; 
+      }
+      else{
+       AliError("Data type cannot be processed") ;
+      }
+      
+    }
+    if (count != 0) { 
+      if (test==0) {
+       AliWarning("Histograms are booked for THIS specific Task, but they are all empty: setting flag to kWARNING");
+       test = 0.;  //upper limit value to set kWARNING flag for a task
+      }
+      else test = 1 ;
+    }
+  }
+
+  return test ; 
+}  
+//_________________________________________________________________
+
+Double_t AliHMPIDQAChecker::CheckRecPoints(TObjArray *listrec, TObjArray *listref) const
+{
+
+   Float_t checkresponse = 0;
+
+   Float_t counter = 0 ;
+   TIter next(listrec) ;
+   TH1* histo;
+   while ( (histo = dynamic_cast<TH1 *>(next())) ) {
+   if( histo->GetEntries() == 0 ) counter++;
+   else {
+    TString h = histo->GetTitle();
+    if(h.Contains("Zoom")){
+    histo->Fit("expo","Q0","",1,50);
+    if(histo->GetFunction("expo")->GetParameter(1) !=0 ) if(TMath::Abs((-1./(histo->GetFunction("expo"))->GetParameter(1)) - 35 ) > 5) counter++;
+    }
+    if(h.Contains("size  MIP"))   if(TMath::Abs(histo->GetMean()-5) > 2) counter++;
+    if(h.Contains("size  Phots")) if(TMath::Abs(histo->GetMean()-2) > 2) counter++;
+    if(h.Contains("distribution")) if(histo->KolmogorovTest((TH1F *)listref->At(0))<0.8) counter++;
+    AliDebug(1,Form(" Kolm. test : %f ",histo->KolmogorovTest((TH1F *)listref->At(0))));  
+   }
+  }
+ Float_t response = counter/(7.+7.+42.+42.); // 7.+7.+42 +42 = N checked histograms (-> To be replaced by listrec->GetEntries())
+ if(response < 0.1) checkresponse = 0.7;      // <10% of the check histograms show a failing check -> Corresponds to kINFO see AliQACheckerBase::Run
+ else if(response < 0.5) checkresponse = 0.4; //  50%  of the check histograms show a failing check -> Corresponds to kWARNING see AliQACheckerBase::Run
+ else checkresponse = 0.001;                  // > 50% of the check histograms show a failing check -> Corresponds to kERROR see AliQACheckerBase::Run
+ return checkresponse;
+}
+//________________________________________________________________
 
index f470a3035b2e4826eae402c120cb45265c9a7421..d720a70e2a283dfd38b09f3862a98a7caeb2c13a 100644 (file)
@@ -16,6 +16,7 @@
 // --- ROOT system ---
 class TFile ; 
 class TH1F ; 
+class TObjArray ; 
 
 // --- Standard library ---
 
@@ -30,6 +31,14 @@ public:
   AliHMPIDQAChecker& operator = (const AliHMPIDQAChecker& qac) ;
   virtual ~AliHMPIDQAChecker() {;} // dtor
 
+  virtual const Double_t Check(AliQA::ALITASK_t index, TObjArray * list) ;
+  virtual const Double_t Check(AliQA::ALITASK_t /*index*/) {return 0.;} ;
+  virtual const Double_t Check()                           {return 0.;} ;
+  virtual const Double_t Check(TObjArray*)                 {return 0.;} ; 
+
+  Double_t CheckEntries(TObjArray * list) const ;
+  Double_t CheckRecPoints(TObjArray *listrec, TObjArray *listref) const ;
+
 private:
   
   ClassDef(AliHMPIDQAChecker,1)  // description 
index 642b03f952ddade06798b568bc5f3114ded797c5..a2b26c251f4afd694b98185efd0e49898c03f318 100644 (file)
@@ -268,13 +268,15 @@ void AliHMPIDQADataMakerRec::EndOfDetectorCycle(AliQA::TASKINDEX_t task, TObjArr
 {
   //Detector specific actions at end of cycle
   // do the QA checking
- //  AliQAChecker::Instance()->Run(AliQA::kHMPID, task, obj);
-
+  
   if(task==AliQA::kRAWS) {
     for(Int_t iddl=0;iddl<14;iddl++) {
      TH1F *h = (TH1F*)histos->At(14+iddl); //ddl histos scaled by the number of events 
      h->Scale(1./(Float_t)fEvtRaw);
     }
   }
+  
+   AliQAChecker::Instance()->Run(AliQA::kHMPID, task, histos);
+
 }