]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TOF/AliTOFQAChecker.cxx
Related to the previous commit.
[u/mrichter/AliRoot.git] / TOF / AliTOFQAChecker.cxx
index ae128392f2ea0dfc97fd437e5c6a49c409a767e1..d280e5368db9669edbd26deeacc42d987ccee4e0 100644 (file)
 /////////////////////////////////////////////////////////////////////
 
 #include "TH1.h"
-#include "TList.h"
+#include "TObjArray.h"
 
 #include "AliLog.h"
-//#include "AliQA.h"
+//#include "AliQAv1.h"
 //#include "AliQAChecker.h"
 
 #include "AliTOFQAChecker.h"
 
 ClassImp(AliTOFQAChecker)
 
-//__________________________________________________________________
-AliTOFQAChecker& AliTOFQAChecker::operator = (const AliTOFQAChecker& qac )
-{
-  // Equal operator.
-  this->~AliTOFQAChecker();
-  new(this) AliTOFQAChecker(qac);
-  return *this;
-}
-
 //____________________________________________________________________________
-const Double_t AliTOFQAChecker::Check(TList * list) 
+Double_t * AliTOFQAChecker::Check(AliQAv1::ALITASK_t /*index*/, TObjArray ** list) 
 {
 
   // Super-basic check on the QA histograms on the input list: 
   // look whether they are empty!
 
-  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.;
-       if(hdata->GetEntries()>0)rv=1; 
-       AliInfo(Form("%s -> %f", hdata->GetName(), rv)) ; 
-       count++ ; 
-       test += rv ; 
-      }
-      else{
-       AliError("Data type cannot be processed") ;
-      }
-      
+  Double_t * test  = new Double_t[AliRecoParam::kNSpecies] ; 
+  Int_t count[AliRecoParam::kNSpecies] = { 0 }; 
+
+  for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
+    if (! AliQAv1::Instance(AliQAv1::GetDetIndex(GetName()))->IsEventSpecieSet(AliRecoParam::ConvertIndex(specie)) ) 
+      continue ;
+    test[specie] = 1.0 ; 
+    if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) ) 
+      continue ; 
+    if (list[specie]->GetEntries() == 0){  
+      test[specie] = 0.0 ; // nothing to check
     }
-    if (count != 0) { 
-      if (test==0) {
-       AliWarning("Histograms are there, but they are all empty: setting flag to kWARNING");
-       test = 0.5;  //upper limit value to set kWARNING flag for a task
+    else {
+      TIter next(list[specie]) ; 
+      TH1 * hdata ;
+      count[specie] = 0 ; 
+      while ( (hdata = static_cast<TH1 *>(next())) ) {
+        if (hdata && hdata->InheritsFrom("TH1")) { 
+          Double_t rv = 0.;
+          if(hdata->GetEntries()>0)rv=1; 
+          AliDebug(AliQAv1::GetQADebugLevel(), Form("%s -> %f", hdata->GetName(), rv)) ; 
+          count[specie]++ ; 
+          test[specie] += rv ; 
+        }
+        else{
+          AliError("Data type cannot be processed") ;
+        }
       }
-      else {
-       test /= count ;
+      if (count[specie] != 0) { 
+        if (test[specie]==0) {
+          AliWarning("Histograms are there, but they are all empty: setting flag to kWARNING");
+          test[specie] = 0.5;  //upper limit value to set kWARNING flag for a task
+        }
+        else {
+        test[specie] /= count[specie] ;
+        }
+        AliDebug(AliQAv1::GetQADebugLevel(), Form("Test Result = %f", test[specie])) ; 
       }
     }
   }
-
-  AliInfo(Form("Test Result = %f", test)) ; 
   return test ; 
 }