]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliQAChecker.cxx
move from Bz to BxByBz in track propagation
[u/mrichter/AliRoot.git] / STEER / AliQAChecker.cxx
index 9c7256ab99726ff069cbe87cdba74a07cbfbb4bf..17202c10a12ce8f3be76e67724180a61c25a6dc4 100644 (file)
@@ -27,7 +27,7 @@
 #include "AliRunInfo.h" 
 #include "AliLog.h"
 #include "AliModule.h" 
-#include "AliQA.h"
+#include "AliQAv1.h"
 #include "AliQAChecker.h"
 #include "AliQACheckerBase.h"
 #include "AliCorrQAChecker.h"
@@ -56,10 +56,11 @@ AliQAChecker::AliQAChecker(const char* name, const char* title) :
   fRunInfoOwner(kFALSE), 
   fRefFile(0x0), 
   fFoundDetectors("."), 
-  fEventSpecie(AliRecoParam::kDefault) 
+  fEventSpecie(AliRecoParam::kDefault), 
+  fRun(0)
 {
   // ctor: initialise checkers and open the data file   
-  for (Int_t det = 0 ; det < AliQA::kNDET ; det++) 
+  for (Int_t det = 0 ; det < AliQAv1::kNDET ; det++) 
     fCheckers[det] = NULL ; 
 }
 
@@ -71,11 +72,12 @@ AliQAChecker::AliQAChecker(const AliQAChecker& qac) :
   fRunInfoOwner(kFALSE),   
   fRefFile(qac.fRefFile), 
   fFoundDetectors(qac.fFoundDetectors),
-  fEventSpecie(qac.fEventSpecie)
+  fEventSpecie(qac.fEventSpecie),
+  fRun(qac.fRun)
 {
   // copy constructor
   
-  for (Int_t det = 0 ; det < AliQA::kNDET ; det++) 
+  for (Int_t det = 0 ; det < AliQAv1::kNDET ; det++) 
     fCheckers[det] = NULL ; 
 }
 
@@ -96,7 +98,7 @@ AliQAChecker::~AliQAChecker()
   if (fRunInfo)
     delete fRunInfo ; 
   delete [] fCheckers ; 
-  AliQA::Close() ; 
+  AliQAv1::Close() ; 
 }
 
 //_____________________________________________________________________________
@@ -109,14 +111,14 @@ AliQAChecker::~AliQAChecker()
 
        AliQACheckerBase * qac = NULL ;
 
-       TString detName(AliQA::GetDetName(det)) ; 
+       TString detName(AliQAv1::GetDetName(det)) ; 
        
-       if (det == AliQA::kGLOBAL) {
+       if (det == AliQAv1::kGLOBAL) {
                qac = new AliGlobalQAChecker() ; 
-       } else if (det == AliQA::kCORR) {
+       } else if (det == AliQAv1::kCORR) {
                qac = new AliCorrQAChecker() ; 
        } else {
-               AliDebug(1, Form("Retrieving QA checker for %s", detName.Data())) ; 
+               AliDebugClass(AliQAv1::GetQADebugLevel(), Form("Retrieving QA checker for %s", detName.Data())) ; 
                TPluginManager* pluginManager = gROOT->GetPluginManager() ;
                TString qacName = "Ali" + detName + "QAChecker" ;
 
@@ -124,7 +126,7 @@ AliQAChecker::~AliQAChecker()
                TPluginHandler* pluginHandler = pluginManager->FindHandler("AliQAChecker", detName.Data());
                // if not, add a plugin for it
                if (!pluginHandler) {
-                       //AliInfo(Form("defining plugin for %s", qacName.Data()));
+                       //AliDebug(AliQAv1::GetQADebugLevel(), Form("defining plugin for %s", qacName.Data()));
                        TString libs = gSystem->GetLibraries();
                
                        if (libs.Contains("lib" + detName + "base.so") || (gSystem->Load("lib" + detName + "base.so") >= 0))
@@ -150,57 +152,37 @@ void AliQAChecker::GetRefSubDir(const char * det, const char * task, TDirectory
 { 
   // Opens and returns the file with the reference data 
   dirFile = NULL ; 
-  TString refStorage(AliQA::GetQARefStorage()) ;
-//  if (refStorage.Contains(AliQA::GetLabLocalFile())) {       
-//    refStorage.ReplaceAll(AliQA::GetLabLocalFile(), "") ; 
-//    refStorage += AliQA::GetQARefFileName() ;
-//    if ( fRefFile ) 
-//      if ( fRefFile->IsOpen() ) 
-//                                     fRefFile->Close() ; 
-//    fRefFile = TFile::Open(refStorage.Data()) ; 
-//    if (!fRefFile) { 
-//      AliError(Form("Cannot find reference file %s", refStorage.Data())) ; 
-//      dirFile = NULL ; 
-//    }
-//    dirFile = fRefFile->GetDirectory(det) ; 
-//    if (!dirFile) {
-//      AliWarning(Form("Directory %s not found in %d", det, refStorage.Data())) ; 
-//    } else {
-//                     dirFile = dirFile->GetDirectory(task) ; 
-//      if (!dirFile) 
-//                             AliWarning(Form("Directory %s/%s not found in %s", det, task, refStorage.Data())) ; 
-//    }  
-//  } else 
-  if (!refStorage.Contains(AliQA::GetLabLocalOCDB()) && !refStorage.Contains(AliQA::GetLabAliEnOCDB())) {
+  TString refStorage(AliQAv1::GetQARefStorage()) ;
+  if (!refStorage.Contains(AliQAv1::GetLabLocalOCDB()) && !refStorage.Contains(AliQAv1::GetLabAliEnOCDB())) {
     AliError(Form("%s is not a valid location for reference data", refStorage.Data())) ; 
     return ; 
   } else {
-    AliQAManager* manQA = AliQAManager::QAManager() ;
+    AliQAManager* manQA = AliQAManager::QAManager(AliQAv1::GetTaskIndex(task)) ;
+    dirOCDB = new TObjArray*[AliRecoParam::kNSpecies] ;        
     for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
-      if ( !AliQA::Instance()->IsEventSpecieSet(specie) ) 
+      dirOCDB[specie] = NULL ; 
+      if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) ) 
         continue ; 
-      //if ( strcmp(AliQA::GetRefDataDirName(), "") == 0 ) { // the name of the last level of the directory is not set (EventSpecie)
-        // Get it from RunInfo
-        //if (!fRunInfo)  // not yet set, get the info from GRP
-        //  LoadRunInfoFromGRP() ; 
-      AliQA::SetQARefDataDirName(specie) ;
-      //}
+      AliQAv1::SetQARefDataDirName(specie) ;
       if ( ! manQA->GetLock() ) { 
-        manQA->SetDefaultStorage(AliQA::GetQARefStorage()) ; 
-        manQA->SetSpecificStorage("*", AliQA::GetQARefStorage()) ;
+        manQA->SetDefaultStorage(AliQAv1::GetQARefStorage()) ; 
+        manQA->SetSpecificStorage("*", AliQAv1::GetQARefStorage()) ;
         manQA->SetRun(AliCDBManager::Instance()->GetRun()) ; 
         manQA->SetLock() ; 
       }
-      char * detOCDBDir = Form("%s/%s/%s", det, AliQA::GetRefOCDBDirName(), AliQA::GetRefDataDirName()) ; 
+      char * detOCDBDir = Form("%s/%s/%s", det, AliQAv1::GetRefOCDBDirName(), AliQAv1::GetRefDataDirName()) ; 
       AliCDBEntry * entry = manQA->Get(detOCDBDir, manQA->GetRun()) ;
       if (entry) {
-        dirOCDB = new TObjArray*[AliRecoParam::kNSpecies] ;    
-        TList * listDetQAD = dynamic_cast<TList *>(entry->GetObject()) ;
+        TList * listDetQAD =static_cast<TList *>(entry->GetObject()) ;
+        if ( strcmp(listDetQAD->ClassName(), "TList") != 0 ) {
+          AliError(Form("Expected a Tlist and found a %s for detector %s", listDetQAD->ClassName(), det)) ; 
+          continue ; 
+        }       
         TIter next(listDetQAD) ;
         TObjArray * ar ; 
-        while ( (ar = (TObjArray*)next()) )
+        while ( (ar = (TObjArray*)next()) ) 
           if ( listDetQAD ) 
-          dirOCDB[specie] = dynamic_cast<TObjArray *>(listDetQAD->FindObject(Form("%s/%s", task, AliRecoParam::GetEventSpecieName(specie)))) ; 
+            dirOCDB[specie] = static_cast<TObjArray *>(listDetQAD->FindObject(Form("%s/%s", task, AliRecoParam::GetEventSpecieName(specie)))) ;             
       }
     }
   }
@@ -219,22 +201,22 @@ AliQAChecker * AliQAChecker::Instance()
 void AliQAChecker::LoadRunInfoFromGRP() 
 {
   AliCDBManager* man = AliCDBManager::Instance() ;
-  AliCDBEntry* entry = man->Get(AliQA::GetGRPPath().Data());
+  AliCDBEntry* entry = man->Get(AliQAv1::GetGRPPath().Data());
   AliGRPObject* grpObject = 0x0;
   if (entry) {
 
-         TMap* m = dynamic_cast<TMap*>(entry->GetObject());  // old GRP entry
+         TMap* m = static_cast<TMap*>(entry->GetObject());  // old GRP entry
 
          if (m) {
-           AliInfo("It is a map");
+           AliDebug(AliQAv1::GetQADebugLevel(), "It is a map");
            //m->Print();
            grpObject = new AliGRPObject();
                 grpObject->ReadValuesFromMap(m);
     }
 
     else {
-           AliInfo("It is a new GRP object");
-        grpObject = dynamic_cast<AliGRPObject*>(entry->GetObject());  // new GRP entry
+           AliDebug(AliQAv1::GetQADebugLevel(), "It is a new GRP object");
+        grpObject = static_cast<AliGRPObject*>(entry->GetObject());  // new GRP entry
     }
 
     entry->SetOwner(0);
@@ -310,62 +292,72 @@ void AliQAChecker::LoadRunInfoFromGRP()
 }
 
 //_____________________________________________________________________________
-Bool_t AliQAChecker::Run(const char * fileName)
+Bool_t AliQAChecker::Run(const char * fileName, Int_t runnumber)
 {
-  // run the Quality Assurance Checker for all tasks Hits, SDigits, Digits, recpoints, tracksegments, recparticles and ESDs
+  // run the Quality Assurance Checker for all tasks Hits, SDigits, Digits, DigitsR, RecPoints, TrackSegments, RecParticles and ESDs
   // starting from data in file  
   TStopwatch stopwatch;
   stopwatch.Start();
-
+  
+  // set the run number
+  AliCDBManager::Instance()->SetRun(runnumber) ; 
+  // search and set the event species
+  AliQAv1 * qa = AliQAv1::Instance() ; 
+  for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
+    if ( AliQAv1::GetQADataFile(fileName)->FindObjectAny(AliRecoParam::GetEventSpecieName(specie)) ) 
+      qa->SetEventSpecie(AliRecoParam::ConvertIndex(specie)) ; 
+  }
   //search for all detectors QA directories
-  TList * detKeyList = AliQA::GetQADataFile(fileName)->GetListOfKeys() ; 
+  TList * detKeyList = AliQAv1::GetQADataFile(fileName)->GetListOfKeys() ; 
   TIter nextd(detKeyList) ; 
   TKey * detKey ; 
-  while ( (detKey = dynamic_cast<TKey *>(nextd()) ) ) {
-    AliDebug(1, Form("Found %s", detKey->GetName())) ;
+  while ( (detKey = static_cast<TKey *>(nextd()) ) ) {
+    AliDebug(AliQAv1::GetQADebugLevel(), Form("Found %s", detKey->GetName())) ;
     //Check which detector
     TString detName ; 
     TString detNameQA(detKey->GetName()) ; 
     Int_t det ; 
-    for ( det = 0; det < AliQA::kNDET ; det++) {
-      detName = AliQA::GetDetName(det) ; 
+    for ( det = 0; det < AliQAv1::kNDET ; det++) {
+      detName = AliQAv1::GetDetName(det) ; 
       if (detNameQA.Contains(detName)) {
         fFoundDetectors+=detName ; 
         fFoundDetectors+="." ;         
         break ; 
       }
     } 
-    TDirectory * detDir = AliQA::GetQADataFile(fileName)->GetDirectory(detKey->GetName()) ; 
+    TDirectory * detDir = AliQAv1::GetQADataFile(fileName)->GetDirectory(detKey->GetName()) ; 
     TList * taskKeyList = detDir->GetListOfKeys() ;
     TIter nextt(taskKeyList) ; 
     TKey * taskKey ; 
     // now search for the tasks dir
     while ( (taskKey = static_cast<TKey *>(nextt()) ) ) {
       TString taskName( taskKey->GetName() ) ; 
-      AliInfo(Form("Found %s", taskName.Data())) ;
+      AliDebug(AliQAv1::GetQADebugLevel(), Form("Found %s", taskName.Data())) ;
       TDirectory * taskDir = detDir->GetDirectory(taskName.Data()) ; 
       taskDir->cd() ; 
       AliQACheckerBase * qac = GetDetQAChecker(det) ; 
       if (qac)
-        AliInfo(Form("QA checker found for %s", detName.Data())) ; 
+        AliDebug(AliQAv1::GetQADebugLevel(), Form("QA checker found for %s", detName.Data())) ; 
       if (!qac)
         AliFatal(Form("QA checker not found for %s", detName.Data())) ; 
-      AliQA::ALITASK_t index = AliQA::kNULLTASK ; 
-      if ( taskName == AliQA::GetTaskName(AliQA::kHITS) ) 
-        index = AliQA::kSIM ; 
-      if ( taskName == AliQA::GetTaskName(AliQA::kSDIGITS) ) 
-        index = AliQA::kSIM ; 
-      if ( taskName == AliQA::GetTaskName(AliQA::kDIGITS) ) 
-        index = AliQA::kSIM ; 
-      if ( taskName == AliQA::GetTaskName(AliQA::kRECPOINTS) ) 
-        index = AliQA::kREC ; 
-      if ( taskName == AliQA::GetTaskName(AliQA::kTRACKSEGMENTS) ) 
-        index = AliQA::kREC ; 
-      if ( taskName == AliQA::GetTaskName(AliQA::kRECPARTICLES) ) 
-        index = AliQA::kREC ; 
-      if ( taskName == AliQA::GetTaskName(AliQA::kESDS) ) 
-        index = AliQA::kESD ; 
-      qac->Init(AliQA::DETECTORINDEX_t(det)) ; 
+      AliQAv1::ALITASK_t index = AliQAv1::kNULLTASK ; 
+      if ( taskName == AliQAv1::GetTaskName(AliQAv1::kHITS) ) 
+        index = AliQAv1::kSIM ; 
+      if ( taskName == AliQAv1::GetTaskName(AliQAv1::kSDIGITS) ) 
+        index = AliQAv1::kSIM ; 
+      if ( taskName == AliQAv1::GetTaskName(AliQAv1::kDIGITS) ) 
+        index = AliQAv1::kSIM ; 
+      if ( taskName == AliQAv1::GetTaskName(AliQAv1::kDIGITSR) ) 
+        index = AliQAv1::kREC ; 
+      if ( taskName == AliQAv1::GetTaskName(AliQAv1::kRECPOINTS) ) 
+        index = AliQAv1::kREC ; 
+      if ( taskName == AliQAv1::GetTaskName(AliQAv1::kTRACKSEGMENTS) ) 
+        index = AliQAv1::kREC ; 
+      if ( taskName == AliQAv1::GetTaskName(AliQAv1::kRECPARTICLES) ) 
+        index = AliQAv1::kREC ; 
+      if ( taskName == AliQAv1::GetTaskName(AliQAv1::kESDS) ) 
+        index = AliQAv1::kESD ; 
+      qac->Init(AliQAv1::DETECTORINDEX_t(det)) ; 
       
       TDirectory * refDir     = NULL ; 
       TObjArray ** refOCDBDir = NULL ; 
@@ -374,89 +366,100 @@ Bool_t AliQAChecker::Run(const char * fileName)
                  qac->Run(index) ; 
     }
   }
-  AliInfo("QA performed for following detectors:") ; 
-  for ( Int_t det = 0; det < AliQA::kNDET; det++) {
-    if (fFoundDetectors.Contains(AliQA::GetDetName(det))) {
-      printf("%s, ",AliQA::GetDetName(det)) ; 
-      fFoundDetectors.ReplaceAll(AliQA::GetDetName(det), "") ; 
+  TString detList ; 
+  for ( Int_t det = 0; det < AliQAv1::kNDET; det++) {
+    if (fFoundDetectors.Contains(qa->GetDetName(det))) {
+      detList += qa->GetDetName(det) ; 
+      detList += " " ; 
+      fFoundDetectors.ReplaceAll(qa->GetDetName(det), "") ; 
+      qa->Show(qa->GetDetIndex(qa->GetDetName(det))) ; 
     }  
   }
-  printf("\n") ; 
+  AliInfo(Form("QA performed for following detectors: %s", detList.Data())) ; 
   return kTRUE ; 
 }
 
 //_____________________________________________________________________________
-Bool_t AliQAChecker::Run(AliQA::DETECTORINDEX_t det, AliQA::TASKINDEX_t task, TObjArray ** list)
+Bool_t AliQAChecker::Run(AliQAv1::DETECTORINDEX_t det, AliQAv1::TASKINDEX_t task, TObjArray ** list)
 {
        // run the Quality Assurance Checker for detector det, for task task starting from data in list
 
        AliQACheckerBase * qac = GetDetQAChecker(det) ; 
        if (qac)
-               AliDebug(1, Form("QA checker found for %s", AliQA::GetDetName(det).Data())) ;
+               AliDebug(AliQAv1::GetQADebugLevel(), Form("QA checker found for %s", AliQAv1::GetDetName(det).Data())) ;
        if (!qac)
-               AliError(Form("QA checker not found for %s", AliQA::GetDetName(det).Data())) ; 
+               AliError(Form("QA checker not found for %s", AliQAv1::GetDetName(det).Data())) ; 
   
-       AliQA::ALITASK_t index = AliQA::kNULLTASK ; 
-       if ( task == AliQA::kRAWS ) 
-               index = AliQA::kRAW ; 
-       else if ( task == AliQA::kHITS ) 
-               index = AliQA::kSIM ; 
-       else if ( task == AliQA::kSDIGITS ) 
-               index = AliQA::kSIM ; 
-       else if ( task == AliQA::kDIGITS ) 
-               index = AliQA::kSIM ; 
-       else if ( task == AliQA::kRECPOINTS ) 
-               index = AliQA::kREC ; 
-       else if ( task == AliQA::kTRACKSEGMENTS ) 
-               index = AliQA::kREC ; 
-       else if ( task == AliQA::kRECPARTICLES ) 
-               index = AliQA::kREC ; 
-       else if ( task == AliQA::kESDS ) 
-               index = AliQA::kESD ; 
+       AliQAv1::ALITASK_t index = AliQAv1::kNULLTASK ; 
+       if ( task == AliQAv1::kRAWS ) 
+               index = AliQAv1::kRAW ; 
+       else if ( task == AliQAv1::kHITS ) 
+               index = AliQAv1::kSIM ; 
+       else if ( task == AliQAv1::kSDIGITS ) 
+               index = AliQAv1::kSIM ; 
+       else if ( task == AliQAv1::kDIGITS ) 
+               index = AliQAv1::kSIM ; 
+       else if ( task == AliQAv1::kDIGITSR ) 
+               index = AliQAv1::kREC ; 
+       else if ( task == AliQAv1::kRECPOINTS ) 
+               index = AliQAv1::kREC ; 
+       else if ( task == AliQAv1::kTRACKSEGMENTS ) 
+               index = AliQAv1::kREC ; 
+       else if ( task == AliQAv1::kRECPARTICLES ) 
+               index = AliQAv1::kREC ; 
+       else if ( task == AliQAv1::kESDS ) 
+               index = AliQAv1::kESD ; 
 
        TDirectory * refDir     = NULL ; 
        TObjArray ** refOCDBDir = NULL  ;       
   qac->Init(det) ; 
-  GetRefSubDir(AliQA::GetDetName(det), AliQA::GetTaskName(task), refDir, refOCDBDir) ;
+  GetRefSubDir(AliQAv1::GetDetName(det), AliQAv1::GetTaskName(task), refDir, refOCDBDir) ;
   qac->SetRefandData(refDir, refOCDBDir) ; 
   qac->Run(index, list) ; 
+  
+  // make the image 
+  qac->MakeImage(list, task, AliQAv1::Mode(task)) ; 
+  
        return kTRUE ; 
 }
 
 //_____________________________________________________________________________
-Bool_t AliQAChecker::Run(AliQA::DETECTORINDEX_t det, AliQA::TASKINDEX_t task, TNtupleD ** list)
+Bool_t AliQAChecker::Run(AliQAv1::DETECTORINDEX_t det, AliQAv1::TASKINDEX_t task, TNtupleD ** list)
 {
        // run the Quality Assurance Checker for detector det, for task task starting from data in list
   
        AliQACheckerBase * qac = GetDetQAChecker(det) ; 
        if (qac)
-               AliDebug(1, Form("QA checker found for %s", AliQA::GetDetName(det).Data())) ;
+               AliDebug(AliQAv1::GetQADebugLevel(), Form("QA checker found for %s", AliQAv1::GetDetName(det).Data())) ;
        if (!qac)
-               AliError(Form("QA checker not found for %s", AliQA::GetDetName(det).Data())) ; 
+               AliError(Form("QA checker not found for %s", AliQAv1::GetDetName(det).Data())) ; 
   
-       AliQA::ALITASK_t index = AliQA::kNULLTASK ; 
-       if ( task == AliQA::kRAWS ) 
-               index = AliQA::kRAW ; 
-       else if ( task == AliQA::kHITS ) 
-               index = AliQA::kSIM ; 
-       else if ( task == AliQA::kSDIGITS ) 
-               index = AliQA::kSIM ; 
-       else if ( task == AliQA::kDIGITS ) 
-               index = AliQA::kSIM ; 
-       else if ( task == AliQA::kRECPOINTS ) 
-               index = AliQA::kREC ; 
-       else if ( task == AliQA::kTRACKSEGMENTS ) 
-               index = AliQA::kREC ; 
-       else if ( task == AliQA::kRECPARTICLES ) 
-               index = AliQA::kREC ; 
-       else if ( task == AliQA::kESDS ) 
-               index = AliQA::kESD ; 
+       AliQAv1::ALITASK_t index = AliQAv1::kNULLTASK ; 
+       if ( task == AliQAv1::kRAWS ) 
+               index = AliQAv1::kRAW ; 
+       else if ( task == AliQAv1::kHITS ) 
+               index = AliQAv1::kSIM ; 
+       else if ( task == AliQAv1::kSDIGITS ) 
+               index = AliQAv1::kSIM ; 
+       else if ( task == AliQAv1::kDIGITS ) 
+               index = AliQAv1::kSIM ; 
+       else if ( task == AliQAv1::kDIGITSR ) 
+               index = AliQAv1::kREC ; 
+       else if ( task == AliQAv1::kRECPOINTS ) 
+               index = AliQAv1::kREC ; 
+       else if ( task == AliQAv1::kTRACKSEGMENTS ) 
+               index = AliQAv1::kREC ; 
+       else if ( task == AliQAv1::kRECPARTICLES ) 
+               index = AliQAv1::kREC ; 
+       else if ( task == AliQAv1::kESDS ) 
+               index = AliQAv1::kESD ; 
   
        TDirectory * refDir     = NULL ; 
        TObjArray ** refOCDBDir = NULL ;        
   qac->Init(det) ; 
-  GetRefSubDir(AliQA::GetDetName(det), AliQA::GetTaskName(task), refDir, refOCDBDir) ;
+  GetRefSubDir(AliQAv1::GetDetName(det), AliQAv1::GetTaskName(task), refDir, refOCDBDir) ;
   qac->SetRefandData(refDir, refOCDBDir) ; 
   qac->Run(index, list) ; 
+
   return kTRUE ; 
 }