#include "AliCDBEntry.h"
#include "AliCDBManager.h"
#include "AliCDBStorage.h"
-#include "AliEventInfo.h"
+#include "AliRunInfo.h"
#include "AliLog.h"
#include "AliModule.h"
#include "AliQA.h"
#include "AliQAChecker.h"
#include "AliQACheckerBase.h"
+#include "AliCorrQAChecker.h"
+#include "AliGlobalQAChecker.h"
+#include "AliGRPObject.h"
#include <TKey.h>
#include <TObjArray.h>
#include <TString.h>
#include <TSystem.h>
#include <TList.h>
+#include <TNtupleD.h>
ClassImp(AliQAChecker)
AliQAChecker * AliQAChecker::fgQAChecker = 0x0 ;
AliQAChecker::AliQAChecker(const char* name, const char* title) :
TNamed(name, title),
fDataFile(0x0),
- fEventInfo(0x0),
- fEventInfoOwner(kFALSE),
+ fRunInfo(0x0),
+ fRunInfoOwner(kFALSE),
fRefFile(0x0),
fFoundDetectors(".")
{
AliQAChecker::AliQAChecker(const AliQAChecker& qac) :
TNamed(qac),
fDataFile(qac.fDataFile),
- fEventInfo(qac.fEventInfo),
- fEventInfoOwner(kFALSE),
+ fRunInfo(qac.fRunInfo),
+ fRunInfoOwner(kFALSE),
fRefFile(qac.fRefFile),
fFoundDetectors(qac.fFoundDetectors)
{
AliQAChecker::~AliQAChecker()
{
// clean up
- if (fEventInfo)
- delete fEventInfo ;
+ if (fRunInfo)
+ delete fRunInfo ;
delete [] fCheckers ;
AliQA::Close() ;
}
//_____________________________________________________________________________
AliQACheckerBase * AliQAChecker::GetDetQAChecker(Int_t det)
{
- // Gets the Quality Assurance checker for the detector specified by its name
-
- if (fCheckers[det])
+ // Gets the Quality Assurance checker for the detector specified by its name
+
+ if (fCheckers[det])
return fCheckers[det];
- TString detName(AliQA::GetDetName(det)) ;
+ AliQACheckerBase * qac = NULL ;
- AliDebug(1, Form("Retrieving QA checker for %s", detName.Data())) ;
- TPluginManager* pluginManager = gROOT->GetPluginManager() ;
- TString qacName = "Ali" + detName + "QAChecker" ;
+ TString detName(AliQA::GetDetName(det)) ;
+
+ if (det == AliQA::kGLOBAL) {
+ qac = new AliGlobalQAChecker() ;
+ } else if (det == AliQA::kCORR) {
+ qac = new AliCorrQAChecker() ;
+ } else {
+ AliDebug(1, Form("Retrieving QA checker for %s", detName.Data())) ;
+ TPluginManager* pluginManager = gROOT->GetPluginManager() ;
+ 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 + "()");
+ // 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);
+ pluginHandler = pluginManager->FindHandler("AliQAChecker", detName);
- if (pluginHandler && (pluginHandler->LoadPlugin() == 0))
- qac = (AliQACheckerBase *) pluginHandler->ExecPlugin(0);
+ if (pluginHandler && (pluginHandler->LoadPlugin() == 0))
+ qac = (AliQACheckerBase *) pluginHandler->ExecPlugin(0);
- if (qac)
- fCheckers[det] = qac ;
- }
-
- return qac ;
+ }
+ }
+ if (qac)
+ fCheckers[det] = qac ;
+
+ return qac ;
}
//_____________________________________________________________________________
refStorage.ReplaceAll(AliQA::GetLabLocalFile(), "") ;
if ( fRefFile )
if ( fRefFile->IsOpen() )
- fRefFile->Close() ;
+ fRefFile->Close() ;
fRefFile = TFile::Open(refStorage.Data()) ;
if (!fRefFile) {
AliError(Form("Cannot find reference file %s", refStorage.Data())) ;
if (!dirFile) {
AliWarning(Form("Directory %s not found in %d", det, refStorage.Data())) ;
} else {
- dirFile = dirFile->GetDirectory(task) ;
+ dirFile = dirFile->GetDirectory(task) ;
if (!dirFile)
- AliWarning(Form("Directory %s/%s not found in %s", det, task, refStorage.Data())) ;
+ 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 ( strcmp(AliQA::GetRefDataDirName(), "") == 0 ) { // the name of the last level of the directory is not set (RUNTYPE)
- // Get it from EventInfo
- if (!fEventInfo) // not yet set, get the info from GRP
- LoadEventInfoFromGRP() ;
-
- AliQA::SetQARefDataDirName(fEventInfo->GetRunType()) ;
+ // Get it from RunInfo
+ if (!fRunInfo) // not yet set, get the info from GRP
+ LoadRunInfoFromGRP() ;
+ AliQA::SetQARefDataDirName(fRunInfo->GetRunType()) ;
}
if ( ! man->GetLock() ) {
man->SetDefaultStorage(AliQA::GetQARefStorage()) ;
if (entry) {
TList * listDetQAD = dynamic_cast<TList *>(entry->GetObject()) ;
if ( listDetQAD )
- dirOCDB = dynamic_cast<TObjArray *>(listDetQAD->FindObject(task)) ;
+ dirOCDB = dynamic_cast<TObjArray *>(listDetQAD->FindObject(task)) ;
}
}
}
}
//_____________________________________________________________________________
-void AliQAChecker::LoadEventInfoFromGRP()
+void AliQAChecker::LoadRunInfoFromGRP()
{
AliCDBManager* man = AliCDBManager::Instance() ;
AliCDBEntry* entry = man->Get(AliQA::GetGRPPath().Data());
- TMap * data = 0x0 ;
- if (entry)
- data = dynamic_cast<TMap*>(entry->GetObject());
- if (!data) {
- AliFatal("No GRP entry found in OCDB!");
+ AliGRPObject* grpObject = 0x0;
+ if (entry) {
+
+ TMap* m = dynamic_cast<TMap*>(entry->GetObject()); // old GRP entry
+
+ if (m) {
+ AliInfo("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
+ }
+
+ entry->SetOwner(0);
+ AliCDBManager::Instance()->UnloadFromCache("GRP/GRP/Data");
}
- TObjString *lhcState=
- dynamic_cast<TObjString*>(data->GetValue("fLHCState"));
- if (!lhcState) {
- AliWarning(Form("%s entry: missing value for the LHC state ! Using UNKNOWN", AliQA::GetGRPPath().Data()));
+
+ if (!grpObject) {
+ AliFatal("No GRP entry found in OCDB!");
}
- TObjString *beamType=
- dynamic_cast<TObjString*>(data->GetValue("fAliceBeamType"));
- if (!beamType) {
- AliWarning(Form("%s entry: missing value for the LHC state ! Using UNKNOWN", AliQA::GetGRPPath().Data()));
+
+ 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";
}
- TObjString *runType=
- dynamic_cast<TObjString*>(data->GetValue("fRunType"));
- if (!runType) {
- AliWarning(Form("%s entry: missing value for the run type ! Using UNKNOWN", AliQA::GetGRPPath().Data())); }
- TObjString *activeDetectors=
- dynamic_cast<TObjString*>(data->GetValue("fDetectorMask"));
- if (!activeDetectors) {
- AliWarning(Form("%s entry: missing value for the detector mask ! Using ALL", AliQA::GetGRPPath().Data()));
+
+ Int_t activeDetectors = grpObject->GetDetectorMask();
+ if (activeDetectors==AliGRPObject::GetInvalidInt()) {
+ AliError("GRP/GRP/Data entry: missing value for the detector mask ! Using 1074790399");
+ activeDetectors = 1074790399;
}
- fEventInfo = new AliEventInfo(lhcState ? lhcState->GetString().Data() : "UNKNOWN",
- beamType ? beamType->GetString().Data() : "UNKNOWN",
- runType ? runType->GetString().Data() : "UNKNOWN",
- activeDetectors ? activeDetectors->GetString().Data() : "ALL");
- fEventInfoOwner = kTRUE ;
+
+ fRunInfo = new AliRunInfo(lhcState, beamType, beamEnergy, runType, activeDetectors);
+
+ fRunInfoOwner = kTRUE ;
}
//_____________________________________________________________________________
}
//_____________________________________________________________________________
-Bool_t AliQAChecker::Run(AliQA::DETECTORINDEX_t det, AliQA::TASKINDEX_t task, TObjArray * list)
+Bool_t AliQAChecker::Run(AliQA::DETECTORINDEX_t det, AliQA::TASKINDEX_t task, TObject * obj)
{
// run the Quality Assurance Checker for detector det, for task task starting from data in list
GetRefSubDir(AliQA::GetDetName(det), AliQA::GetTaskName(task), refDir, refOCDBDir) ;
if ( refDir || refOCDBDir) // references found
qac->SetRefandData(refDir, refOCDBDir) ;
- qac->Run(index, list) ;
+
+ TString className(obj->ClassName()) ;
+ if (className.Contains(TObjArray::Class()->GetName())) {
+ qac->Run(index, static_cast<TObjArray *>(obj)) ;
+ } else if (className.Contains(TNtupleD::Class()->GetName())) {
+ qac->Run(index, static_cast<TNtupleD *>(obj)) ;
+ } else {
+ AliError(Form("%s class not implemented", className.Data())) ;
+ return kFALSE ;
+ }
return kTRUE ;
}
-
-
-