X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=STEER%2FAliQAChecker.cxx;h=63ef31346b1907297c87439d5cd7c9834ad14dc0;hb=c1ae51a3dbeaf220236a3c7b7c92d9f811008bd0;hp=f9becc6993552afe98cf8cdb4cd322d684d78c3a;hpb=d3b3019c11a31c70d71e341dab850b10a72f8c6a;p=u%2Fmrichter%2FAliRoot.git diff --git a/STEER/AliQAChecker.cxx b/STEER/AliQAChecker.cxx index f9becc69935..63ef31346b1 100644 --- a/STEER/AliQAChecker.cxx +++ b/STEER/AliQAChecker.cxx @@ -22,22 +22,28 @@ /////////////////////////////////////////////////////////////////////////////// #include "AliCDBEntry.h" -#include "AliCDBManager.h" +#include "AliQAManager.h" #include "AliCDBStorage.h" +#include "AliRunInfo.h" #include "AliLog.h" #include "AliModule.h" -#include "AliQA.h" +#include "AliQAv1.h" #include "AliQAChecker.h" #include "AliQACheckerBase.h" +#include "AliCorrQAChecker.h" +#include "AliGlobalQAChecker.h" +#include "AliGRPObject.h" #include #include +#include #include #include #include #include #include #include +#include ClassImp(AliQAChecker) AliQAChecker * AliQAChecker::fgQAChecker = 0x0 ; @@ -46,11 +52,15 @@ ClassImp(AliQAChecker) AliQAChecker::AliQAChecker(const char* name, const char* title) : TNamed(name, title), fDataFile(0x0), + fRunInfo(0x0), + fRunInfoOwner(kFALSE), fRefFile(0x0), - fFoundDetectors(".") + fFoundDetectors("."), + 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 ; } @@ -58,12 +68,16 @@ AliQAChecker::AliQAChecker(const char* name, const char* title) : AliQAChecker::AliQAChecker(const AliQAChecker& qac) : TNamed(qac), fDataFile(qac.fDataFile), + fRunInfo(qac.fRunInfo), + fRunInfoOwner(kFALSE), fRefFile(qac.fRefFile), - fFoundDetectors(qac.fFoundDetectors) + fFoundDetectors(qac.fFoundDetectors), + 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 ; } @@ -81,92 +95,57 @@ AliQAChecker& AliQAChecker::operator = (const AliQAChecker& qac) AliQAChecker::~AliQAChecker() { // clean up - delete [] fCheckers ; - AliQA::Close() ; + if (fRunInfo) + delete fRunInfo ; + for (Int_t det=0; detGetPluginManager() ; - TString qacName = "Ali" + detName + "QAChecker" ; - - AliQACheckerBase * qac = NULL ; - // first check if a plugin is defined for the quality assurance checker - TPluginHandler* pluginHandler = pluginManager->FindHandler("AliQAChecker", detName.Data()); - // if not, add a plugin for it - if (!pluginHandler) { - //AliInfo(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)) - pluginManager->AddHandler("AliQAChecker", detName, qacName, detName + "qac", qacName + "()"); - else - pluginManager->AddHandler("AliQAChecker", detName, qacName, detName, qacName + "()"); - - pluginHandler = pluginManager->FindHandler("AliQAChecker", detName); - - if (pluginHandler && (pluginHandler->LoadPlugin() == 0)) - qac = (AliQACheckerBase *) pluginHandler->ExecPlugin(0); - - if (qac) - fCheckers[det] = qac ; - } + AliQACheckerBase * qac = NULL ; - return qac ; -} + TString detName(AliQAv1::GetDetName(det)) ; + + if (det == AliQAv1::kGLOBAL) { + qac = new AliGlobalQAChecker() ; + } else if (det == AliQAv1::kCORR) { + qac = new AliCorrQAChecker() ; + } else { + AliDebugClass(AliQAv1::GetQADebugLevel(), Form("Retrieving QA checker for %s", detName.Data())) ; + TPluginManager* pluginManager = gROOT->GetPluginManager() ; + TString qacName = "Ali" + detName + "QAChecker" ; + // first check if a plugin is defined for the quality assurance checker + TPluginHandler* pluginHandler = pluginManager->FindHandler("AliQAChecker", detName.Data()); + // if not, add a plugin for it + if (!pluginHandler) { + //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)) + pluginManager->AddHandler("AliQAChecker", detName, qacName, detName + "qac", qacName + "()"); + else + pluginManager->AddHandler("AliQAChecker", detName, qacName, detName, qacName + "()"); -//_____________________________________________________________________________ -void AliQAChecker::GetRefSubDir(const char * det, const char * task, TDirectory *& dirFile, TObjArray *& dirOCDB) -{ - // Opens and returns the file with the reference data - - 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(entry->GetObject()) ; - if ( listDetQAD ) - dirOCDB = dynamic_cast(listDetQAD->FindObject(task)) ; + pluginHandler = pluginManager->FindHandler("AliQAChecker", detName); + + if (pluginHandler && (pluginHandler->LoadPlugin() == 0)) + qac = (AliQACheckerBase *) pluginHandler->ExecPlugin(0); + } } + if (qac) + fCheckers[det] = qac ; + + return qac ; } //_____________________________________________________________________________ @@ -179,127 +158,249 @@ AliQAChecker * AliQAChecker::Instance() } //_____________________________________________________________________________ -Bool_t AliQAChecker::Run(const char * fileName) +void AliQAChecker::LoadRunInfoFromGRP() { - // run the Quality Assurance Checker for all tasks Hits, SDigits, Digits, recpoints, tracksegments, recparticles and ESDs - // starting from data in file + AliCDBManager* man = AliCDBManager::Instance() ; + AliCDBEntry* entry = man->Get(AliQAv1::GetGRPPath().Data()); + AliGRPObject* grpObject = 0x0; + if (entry) { - Bool_t rv = kFALSE ; - + TMap* m = static_cast(entry->GetObject()); // old GRP entry + + if (m) { + AliDebug(AliQAv1::GetQADebugLevel(), "It is a map"); + //m->Print(); + grpObject = new AliGRPObject(); + grpObject->ReadValuesFromMap(m); + } + + else { + AliDebug(AliQAv1::GetQADebugLevel(), "It is a new GRP object"); + grpObject = static_cast(entry->GetObject()); // new GRP entry + } + + entry->SetOwner(0); + AliCDBManager::Instance()->UnloadFromCache("GRP/GRP/Data"); + } + + if (!grpObject) { + AliFatal("No GRP entry found in OCDB!"); + } + + TString lhcState = grpObject->GetLHCState(); + if (lhcState==AliGRPObject::GetInvalidString()) { + AliError("GRP/GRP/Data entry: missing value for the LHC state ! Using UNKNOWN"); + lhcState = "UNKNOWN"; + } + + TString beamType = grpObject->GetBeamType(); + if (beamType==AliGRPObject::GetInvalidString()) { + AliError("GRP/GRP/Data entry: missing value for the beam type ! Using UNKNOWN"); + beamType = "UNKNOWN"; + } + + Float_t beamEnergy = grpObject->GetBeamEnergy(); + if (beamEnergy==AliGRPObject::GetInvalidFloat()) { + AliError("GRP/GRP/Data entry: missing value for the beam energy ! Using 0"); + beamEnergy = 0; + } + + TString runType = grpObject->GetRunType(); + if (runType==AliGRPObject::GetInvalidString()) { + AliError("GRP/GRP/Data entry: missing value for the run type ! Using UNKNOWN"); + runType = "UNKNOWN"; + } + + Int_t activeDetectors = grpObject->GetDetectorMask(); + if (activeDetectors==AliGRPObject::GetInvalidInt()) { + AliError("GRP/GRP/Data entry: missing value for the detector mask ! Using 1074790399"); + activeDetectors = 1074790399; + } + + fRunInfo = new AliRunInfo(lhcState, beamType, beamEnergy, runType, activeDetectors); + + fRunInfoOwner = kTRUE ; + + // set the event specie + fEventSpecie = AliRecoParam::kDefault ; + if (strcmp(runType,"PHYSICS")) { + // Not a physics run, the event specie is set to kCalib + fEventSpecie = AliRecoParam::kCalib ; + return; + } + if (strcmp(lhcState,"STABLE_BEAMS") == 0) { + // Heavy ion run (any beam tha is not pp, the event specie is set to kHighMult + fEventSpecie = AliRecoParam::kHighMult ; + if ((strcmp(beamType,"p-p") == 0) || + (strcmp(beamType,"p-") == 0) || + (strcmp(beamType,"-p") == 0) || + (strcmp(beamType,"P-P") == 0) || + (strcmp(beamType,"P-") == 0) || + (strcmp(beamType,"-P") == 0)) { + // Proton run, the event specie is set to kLowMult + fEventSpecie = AliRecoParam::kLowMult ; + } + else if (strcmp(beamType,"-") == 0) { + // No beams, we assume cosmic data + fEventSpecie = AliRecoParam::kCosmic ; + } + else if (strcmp(beamType,"UNKNOWN") == 0) { + // No LHC beam information is available, we use the default event specie + fEventSpecie = AliRecoParam::kDefault ; + } + } +} + +//_____________________________________________________________________________ +Bool_t AliQAChecker::Run(const char * fileName, AliDetectorRecoParam * recoParam) +{ + // 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 = AliQA::GetQADataFile(fileName)->GetListOfKeys() ; + TList * detKeyList = AliQAv1::GetQADataFile(fileName)->GetListOfKeys() ; TIter nextd(detKeyList) ; TKey * detKey ; - while ( (detKey = dynamic_cast(nextd()) ) ) { - AliDebug(1, Form("Found %s", detKey->GetName())) ; + while ( (detKey = static_cast(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 ; + 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(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)) ; - - TDirectory * refDir = NULL ; - TObjArray * refOCDBDir = NULL ; - GetRefSubDir(detNameQA.Data(), taskName.Data(), refDir, refOCDBDir) ; - if ( refDir || refOCDBDir) { - qac->SetRefandData(refDir, refOCDBDir, taskDir) ; - qac->Run(index) ; - } - } + AliFatal(Form("QA checker not found for %s", detName.Data())) ; + 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::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) ) + 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)) ; + qac->Run(index, recoParam) ; + } } - 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(AliQAv1::GetDetName(det))) { + detList += AliQAv1::GetDetName(det) ; + detList += " " ; + fFoundDetectors.ReplaceAll(AliQAv1::GetDetName(det), "") ; + AliQAv1::Instance()->Show(AliQAv1::GetDetIndex(AliQAv1::GetDetName(det))) ; } } - printf("\n") ; - rv = kTRUE ; - - return rv ; - + 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, AliDetectorRecoParam * recoParam) { // 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())) ; + + 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 ; + + qac->Init(det) ; + qac->Run(index, list, recoParam) ; + + // make the image + qac->MakeImage(list, task, AliQAv1::Mode(task)) ; - 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 ; - - TDirectory * refDir = NULL ; - TObjArray * refOCDBDir = NULL ; - qac->Init(det) ; - GetRefSubDir(AliQA::GetDetName(det), AliQA::GetTaskName(task), refDir, refOCDBDir) ; - if ( refDir || refOCDBDir) // references found - qac->SetRefandData(refDir, refOCDBDir) ; - qac->Run(index, list) ; return kTRUE ; } +//_____________________________________________________________________________ +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 + + AliQACheckerBase * qac = GetDetQAChecker(det) ; + if (qac) + AliDebug(AliQAv1::GetQADebugLevel(), Form("QA checker found for %s", AliQAv1::GetDetName(det).Data())) ; + if (!qac) + AliError(Form("QA checker not found for %s", AliQAv1::GetDetName(det).Data())) ; + + 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 ; + + qac->Init(det) ; + qac->Run(index, list, recoParam) ; - + return kTRUE ; +}