]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliQAChecker.cxx
Coverity:
[u/mrichter/AliRoot.git] / STEER / AliQAChecker.cxx
index 9cd16ed0af876f5a93258ea7f179f0a6974353d1..0a109643c3a6b8eb0b967bbc9a4cee31f26b03ff 100644 (file)
@@ -56,7 +56,8 @@ 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 < AliQAv1::kNDET ; det++) 
@@ -71,7 +72,8 @@ AliQAChecker::AliQAChecker(const AliQAChecker& qac) :
   fRunInfoOwner(kFALSE),   
   fRefFile(qac.fRefFile), 
   fFoundDetectors(qac.fFoundDetectors),
-  fEventSpecie(qac.fEventSpecie)
+  fEventSpecie(qac.fEventSpecie),
+  fRun(qac.fRun)
 {
   // copy constructor
   
@@ -95,7 +97,8 @@ AliQAChecker::~AliQAChecker()
 // clean up
   if (fRunInfo)
     delete fRunInfo ; 
-  delete [] fCheckers ; 
+  for (Int_t det=0; det<AliQAv1::kNDET; det++)
+    delete fCheckers[det] ; 
   AliQAv1::Close() ; 
 }
 
@@ -116,7 +119,7 @@ AliQAChecker::~AliQAChecker()
        } else if (det == AliQAv1::kCORR) {
                qac = new AliCorrQAChecker() ; 
        } else {
-               AliDebug(AliQAv1::GetQADebugLevel(), 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" ;
 
@@ -144,67 +147,6 @@ AliQAChecker::~AliQAChecker()
        
        return qac ; 
 }
-//_____________________________________________________________________________
-void AliQAChecker::GetRefSubDir(const char * det, const char * task, TDirectory *& dirFile, TObjArray **& dirOCDB)     
-{ 
-  // Opens and returns the file with the reference data 
-  dirFile = NULL ; 
-  TString refStorage(AliQAv1::GetQARefStorage()) ;
-//  if (refStorage.Contains(AliQAv1::GetLabLocalFile())) {     
-//    refStorage.ReplaceAll(AliQAv1::GetLabLocalFile(), "") ; 
-//    refStorage += AliQAv1::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(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() ;
-    for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
-      if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) ) 
-        continue ; 
-      //if ( strcmp(AliQAv1::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() ; 
-      AliQAv1::SetQARefDataDirName(specie) ;
-      //}
-      if ( ! manQA->GetLock() ) { 
-        manQA->SetDefaultStorage(AliQAv1::GetQARefStorage()) ; 
-        manQA->SetSpecificStorage("*", AliQAv1::GetQARefStorage()) ;
-        manQA->SetRun(AliCDBManager::Instance()->GetRun()) ; 
-        manQA->SetLock() ; 
-      }
-      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()) ;
-        TIter next(listDetQAD) ;
-        TObjArray * ar ; 
-        while ( (ar = (TObjArray*)next()) )
-          if ( listDetQAD ) 
-          dirOCDB[specie] = dynamic_cast<TObjArray *>(listDetQAD->FindObject(Form("%s/%s", task, AliRecoParam::GetEventSpecieName(specie)))) ; 
-      }
-    }
-  }
-}
 
 //_____________________________________________________________________________
 AliQAChecker * AliQAChecker::Instance()
@@ -223,7 +165,7 @@ void AliQAChecker::LoadRunInfoFromGRP()
   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) {
            AliDebug(AliQAv1::GetQADebugLevel(), "It is a map");
@@ -234,7 +176,7 @@ void AliQAChecker::LoadRunInfoFromGRP()
 
     else {
            AliDebug(AliQAv1::GetQADebugLevel(), "It is a new GRP object");
-        grpObject = dynamic_cast<AliGRPObject*>(entry->GetObject());  // new GRP entry
+        grpObject = static_cast<AliGRPObject*>(entry->GetObject());  // new GRP entry
     }
 
     entry->SetOwner(0);
@@ -310,18 +252,18 @@ void AliQAChecker::LoadRunInfoFromGRP()
 }
 
 //_____________________________________________________________________________
-Bool_t AliQAChecker::Run(const char * fileName)
+Bool_t AliQAChecker::Run(const char * fileName, AliDetectorRecoParam * recoParam)
 {
-  // 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();
-
+  
   //search for all detectors QA directories
   TList * detKeyList = AliQAv1::GetQADataFile(fileName)->GetListOfKeys() ; 
   TIter nextd(detKeyList) ; 
   TKey * detKey ; 
-  while ( (detKey = dynamic_cast<TKey *>(nextd()) ) ) {
+  while ( (detKey = static_cast<TKey *>(nextd()) ) ) {
     AliDebug(AliQAv1::GetQADebugLevel(), Form("Found %s", detKey->GetName())) ;
     //Check which detector
     TString detName ; 
@@ -357,6 +299,10 @@ Bool_t AliQAChecker::Run(const char * fileName)
         index = AliQAv1::kSIM ; 
       if ( taskName == AliQAv1::GetTaskName(AliQAv1::kDIGITS) ) 
         index = AliQAv1::kSIM ; 
+      if ( taskName == AliQAv1::GetTaskName(AliQAv1::kRAWS) ) 
+        index = AliQAv1::kRAW ;       
+      if ( taskName == AliQAv1::GetTaskName(AliQAv1::kDIGITSR) ) 
+        index = AliQAv1::kREC ; 
       if ( taskName == AliQAv1::GetTaskName(AliQAv1::kRECPOINTS) ) 
         index = AliQAv1::kREC ; 
       if ( taskName == AliQAv1::GetTaskName(AliQAv1::kTRACKSEGMENTS) ) 
@@ -366,30 +312,31 @@ Bool_t AliQAChecker::Run(const char * fileName)
       if ( taskName == AliQAv1::GetTaskName(AliQAv1::kESDS) ) 
         index = AliQAv1::kESD ; 
       qac->Init(AliQAv1::DETECTORINDEX_t(det)) ; 
-      
-      TDirectory * refDir     = NULL ; 
-      TObjArray ** refOCDBDir = NULL ; 
-      GetRefSubDir(detNameQA.Data(), taskName.Data(), refDir, refOCDBDir) ;
-                 qac->SetRefandData(refDir, refOCDBDir, taskDir) ;
-                 qac->Run(index) ; 
+                 qac->Run(index, recoParam) ; 
     }
   }
-  AliInfo("QA performed for following detectors:") ; 
+  TString detList ; 
   for ( Int_t det = 0; det < AliQAv1::kNDET; det++) {
     if (fFoundDetectors.Contains(AliQAv1::GetDetName(det))) {
-      AliInfoClass(Form("%s, ",AliQAv1::GetDetName(det))) ; 
+      detList += AliQAv1::GetDetName(det) ; 
+      detList += " " ; 
       fFoundDetectors.ReplaceAll(AliQAv1::GetDetName(det), "") ; 
+      AliQAv1::Instance()->Show(AliQAv1::GetDetIndex(AliQAv1::GetDetName(det))) ; 
     }  
   }
-  printf("\n") ; 
+  AliInfo(Form("QA performed for following detectors: %s", detList.Data())) ; 
   return kTRUE ; 
 }
 
 //_____________________________________________________________________________
-Bool_t AliQAChecker::Run(AliQAv1::DETECTORINDEX_t det, AliQAv1::TASKINDEX_t task, TObjArray ** list)
+Bool_t AliQAChecker::Run(AliQAv1::DETECTORINDEX_t det, AliQAv1::TASKINDEX_t task, TObjArray ** list, AliDetectorRecoParam * recoParam)
 {
        // run the Quality Assurance Checker for detector det, for task task starting from data in list
 
+  if (det >= AliQAv1::kNDET) {
+    AliError(Form("det = %i is larger than AliQAv1::kNDET ... should never happen", det)); 
+    return kFALSE ; 
+  }
        AliQACheckerBase * qac = GetDetQAChecker(det) ; 
        if (qac)
                AliDebug(AliQAv1::GetQADebugLevel(), Form("QA checker found for %s", AliQAv1::GetDetName(det).Data())) ;
@@ -405,6 +352,8 @@ Bool_t AliQAChecker::Run(AliQAv1::DETECTORINDEX_t det, AliQAv1::TASKINDEX_t task
                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 ) 
@@ -414,17 +363,17 @@ Bool_t AliQAChecker::Run(AliQAv1::DETECTORINDEX_t det, AliQAv1::TASKINDEX_t task
        else if ( task == AliQAv1::kESDS ) 
                index = AliQAv1::kESD ; 
 
-       TDirectory * refDir     = NULL ; 
-       TObjArray ** refOCDBDir = NULL  ;       
   qac->Init(det) ; 
-  GetRefSubDir(AliQAv1::GetDetName(det), AliQAv1::GetTaskName(task), refDir, refOCDBDir) ;
-  qac->SetRefandData(refDir, refOCDBDir) ; 
-  qac->Run(index, list) ; 
+  qac->Run(index, list, recoParam) ; 
+  
+  // make the image 
+  qac->MakeImage(list, task, AliQAv1::Mode(task)) ; 
+  
        return kTRUE ; 
 }
 
 //_____________________________________________________________________________
-Bool_t AliQAChecker::Run(AliQAv1::DETECTORINDEX_t det, AliQAv1::TASKINDEX_t task, TNtupleD ** list)
+Bool_t AliQAChecker::Run(AliQAv1::DETECTORINDEX_t det, AliQAv1::TASKINDEX_t task, TNtupleD ** list, AliDetectorRecoParam * recoParam)
 {
        // run the Quality Assurance Checker for detector det, for task task starting from data in list
   
@@ -443,6 +392,8 @@ Bool_t AliQAChecker::Run(AliQAv1::DETECTORINDEX_t det, AliQAv1::TASKINDEX_t task
                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 ) 
@@ -452,11 +403,8 @@ Bool_t AliQAChecker::Run(AliQAv1::DETECTORINDEX_t det, AliQAv1::TASKINDEX_t task
        else if ( task == AliQAv1::kESDS ) 
                index = AliQAv1::kESD ; 
   
-       TDirectory * refDir     = NULL ; 
-       TObjArray ** refOCDBDir = NULL ;        
   qac->Init(det) ; 
-  GetRefSubDir(AliQAv1::GetDetName(det), AliQAv1::GetTaskName(task), refDir, refOCDBDir) ;
-  qac->SetRefandData(refDir, refOCDBDir) ; 
-  qac->Run(index, list) ; 
+  qac->Run(index, list, recoParam) ; 
+
   return kTRUE ; 
 }