]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliQACheckerBase.cxx
OADB classes and root files for the physics selection
[u/mrichter/AliRoot.git] / STEER / AliQACheckerBase.cxx
index 5c35416aa671b1dd85da26850116c7a174a02b3b..6786975543db6a9ecb167223e0c897e827d61b10 100644 (file)
@@ -32,6 +32,7 @@
 #include <TFile.h> 
 #include <TList.h>
 #include <TNtupleD.h>
+#include <TParameter.h>
 #include <TPaveText.h>
 
 // --- Standard library ---
@@ -55,14 +56,13 @@ AliQACheckerBase::AliQACheckerBase(const char * name, const char * title) :
   fDataSubDir(0x0),
   fRefSubDir(0x0), 
   fRefOCDBSubDir(new TObjArray*[AliRecoParam::kNSpecies]), 
-  fLowTestValue(0x0),
-  fUpTestValue(0x0),
+  fLowTestValue(new Float_t[AliQAv1::kNBIT]),
+  fUpTestValue(new Float_t[AliQAv1::kNBIT]),
   fImage(new TCanvas*[AliRecoParam::kNSpecies]), 
-  fPrintImage(kTRUE)
+  fPrintImage(kTRUE), 
+  fExternParamList(new TList())
 {
   // ctor
-  fLowTestValue = new Float_t[AliQAv1::kNBIT] ; 
-  fUpTestValue  = new Float_t[AliQAv1::kNBIT] ; 
   fLowTestValue[AliQAv1::kINFO]    =  0.5   ; 
   fUpTestValue[AliQAv1::kINFO]     = 1.0 ; 
   fLowTestValue[AliQAv1::kWARNING] =  0.002 ; 
@@ -94,10 +94,11 @@ AliQACheckerBase::AliQACheckerBase(const AliQACheckerBase& qac) :
   fDataSubDir(qac.fDataSubDir), 
   fRefSubDir(qac.fRefSubDir), 
   fRefOCDBSubDir(qac.fRefOCDBSubDir), 
-  fLowTestValue(qac.fLowTestValue),
-  fUpTestValue(qac.fLowTestValue), 
-  fImage(NULL),  
-  fPrintImage(kTRUE)
+  fLowTestValue(new Float_t[AliQAv1::kNBIT]),
+  fUpTestValue(new Float_t[AliQAv1::kNBIT]), 
+  fImage(new TCanvas*[AliRecoParam::kNSpecies]),  
+  fPrintImage(kTRUE), 
+  fExternParamList(new TList())  
 {
   //copy ctor
   for (Int_t index = 0 ; index < AliQAv1::kNBIT ; index++) {
@@ -108,6 +109,12 @@ AliQACheckerBase::AliQACheckerBase(const AliQACheckerBase& qac) :
       fImage[specie] = qac.fImage[specie] ; 
       fRefOCDBSubDir[specie] = qac.fRefOCDBSubDir[specie] ; 
     }
+  if (qac.fExternParamList) {
+    TIter next(qac.fExternParamList) ; 
+    TParameter<double> * p ; 
+    while ( (p = (TParameter<double>*)next()) )
+      fExternParamList->Add(p) ;
+  }
 }
 
 //____________________________________________________________________________
@@ -133,10 +140,14 @@ AliQACheckerBase::~AliQACheckerBase()
   delete[] fImage ; 
   delete[] fRefOCDBSubDir ; 
   AliQAv1::GetQAResultFile()->Close() ; 
+  if (fExternParamList) {
+    fExternParamList->Clear() ; 
+    delete fExternParamList ; 
+  }
 }
 
 //____________________________________________________________________________
-Double_t * AliQACheckerBase::Check(AliQAv1::ALITASK_t index, AliDetectorRecoParam * recoParam) 
+void AliQACheckerBase::Check(Double_t * test, AliQAv1::ALITASK_t index, const AliDetectorRecoParam * recoParam) 
 {
   // Performs a basic checking
   // Compares all the histograms stored in the directory
@@ -169,24 +180,20 @@ Double_t * AliQACheckerBase::Check(AliQAv1::ALITASK_t index, AliDetectorRecoPara
     }
   }
  
-  Double_t * test = Check(index, list, recoParam) ;
+  Check(test, index, list, recoParam) ;
   
   delete[] list ; 
     
-  return test ;
 }  
 
 //____________________________________________________________________________
-Double_t * AliQACheckerBase::Check(AliQAv1::ALITASK_t task, TObjArray ** list, AliDetectorRecoParam * /*recoParam*/) 
+void AliQACheckerBase::Check(Double_t * test, AliQAv1::ALITASK_t task, TObjArray ** list, const AliDetectorRecoParam * /*recoParam*/) 
 {
   // Performs a basic checking
   // Compares all the histograms in the list
 
-       Double_t * test = new Double_t[AliRecoParam::kNSpecies] ;
        Int_t count[AliRecoParam::kNSpecies]   = { 0 }; 
 
-//  TDirectory * refDir     = NULL ; 
-//     TObjArray ** refOCDBDir = NULL  ;       
   GetRefSubDir(GetName(), AliQAv1::GetTaskName(task), fRefSubDir, fRefOCDBSubDir) ;
  // SetRefandData(refDir, refOCDBDir) ; 
   
@@ -228,7 +235,6 @@ Double_t * AliQACheckerBase::Check(AliQAv1::ALITASK_t task, TObjArray ** list, A
       }
     }
   }
-  return test ;
 }  
 
 
@@ -267,7 +273,7 @@ void AliQACheckerBase::GetRefSubDir(const char * det, const char * task, TDirect
     return ; 
   } else {
     AliQAManager* manQA = AliQAManager::QAManager(AliQAv1::GetTaskIndex(task)) ;
-    dirOCDB = new TObjArray*[AliRecoParam::kNSpecies] ;        
+      //    dirOCDB = new TObjArray*[AliRecoParam::kNSpecies] ;        
     for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
       dirOCDB[specie] = NULL ; 
       if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) ) 
@@ -290,8 +296,7 @@ void AliQACheckerBase::GetRefSubDir(const char * det, const char * task, TDirect
         } 
         if ( listDetQAD ) {
           TIter next(listDetQAD) ;
-          TObjArray * ar ; 
-          while ( (ar = (TObjArray*)next()) ) 
+          while ( (TObjArray*)next() ) 
             dirOCDB[specie] = static_cast<TObjArray *>(listDetQAD->FindObject(Form("%s/%s", task, AliRecoParam::GetEventSpecieName(specie)))) ;             
         }
       }
@@ -299,19 +304,30 @@ void AliQACheckerBase::GetRefSubDir(const char * det, const char * task, TDirect
   }
 }
 
+//____________________________________________________________________________
+void AliQACheckerBase::PrintExternParam() 
+{
+    // Print the list of external parameter list
+  TIter next(fExternParamList) ; 
+  TParameter<double> *pp ; 
+  TString printit("\n") ;
+  while( (pp = (TParameter<double>*)next()) )
+    printit += Form("%s = %f\n", pp->GetName(), pp->GetVal());  
+  AliInfo(Form("%s", printit.Data())) ;
+}
+  
 //____________________________________________________________________________
 void AliQACheckerBase::Run(AliQAv1::ALITASK_t index, AliDetectorRecoParam * recoParam) 
 { 
        AliDebug(AliQAv1::GetQADebugLevel(), Form("Processing %s", AliQAv1::GetAliTaskName(index))) ; 
   
-       Double_t * rv = NULL ;
-  rv = Check(index, recoParam) ;
+       Double_t * rv = new Double_t[AliRecoParam::kNSpecies] ;
+  Check(rv, index, recoParam) ;
        SetQA(index, rv) ;      
        
   AliDebug(AliQAv1::GetQADebugLevel(), Form("Test result of %s", AliQAv1::GetAliTaskName(index))) ;
        
-  if (rv) 
-    delete [] rv ; 
+  delete [] rv ; 
   Finish() ; 
 }
 
@@ -320,14 +336,13 @@ void AliQACheckerBase::Run(AliQAv1::ALITASK_t index, TObjArray ** list, AliDetec
 { 
        AliDebug(AliQAv1::GetQADebugLevel(), Form("Processing %s", AliQAv1::GetAliTaskName(index))) ; 
   
-       Double_t * rv = NULL ;
-  rv = Check(index, list, recoParam) ;
+       Double_t * rv = new Double_t[AliRecoParam::kNSpecies] ;
+  Check(rv, index, list, recoParam) ;
        SetQA(index, rv) ;      
        
   AliDebug(AliQAv1::GetQADebugLevel(), Form("Test result of %s", AliQAv1::GetAliTaskName(index))) ;
        
-  if (rv) 
-    delete [] rv ; 
+  delete [] rv ; 
   Finish() ; 
 }
 
@@ -376,11 +391,11 @@ void AliQACheckerBase::MakeImage( TObjArray ** list, AliQAv1::TASKINDEX_t task,
       TPaveText someText(0.015, 0.015, 0.98, 0.98) ;
       someText.AddText(title) ;
       someText.Draw() ; 
-      fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat())) ; 
+      fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps") ; 
       fImage[esIndex]->Clear() ; 
-      Int_t nx = TMath::Sqrt(nImages) ; 
+      Int_t nx = TMath::Nint(TMath::Sqrt(nImages));
       Int_t ny = nx  ; 
-      while ( nx*ny <= nImages) 
+      if (nx < TMath::Sqrt(nImages))
         ny++ ; 
       
       fImage[esIndex]->Divide(nx, ny) ; 
@@ -393,11 +408,20 @@ void AliQACheckerBase::MakeImage( TObjArray ** list, AliQAv1::TASKINDEX_t task,
         if ( ! cln.Contains("TH") )
           continue ; 
         if(hist->TestBit(AliQAv1::GetImageBit())) {
-          hist->Draw() ; 
+          TString opts = hist->GetDrawOption();
+          if (opts.Contains("logy",TString::kIgnoreCase)) {
+            gPad->SetLogy();
+            opts.ReplaceAll("logy", "");
+          }
+          if (opts.Contains("logx", TString::kIgnoreCase)) {
+            gPad->SetLogx();
+            opts.ReplaceAll("logx", "");
+          }
+          hist->DrawCopy() ; 
           fImage[esIndex]->cd(++npad) ; 
         }
       }
-      fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat())) ; 
+      fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps") ; 
     }
   }  
 }