// //
///////////////////////////////////////////////////////////////////////////////
+#include "AliCDBEntry.h"
+#include "AliCDBManager.h"
+#include "AliCDBStorage.h"
#include "AliLog.h"
#include "AliModule.h"
#include "AliQA.h"
ClassImp(AliQAChecker)
AliQAChecker * AliQAChecker::fgQAChecker = 0x0 ;
- TFile * AliQAChecker::fgQAResultFile = 0x0 ;
-// TString AliQAChecker::fgQAResultDirName = "local://RUN/";
-// TString AliQAChecker::fgQAResultFileName = "QA.root" ;
//_____________________________________________________________________________
AliQAChecker::AliQAChecker(const char* name, const char* title) :
TNamed(name, title),
fDataFile(0x0),
-// fRefDirName("./Ref/"),
-// fRefName("QA.root"),
+ fRefFile(0x0),
fFoundDetectors(".")
{
// ctor: initialise checkers and open the data file
for (Int_t det = 0 ; det < AliQA::kNDET ; det++)
fCheckers[det] = NULL ;
-
-// fRefDirName.Append(fRefName) ;
}
//_____________________________________________________________________________
AliQAChecker::AliQAChecker(const AliQAChecker& qac) :
TNamed(qac),
fDataFile(qac.fDataFile),
-// fRefDirName(qac.fRefDirName),
-// fRefName(qac.fRefName),
+ fRefFile(qac.fRefFile),
fFoundDetectors(qac.fFoundDetectors)
{
// copy constructor
{
// clean up
delete [] fCheckers ;
- fgQAResultFile->Close() ;
-}
-
-//_____________________________________________________________________________
-TFile * AliQAChecker:: GetDataFile(const char * fileName)
-{
- // Open if necessary the Data file and return its pointer
-
- if (!fDataFile)
- if (!fileName)
- fileName = AliQA::GetDataName() ;
- if (!gSystem->AccessPathName(fileName)) {
- fDataFile = TFile::Open(fileName) ;
- } else {
- AliFatal(Form("File %s not found", fileName)) ;
- }
- return fDataFile ;
-}
-
-//_____________________________________________________________________________
-TFile * AliQAChecker:: GetQAResultFile()
-{
- // Check if file to store QA exists, if not create it
-
- if (fgQAResultFile) {
- if (fgQAResultFile->IsOpen()){
- fgQAResultFile->Close() ;
- fgQAResultFile = 0x0 ;
- }
- }
-// if ( fgQAResultFileName.Contains("local://"))
-// fgQAResultFileName.ReplaceAll("local:/", "") ;
-//
-// TString opt("") ;
-// if ( !gSystem->AccessPathName(fgQAResultFileName) )
-// opt = "UPDATE" ;
-// else
-// opt = "NEW" ;
-// fgQAResultFile = TFile::Open(fgQAResultFileName, opt) ;
-//
- fgQAResultFile = AliQA::GetQAResultFile() ;
- return fgQAResultFile ;
+ AliQA::Close() ;
}
//_____________________________________________________________________________
TString detName(AliQA::GetDetName(det)) ;
- AliInfo(Form("Retrieving QA checker for %s", detName.Data())) ;
+ AliDebug(1, Form("Retrieving QA checker for %s", detName.Data())) ;
TPluginManager* pluginManager = gROOT->GetPluginManager() ;
TString qacName = "Ali" + detName + "QAChecker" ;
//_____________________________________________________________________________
-TDirectory * AliQAChecker::GetRefSubDir(const char * det, const char * task)
+void AliQAChecker::GetRefSubDir(const char * det, const char * task, TDirectory *& dirFile, TObjArray *& dirOCDB)
{
// Opens and returns the file with the reference data
- TFile * f = AliQA::GetQARefFile() ; //TFile::Open(fRefDirName, "READ") ;
- TDirectory * rv = NULL ;
- if (!f) {
- AliError(Form("Cannot find reference file %s", (AliQA::GetQARefFileName()))) ;
- return rv ;
- }
- rv = f->GetDirectory(det) ;
- if (!rv) {
- AliWarning(Form("Directory %s not found in %d", det, (AliQA::GetQARefFileName()))) ;
- } else {
- rv = rv->GetDirectory(task) ;
- if (!rv)
- AliWarning(Form("Directory %s/%s not found in %s", det, task, (AliQA::GetQARefFileName()))) ;
- }
- return rv ;
+
+ dirFile = NULL ;
+ dirOCDB = NULL ;
+ TString refStorage(AliQA::GetQARefStorage()) ;
+ //refStorage += AliQA::GetQARefFileName() ;
+ if (refStorage.Contains(AliQA::GetLabLocalFile())) {
+ refStorage.ReplaceAll(AliQA::GetLabLocalFile(), "") ;
+ 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())) {
+ AliCDBManager* man = AliCDBManager::Instance() ;
+ if ( ! man->IsDefaultStorageSet() ) {
+ man->SetDefaultStorage(AliQA::GetQARefStorage()) ;
+ man->SetSpecificStorage("*", AliQA::GetQARefStorage()) ;
+ }
+ char detOCDBDir[20] ;
+ sprintf(detOCDBDir, "%s/%s/%s", det, AliQA::GetRefOCDBDirName(), AliQA::GetRefDataDirName()) ;
+ AliCDBEntry * entry = man->Get(detOCDBDir, man->GetRun()) ;
+ if (entry) {
+ TList * listDetQAD = dynamic_cast<TList *>(entry->GetObject()) ;
+ if ( listDetQAD )
+ dirOCDB = dynamic_cast<TObjArray *>(listDetQAD->FindObject(task)) ;
+ }
+ }
}
//_____________________________________________________________________________
stopwatch.Start();
//search for all detectors QA directories
- TList * detKeyList = GetDataFile(fileName)->GetListOfKeys() ;
+ TList * detKeyList = AliQA::GetQADataFile(fileName)->GetListOfKeys() ;
TIter nextd(detKeyList) ;
TKey * detKey ;
while ( (detKey = dynamic_cast<TKey *>(nextd()) ) ) {
- AliInfo(Form("Found %s", detKey->GetName())) ;
+ AliDebug(1, Form("Found %s", detKey->GetName())) ;
//Check which detector
TString detName ;
TString detNameQA(detKey->GetName()) ;
break ;
}
}
- TDirectory * detDir = GetDataFile(fileName)->GetDirectory(detKey->GetName()) ;
+ TDirectory * detDir = AliQA::GetQADataFile(fileName)->GetDirectory(detKey->GetName()) ;
TList * taskKeyList = detDir->GetListOfKeys() ;
TIter nextt(taskKeyList) ;
TKey * taskKey ;
AliInfo(Form("QA checker found for %s", detName.Data())) ;
if (!qac)
AliFatal(Form("QA checker not found for %s", detName.Data())) ;
- AliQA::ALITASK index = AliQA::kNULLTASK ;
+ AliQA::ALITASK_t index = AliQA::kNULLTASK ;
if ( taskName == AliQA::GetTaskName(AliQA::kHITS) )
index = AliQA::kSIM ;
if ( taskName == AliQA::GetTaskName(AliQA::kSDIGITS) )
index = AliQA::kREC ;
if ( taskName == AliQA::GetTaskName(AliQA::kESDS) )
index = AliQA::kESD ;
- qac->Init(AliQA::DETECTORINDEX(det)) ;
-
- TDirectory * refDir = GetRefSubDir(detNameQA.Data(), taskName.Data()) ;
- if ( refDir ) {
- qac->SetRefandData(refDir, taskDir) ;
- qac->Run(index) ;
+ qac->Init(AliQA::DETECTORINDEX_t(det)) ;
+
+ TDirectory * refDir = NULL ;
+ TObjArray * refOCDBDir = NULL ;
+ GetRefSubDir(detNameQA.Data(), taskName.Data(), refDir, refOCDBDir) ;
+ if ( refDir || refOCDBDir) {
+ qac->SetRefandData(refDir, refOCDBDir, taskDir) ;
+ qac->Run(index) ;
}
- }
- }
+ }
+ }
AliInfo("QA performed for following detectors:") ;
for ( Int_t det = 0; det < AliQA::kNDET; det++) {
if (fFoundDetectors.Contains(AliQA::GetDetName(det))) {
}
//_____________________________________________________________________________
-Bool_t AliQAChecker::Run(AliQA::DETECTORINDEX det, AliQA::TASKINDEX task, TList * list)
+Bool_t AliQAChecker::Run(AliQA::DETECTORINDEX_t det, AliQA::TASKINDEX_t task, TObjArray * list)
{
- // run the Quality Assurance Checker for detector det, for task task starting from data in list
+ // run the Quality Assurance Checker for detector det, for task task starting from data in list
- AliQACheckerBase * qac = GetDetQAChecker(det) ;
- if (qac)
- AliInfo(Form("QA checker found for %s", AliQA::GetDetName(det).Data())) ;
- if (!qac)
- AliFatal(Form("QA checker not found for %s", AliQA::GetDetName(det).Data())) ;
+ AliQACheckerBase * qac = GetDetQAChecker(det) ;
+ if (qac)
+ AliDebug(1, Form("QA checker found for %s", AliQA::GetDetName(det).Data())) ;
+ if (!qac)
+ AliError(Form("QA checker not found for %s", AliQA::GetDetName(det).Data())) ;
- AliQA::ALITASK index = AliQA::kNULLTASK ;
- if ( task == AliQA::kRAWS )
+ AliQA::ALITASK_t index = AliQA::kNULLTASK ;
+ if ( task == AliQA::kRAWS )
index = AliQA::kRAW ;
- else if ( task == AliQA::kHITS )
+ else if ( task == AliQA::kHITS )
index = AliQA::kSIM ;
- else if ( task == AliQA::kSDIGITS )
+ else if ( task == AliQA::kSDIGITS )
index = AliQA::kSIM ;
- else if ( task == AliQA::kDIGITS )
+ else if ( task == AliQA::kDIGITS )
index = AliQA::kSIM ;
- else if ( task == AliQA::kRECPOINTS )
+ else if ( task == AliQA::kRECPOINTS )
index = AliQA::kREC ;
- else if ( task == AliQA::kTRACKSEGMENTS )
+ else if ( task == AliQA::kTRACKSEGMENTS )
index = AliQA::kREC ;
- else if ( task == AliQA::kRECPARTICLES )
+ else if ( task == AliQA::kRECPARTICLES )
index = AliQA::kREC ;
- else if ( task == AliQA::kESDS )
+ else if ( task == AliQA::kESDS )
index = AliQA::kESD ;
- TDirectory * refDir = GetRefSubDir(AliQA::GetDetName(det).Data(), AliQA::GetTaskName(task).Data()) ;
- if ( refDir ) {
+ TDirectory * refDir = NULL ;
+ TObjArray * refOCDBDir = NULL ;
qac->Init(det) ;
- qac->SetRefandData(refDir) ;
+ GetRefSubDir(AliQA::GetDetName(det), AliQA::GetTaskName(task), refDir, refOCDBDir) ;
+ if ( refDir || refOCDBDir) // references found
+ qac->SetRefandData(refDir, refOCDBDir) ;
qac->Run(index, list) ;
- }
- return kTRUE ;
-
+ return kTRUE ;
}
-//_____________________________________________________________________________
-//void AliQAChecker::SetQAResultDirName(const char * name)
-//{
-// // Set the root directory where to store the QA status object
-//
-// fgQAResultDirName.Prepend(name) ;
-// AliInfo(Form("QA results are in %s", fgQAResultDirName.Data())) ;
-// if ( fgQAResultDirName.Contains("local://"))
-// fgQAResultDirName.ReplaceAll("local:/", "") ;
-// fgQAResultFileName.Prepend(fgQAResultDirName) ;
-//}
-
-//_____________________________________________________________________________
-//void AliQAChecker::SetRefDirName(const char * name)
-//{
-// // Set the root directory of reference data
-//
-// fRefDirName.Prepend(name) ;
-// fRefDirName.Append(fRefName) ;
-// AliInfo(Form("Reference data are taken from %s", fRefDirName.Data())) ;
-// if ( fRefDirName.Contains("local://"))
-// fRefDirName.ReplaceAll("local:/", "") ;
-//}
-//
-
-