]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HMPID/AliHMPIDQAChecker.cxx
Modifications in CMake* files to export all required headers.
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDQAChecker.cxx
index 4ad7d09e257a90b8845b991d04ae13c3966f9698..be9785375c9b9a7752269bef245599904521c680 100644 (file)
 #include "AliQAManager.h"
 
 ClassImp(AliHMPIDQAChecker)
-
-//____________________________________________________________________________
-Double_t * AliHMPIDQAChecker::Check(AliQAv1::ALITASK_t index)
+ //_________________________________________________________________
+AliHMPIDQAChecker::AliHMPIDQAChecker() : 
+AliQACheckerBase("HMPID","HMPID Quality Assurance Data Checker"), 
+fNoReference(kTRUE),
+fQARefRec(NULL)
 {
-  
- TObjArray **list;
+    //ctor, fetches the reference data from OCDB 
+  char * detOCDBDir = Form("HMPID/%s/%s", AliQAv1::GetRefOCDBDirName(), AliQAv1::GetRefDataDirName()) ; 
+  AliCDBEntry * QARefRec = AliQAManager::QAManager()->Get(detOCDBDir);
+  if(QARefRec) {
+    fQARefRec = dynamic_cast<TObjArray*> (QARefRec->GetObject()) ; 
+    if (fQARefRec)
+      if (fQARefRec->GetEntries()) 
+        fNoReference = kFALSE ;            
+    if (fNoReference) 
+      AliInfo("QA reference data NOT retrieved for Reconstruction check. No HMPIDChecker!");
+  }
+}
 
-  Double_t * rv = new Double_t[AliRecoParam::kNSpecies] ;
- Int_t count[AliRecoParam::kNSpecies]   = { 0 }; 
- for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++){ // species loop 
-    rv[specie] = 1.0 ; 
-   TObjArray *dataList;  Int_t iList=0;  
-  
-   if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) ) 
-   continue ; 
-   if (!fDataSubDir) {
-     rv[specie] = 0. ; // nothing to check
-   } 
-    else if (!fRefSubDir && !fRefOCDBSubDir) {
-        rv[specie] = -1 ; // no reference data
-    } 
-    else {
-      TList * keyList = fDataSubDir->GetListOfKeys() ; 
-      TIter next(keyList) ; 
-      TKey * key ;
-      count[specie] = 0 ; 
-      while ( (key = static_cast<TKey *>(next())) ) {
-        iList++;
-        TObject * odata = fDataSubDir->Get(key->GetName()) ;
-        dataList->AddAt(odata,iList);
-    }// while
-  }// else 
-  list[specie] = dataList;
- } //species loop
- Check(index,list);
- return rv;            
+//_________________________________________________________________
+AliHMPIDQAChecker::~AliHMPIDQAChecker() 
+{
+  if(fQARefRec) { fQARefRec->Delete() ;   delete fQARefRec ; }
 }
 //_________________________________________________________________
-Double_t * AliHMPIDQAChecker::Check(AliQAv1::ALITASK_t index, TObjArray ** list
+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] ; 
-  
-  AliInfo(Form("Fix needed ....."));
-  char * detOCDBDir = Form("HMPID/%s/%s", AliQAv1::GetRefOCDBDirName(), AliQAv1::GetRefDataDirName()) ; 
-  AliCDBEntry *QARefRec = AliQAManager::QAManager()->Get(detOCDBDir);
-  if(!QARefRec){
-    AliInfo("QA reference data NOT retrieved for Reconstruction check. No HMPIDChecker  ...exiting");
-    return check;
-  }
+  if(fNoReference)  
 
   for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
     check[specie] = 1.0;
@@ -108,17 +86,14 @@ Double_t * AliHMPIDQAChecker::Check(AliQAv1::ALITASK_t index, TObjArray ** list)
     }
   
     //check sim
-    if(index == AliQAv1::kSIM) check[specie] = CheckSim(list[specie],(TObjArray *)QARefRec->GetObject());
+    if(index == AliQAv1::kSIM) check[specie] = CheckSim(list[specie], fQARefRec);
 
     // checking rec points
-    if(index == AliQAv1::kREC) check[specie] = CheckRec(list[specie],(TObjArray *)QARefRec->GetObject());
-
+    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 
   } // species loop
-
-  return check;
-
 }
 //_________________________________________________________________
 Double_t AliHMPIDQAChecker::CheckEntries(TObjArray * list) const
@@ -174,17 +149,17 @@ Double_t AliHMPIDQAChecker::CheckSim(TObjArray *listsim, TObjArray *listref) con
    TIter next(listsim) ;
    TH1* histo;
    while ( (histo = dynamic_cast<TH1 *>(next())) ) {
-     //PH The histogram should have at least 3 bins with entries
+     //PH The histogram should have at least 10 bins with at least 5 entries
      Int_t nbinsabove = 0;
-     for (Int_t ibin=histo->FindBin(1); ibin<=histo->FindBin(50); ibin++) { //1,50 is the fit region, see histo->Fit("expo","Q0","",1,50);
-       if (histo->GetBinContent(ibin)>0) nbinsabove++;
+     for (Int_t ibin=histo->FindBin(1); ibin<=histo->FindBin(50); ibin++) { 
+       if (histo->GetBinContent(ibin)>5) nbinsabove++;
      }
 
-   if( nbinsabove < 3 ) counter++;
+   if( nbinsabove < 10 ) counter++;
    else {
     TString h = histo->GetTitle();
     if(h.Contains("Zoom")){
-    histo->Fit("expo","LQ0","",1,50);
+    histo->Fit("expo","LQ0","",5,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++;
@@ -214,17 +189,17 @@ Double_t AliHMPIDQAChecker::CheckRec(TObjArray *listrec, TObjArray *listref) con
    TIter next(listrec) ;
    TH1* histo;
    while ( (histo = dynamic_cast<TH1 *>(next())) ) {
-     //PH The histogram should have at least 3 bins with entries
+     //PH The histogram should have at least 10 bins with at least 5 entries
      Int_t nbinsabove = 0;
-     for (Int_t ibin=histo->FindBin(1); ibin<=histo->FindBin(50); ibin++) { //1,50 is the fit region, see histo->Fit("expo","Q0","",1,50);
-       if (histo->GetBinContent(ibin)>0) nbinsabove++;
+     for (Int_t ibin=histo->FindBin(1); ibin<=histo->FindBin(50); ibin++) { 
+       if (histo->GetBinContent(ibin)>5) nbinsabove++;
      }
 
-   if( nbinsabove < 3 ) counter++;
+   if( nbinsabove < 10 ) counter++;
    else {
     TString h = histo->GetTitle();
     if(h.Contains("Zoom")){
-    histo->Fit("expo","LQ0","",1,50);
+    histo->Fit("expo","LQ0","",5,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++;