]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSQAChecker.cxx
PWGPP-69 - initialize additional dEdx information diring tracking itteration 0 -...
[u/mrichter/AliRoot.git] / PHOS / AliPHOSQAChecker.cxx
index 7e8ee442075b805836ddc886be5a18d7cf13d75b..2380b2e8120534815a2dfc0b722b59f0152e84b1 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
+
 /* $Id$ */
 
-//_________________________________________________________________________
-// Base class for a QA checker, to be instanciated as a container of user 
-// defined tasks
-//*-- Author :  Yves Schutz (SUBATECH) 
-//////////////////////////////////////////////////////////////////////////////
+/*
+  Checks the quality assurance. 
+  By comparing with reference data
+  Y. Schutz CERN July 2007
+*/
 
 // --- ROOT system ---
-#include "TROOT.h"
+#include <TClass.h>
+#include <TH1F.h> 
+#include <TH1I.h> 
+#include <TIterator.h> 
+#include <TKey.h> 
+#include <TFile.h> 
 
 // --- Standard library ---
 
 // --- AliRoot header files ---
-
+#include "AliLog.h"
+#include "AliQAv1.h"
+#include "AliQAChecker.h"
 #include "AliPHOSQAChecker.h"
-#include "AliPHOSQAVirtualCheckable.h"
 
 ClassImp(AliPHOSQAChecker)
 
+//__________________________________________________________________
 
-//____________________________________________________________________________ 
-  AliPHOSQAChecker::AliPHOSQAChecker(const char * name, const char * title) : TTask(name,title) 
-{
-  // ctor
-  // stores checkers in the PHOS QA TTask folder //Folders/Task/QA
-  TTask * aliceQA  = (TTask*)gROOT->FindObjectAny("Folders/Tasks/QA") ; 
-  TTask * phosQA   = (TTask*)aliceQA->GetListOfTasks()->FindObject("PHOS") ;
-  if (phosQA)  // PHOS QA Tasks container exists
-   phosQA->Add(this) ;
-   else    // create  //Folders/Task/QA/PHOS
-     aliceQA->Add(this) ; 
-  
-  fCheckablesList = new TList() ;
-  fCheckable = 0;
-}
-
-//____________________________________________________________________________ 
-  AliPHOSQAChecker::~AliPHOSQAChecker()
+AliPHOSQAChecker & AliPHOSQAChecker::operator = (const AliPHOSQAChecker &)
 {
-  // dtor remove the checker from the task list of the associated checker
-  
-  TIter next(fCheckablesList) ; 
-  AliPHOSQAVirtualCheckable * checkable ; 
-  while ( (checkable = (AliPHOSQAVirtualCheckable*)next()) ) 
-    checkable->RemoveChecker(this) ; 
-  ExecuteTasks("D") ; 
-}
-
-//____________________________________________________________________________ 
-  void AliPHOSQAChecker::CheckIt(AliPHOSQAVirtualCheckable *ca) 
-{
-  // does the check for the given checkable 
-  
-  SetCheckable(ca) ;
-  TList * l = GetListOfTasks() ; 
-  TIter next(l) ; 
-  AliPHOSQAChecker * checker ; 
-  while ( (checker = (AliPHOSQAChecker*)next()) ) 
-    checker->SetCheckable(ca) ; 
-  ExecuteTask("") ;   
-  fCheckable = 0 ; 
-}
-
-//____________________________________________________________________________ 
-  void AliPHOSQAChecker::CheckIt()
-{
-  // does the check for all attached chekables 
-  if ( fCheckablesList->IsEmpty() ) 
-    ExecuteTask("C") ; 
-  else {
-    TIter next( fCheckablesList ) ;
-    AliPHOSQAVirtualCheckable * checkable ; 
-    while ( (checkable = (AliPHOSQAVirtualCheckable*)next() ) ) {
-      fCheckable = checkable ; 
-      ExecuteTask("") ;
-    }
-  }
+  Fatal("operator =", "not implemented");
+  return *this;
 }
 
-//____________________________________________________________________________ 
-  void AliPHOSQAChecker::Exec(Option_t *option)
+//____________________________________________________________________________
+void AliPHOSQAChecker::Check(Double_t * test, AliQAv1::ALITASK_t task, TObjArray ** list, const AliDetectorRecoParam * /* recoParam */) 
 {
-  // Performs various tasks as indicated by option
-  // P --> Print 
-  // S --> Status
-  // C --> does the comparison on all the checkables declared 
-  //   --> does the comparison on only one checkable (the one which asks CheckMe() )
-  // A --> list the alarms raised in  the associated checkables 
-  // R --> reset the alarms
-  // D --> calls the dtor
-
-  if ( !(strcmp(option,"P")) ) 
-    Print() ;
-
-  else if ( !(strcmp(option,"S")) ) 
-    Status() ;
-
-  else if ( !(strcmp(option,"C")) ) {  
-    TIter next( fCheckablesList ) ;
-    AliPHOSQAVirtualCheckable * checkable ; 
-    while ( (checkable = (AliPHOSQAVirtualCheckable*)next() ) ) {
-      fCheckable = checkable ;
-      TString message = CheckingOperation(); 
-      if ( !message.IsNull() ) { 
-       TDatime dt ;
-       TString time(dt.AsSQLString()) ;
-       message = time + message ; 
-       fCheckable->RaiseAlarm(dt.AsSQLString(), fCheckable->GetName(), GetName(), message.Data()) ; 
-      }        
-    }
-  }
+  // Performs a basic checking
+  // Compares all the histograms in the list
+
+  for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
+    test[specie] = 1.0;
+    if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) ) 
+      continue ; 
+    // checking for empty histograms
+    // if (CheckEntries(list[specie]) == 0)  {
+    //   AliWarning("histograms are empty");
+    //   test[specie] = 0.4;//-> Corresponds to kWARNING see AliQACheckerBase::Run
+    // }
   
-  else if ( !(strcmp(option,"R")) ) {  
-    TIter next( fCheckablesList ) ;
-    AliPHOSQAVirtualCheckable * checkable ; 
-    while ( (checkable = (AliPHOSQAVirtualCheckable*)next() ) ) {
-      fCheckable = checkable ; 
-      fCheckable->ResetAlarms() ; 
-    }  
-  }
-  
-  else if ( !(strcmp(option,"")) ) {
-    TString message = CheckingOperation(); 
-    if ( !message.IsNull() ) { 
-      TDatime dt ;
-      TString time(dt.AsSQLString()) ;
-      message = time + message ; 
-      fCheckable->RaiseAlarm(dt.AsSQLString(), fCheckable->GetName(), GetName(), message.Data()) ; 
+    // checking raw data
+    if(task == AliQAv1::kRAW){
+      if(AliRecoParam::ConvertIndex(specie) == AliRecoParam::kCalib    ||
+         AliRecoParam::ConvertIndex(specie) == AliRecoParam::kHighMult ||
+         AliRecoParam::ConvertIndex(specie) == AliRecoParam::kLowMult  ||
+        AliRecoParam::ConvertIndex(specie) == AliRecoParam::kDefault) {
+       // list[specie]->Print();
+       TH1F *hHighNtot = (TH1F*)list[specie]->At(13);
+       if (hHighNtot!=0) {
+         if (hHighNtot->GetMean() < 1000) test[specie]=1;
+       }
+       else test[specie]=0.1;
+      }
     }
-  }    
-    
-  else if ( !(strcmp(option,"A")) )
-    PrintAlarms() ; 
-  else if ( !(strcmp(option,"D")) )
-    Delete() ;
-}
-
-//____________________________________________________________________________ 
-  void AliPHOSQAChecker::Print()
-{
-  // print the checker and sub-checkers, if any, name.  
 
-  Info("Print", "Checker : %s", GetName()) ;  
-
-}
-
-//____________________________________________________________________________ 
-  void AliPHOSQAChecker::PrintAlarms()
-{
-  // Prints the alarms of all attached checkables
-  Info("PrintAlarms", "Checker name : %s", GetName()) ; 
-  if ( !(fCheckablesList->IsEmpty() ) ) {
-    TIter next( fCheckablesList ) ; 
-    AliPHOSQAVirtualCheckable * checkable ; 
-    while ( (checkable = (AliPHOSQAVirtualCheckable *)next() ) ) 
-      checkable->Alarms() ; 
-  }
-}
-
-//____________________________________________________________________________ 
-  void AliPHOSQAChecker::Status() 
-{
-  // Prints the checkables attached to this checker
-  if ( fCheckablesList->IsEmpty() ) 
-    Info("Status", "No checkables are checked by %s", GetName()) ; 
-  else {
-    Info("Status", "The following checkables are checked by %s", GetName()) ; 
-    TIter next(fCheckablesList) ; 
-    AliPHOSQAVirtualCheckable * checkable ; 
-    while ( (checkable = (AliPHOSQAVirtualCheckable*)next() ) ) 
-      checkable->Print() ; 
-  }
+    //default check response. It will be changed when reasonable checks will be considered
+    else test[specie] = 0.7 ; // /-> Corresponds to kINFO see AliQACheckerBase::Run 
+  } // species loop
 }