#include <TROOT.h>
#include <TString.h>
#include <TSystem.h>
+#include <TStopwatch.h>
#include "AliCDBManager.h"
#include "AliCDBEntry.h"
delete fRawReader ;
fRawReader = NULL ;
}
- TCanvas fakeCanvas ;
- if (fPrintImage)
- fakeCanvas.Print(Form("%s%s%d.%s]", AliQAv1::GetImageFileName(), GetMode(), fRunNumber, AliQAv1::GetImageFileFormat()));
}
-
//_____________________________________________________________________________
Bool_t AliQAManager::DoIt(const AliQAv1::TASKINDEX_t taskIndex)
{
}
break ;
case AliQAv1::kSDIGITS :
- if( loader ) {
- loader->LoadSDigits() ;
- data = loader->TreeS() ;
- if ( ! data ) {
- AliWarning(Form(" SDigit Tree not found for %s", AliQAv1::GetDetName(iDet))) ;
- break ;
- }
- qadm->Exec(taskIndex, data) ;
+ {
+
+ TString fileName(Form("%s.SDigits.root", AliQAv1::GetDetName(iDet))) ;
+ if (gSystem->FindFile("./", fileName)) {
+ if( loader ) {
+ loader->LoadSDigits() ;
+ data = loader->TreeS() ;
+ if ( ! data ) {
+ AliWarning(Form(" SDigit Tree not found for %s", AliQAv1::GetDetName(iDet))) ;
+ break ;
+ }
+ qadm->Exec(taskIndex, data) ;
+ }
}
+ }
break;
case AliQAv1::kDIGITS :
if( loader ) {
} // event loop
// Save QA data for all detectors
- rv = Finish(taskIndex) ;
+ EndOfCycle() ;
if ( taskIndex == AliQAv1::kRAWS )
fRawReader->RewindEvents() ;
if ( AliRecoParam::Convert(qadm->GetRecoParam()->GetEventSpecie()) != AliRecoParam::kDefault)
qadm->SetEventSpecie(qadm->GetRecoParam()->GetEventSpecie()) ;
- } else if (iDet == AliQAv1::kGLOBAL) { //Global QA
+ } else if (iDet == AliQAv1::kGLOBAL && strcmp(GetMode(), AliQAv1::GetModeName(AliQAv1::kRECMODE)) == 0) { //Global QA
qadm = new AliGlobalQADataMaker();
qadm->SetName(AliQAv1::GetDetName(iDet));
if ( AliRecoParam::Convert(qadm->GetRecoParam()->GetEventSpecie()) != AliRecoParam::kDefault)
qadm->SetEventSpecie(qadm->GetRecoParam()->GetEventSpecie()) ;
- } else if (iDet == AliQAv1::kCORR && strcmp(GetMode(), "Rec") == 0 ) { //the data maker for correlations among detectors
+ } else if (iDet == AliQAv1::kCORR && strcmp(GetMode(), AliQAv1::GetModeName(AliQAv1::kRECMODE)) == 0 ) { //the data maker for correlations among detectors
qadm = new AliCorrQADataMakerRec(fQADataMaker) ;
qadm->SetName(AliQAv1::GetDetName(iDet));
qadm->SetUniqueID(iDet);
if ( AliRecoParam::Convert(qadm->GetRecoParam()->GetEventSpecie()) != AliRecoParam::kDefault)
qadm->SetEventSpecie(qadm->GetRecoParam()->GetEventSpecie()) ;
- } else if ( iDet < AliQAv1::kHLT ) {
-
+ } else if ( iDet < AliQAv1::kGLOBAL ) {
+ TString smode(GetMode()) ;
+ if (smode.Contains(AliQAv1::GetModeName(AliQAv1::kQAMODE)))
+ smode = AliQAv1::GetModeName(AliQAv1::kRECMODE) ;
// load the QA data maker object
TPluginManager* pluginManager = gROOT->GetPluginManager() ;
TString detName = AliQAv1::GetDetName(iDet) ;
- TString qadmName = "Ali" + detName + "QADataMaker" + GetMode() ;
+ TString qadmName = "Ali" + detName + "QADataMaker" + smode ;
// first check if a plugin is defined for the quality assurance data maker
TPluginHandler* pluginHandler = pluginManager->FindHandler("AliQADataMaker", detName) ;
if (!pluginHandler) {
AliDebug(AliQAv1::GetQADebugLevel(), Form("defining plugin for %s", qadmName.Data())) ;
TString libs = gSystem->GetLibraries() ;
- TString temp(GetMode()) ;
+ TString temp(smode) ;
temp.ToLower() ;
- if (libs.Contains("lib" + detName + GetMode() + ".so") || (gSystem->Load("lib" + detName + temp.Data() + ".so") >= 0)) {
+ if (libs.Contains("lib" + detName + smode + ".so") || (gSystem->Load("lib" + detName + temp.Data() + ".so") >= 0)) {
pluginManager->AddHandler("AliQADataMaker", detName, qadmName, detName + "qadm", qadmName + "()") ;
} else {
pluginManager->AddHandler("AliQADataMaker", detName, qadmName, detName, qadmName + "()") ;
// End of cycle QADataMakers
AliQAChecker::Instance()->SetRunNumber(fRunNumber) ;
- if (fPrintImage) {
- TCanvas fakeCanvas ;
- fakeCanvas.Print(Form("%s%s%d.%s[", AliQAv1::GetImageFileName(), GetMode(), fRunNumber, AliQAv1::GetImageFileFormat())) ;
- }
+ TCanvas fakeCanvas ;
+
+ fakeCanvas.Print(Form("%s%s%d.%s[", AliQAv1::GetImageFileName(), GetMode(), fRunNumber, AliQAv1::GetImageFileFormat()), "ps") ;
for (UInt_t iDet = 0; iDet < fgkNDetectors ; iDet++) {
if (IsSelected(AliQAv1::GetDetName(iDet))) {
AliQADataMaker * qadm = GetQADataMaker(iDet) ;
- AliQACheckerBase * qac = AliQAChecker::Instance()->GetDetQAChecker(iDet) ;
if (!qadm)
continue ;
// skip non active detectors
if (!det || !det->IsActive())
continue ;
}
- qac->SetPrintImage(fPrintImage) ;
-
- if (IsSaveData()) {
- for (UInt_t taskIndex = 0; taskIndex < AliQAv1::kNTASKINDEX; taskIndex++) {
- if ( fTasks.Contains(Form("%d", taskIndex)) )
- qadm->EndOfCycle(AliQAv1::GetTaskIndex(AliQAv1::GetTaskName(taskIndex))) ;
- }
+ AliQACheckerBase * qac = AliQAChecker::Instance()->GetDetQAChecker(iDet) ;
+ if (qac)
+ qac->SetPrintImage(fPrintImage) ;
+ for (UInt_t taskIndex = 0; taskIndex < AliQAv1::kNTASKINDEX; taskIndex++) {
+ if ( fTasks.Contains(Form("%d", taskIndex)) )
+ qadm->EndOfCycle(AliQAv1::GetTaskIndex(AliQAv1::GetTaskName(taskIndex))) ;
}
qadm->Finish();
}
}
+ if (fPrintImage)
+ fakeCanvas.Print(Form("%s%s%d.%s]", AliQAv1::GetImageFileName(), GetMode(), fRunNumber, AliQAv1::GetImageFileFormat()), "ps");
}
//_____________________________________________________________________________
// End of cycle QADataMakers
AliQAChecker::Instance()->SetRunNumber(fRunNumber) ;
- if (fPrintImage) {
- TCanvas fakeCanvas ;
- fakeCanvas.Print(Form("%s%s%d.%s[", AliQAv1::GetImageFileName(), GetMode(), fRunNumber, AliQAv1::GetImageFileFormat())) ;
- }
+ TCanvas fakeCanvas ;
+ if (fPrintImage)
+ fakeCanvas.Print(Form("%s%s%d.%s[", AliQAv1::GetImageFileName(), GetMode(), fRunNumber, AliQAv1::GetImageFileFormat()), "ps") ;
for (UInt_t iDet = 0; iDet < fgkNDetectors ; iDet++) {
if (IsSelected(AliQAv1::GetDetName(iDet))) {
AliQADataMaker * qadm = GetQADataMaker(iDet) ;
- AliQACheckerBase * qac = AliQAChecker::Instance()->GetDetQAChecker(iDet) ;
if (!qadm)
continue ;
// skip non active detectors
if (!detectors.Contains(AliQAv1::GetDetName(iDet)))
continue ;
- qac->SetPrintImage(fPrintImage) ;
- if (IsSaveData()) {
- for (UInt_t taskIndex = 0; taskIndex < AliQAv1::kNTASKINDEX; taskIndex++) {
- if ( fTasks.Contains(Form("%d", taskIndex)) )
- qadm->EndOfCycle(AliQAv1::GetTaskIndex(AliQAv1::GetTaskName(taskIndex))) ;
- }
+ AliQACheckerBase * qac = AliQAChecker::Instance()->GetDetQAChecker(iDet) ;
+ if (qac)
+ qac->SetPrintImage(fPrintImage) ;
+ for (UInt_t taskIndex = 0; taskIndex < AliQAv1::kNTASKINDEX; taskIndex++) {
+ if ( fTasks.Contains(Form("%d", taskIndex)) )
+ qadm->EndOfCycle(AliQAv1::GetTaskIndex(AliQAv1::GetTaskName(taskIndex))) ;
}
qadm->Finish();
}
}
+ if (fPrintImage)
+ fakeCanvas.Print(Form("%s%s%d.%s]", AliQAv1::GetImageFileName(), GetMode(), fRunNumber, AliQAv1::GetImageFileFormat()), "ps");
+}
+
+//_____________________________________________________________________________
+AliRecoParam::EventSpecie_t AliQAManager::GetEventSpecieFromESD()
+{
+ AliRecoParam::EventSpecie_t runtype = AliRecoParam::kDefault ;
+ if (!gSystem->AccessPathName("AliESDs.root")) { // AliESDs.root exists
+ TFile * esdFile = TFile::Open("AliESDs.root") ;
+ TTree * esdTree = static_cast<TTree *> (esdFile->Get("esdTree")) ;
+ if ( !esdTree ) {
+ AliError("esdTree not found") ;
+ } else {
+ AliESDEvent * esd = new AliESDEvent() ;
+ esd->ReadFromTree(esdTree) ;
+ esdTree->GetEntry(0) ;
+ runtype = AliRecoParam::Convert(esd->GetEventType()) ;
+ }
+ } else {
+ AliError("AliESDs.root not found") ;
+ }
+ return runtype ;
}
//_____________________________________________________________________________
InitQADataMaker(fRunNumber, detArray) ; //, fCycleSame, kTRUE, detArray) ;
if (fPrintImage) {
TCanvas fakeCanvas ;
- fakeCanvas.Print(Form("%s%s%d.%s[", AliQAv1::GetImageFileName(), GetMode(), fRunNumber, AliQAv1::GetImageFileFormat())) ;
+ TStopwatch timer ;
+ timer.Start() ;
+ while (timer.CpuTime()<5) {
+ timer.Continue();
+ gSystem->ProcessEvents();
+ }
+ fakeCanvas.Print(Form("%s%s%d.%s[", AliQAv1::GetImageFileName(), GetMode(), fRunNumber, AliQAv1::GetImageFileFormat()), "ps") ;
}
return kTRUE ;
}
Bool_t rv = kFALSE;
const TString detName(det) ;
// always activates Correlation
- if ( detName.Contains(AliQAv1::GetDetName(AliQAv1::kCORR))) {
+ if ( detName.Contains(AliQAv1::GetDetName(AliQAv1::kCORR)) || detName.Contains(AliQAv1::GetDetName(AliQAv1::kGLOBAL))) {
rv = kTRUE ;
} else {
// check if all detectors are selected
for (UInt_t iDet = 0; iDet < fgkNDetectors ; iDet++) {
Char_t * file = gSystem->Which(gSystem->WorkingDirectory(), Form("%s.%s.%d.root", AliQAv1::GetDetName(iDet), AliQAv1::GetQADataFileName(), runNumber));
if (file)
- merger.AddFile(file) ;
+ merger.AddFile(file);
+ delete[] file;
}
merger.Merge() ;
return kTRUE ;
for (UInt_t iDet = 0; iDet < fgkNDetectors ; iDet++) {
if (IsSelected(AliQAv1::GetDetName(iDet))) {
AliQADataMaker * qadm = GetQADataMaker(iDet);
- qadm->Reset();
+ if (qadm)
+ qadm->Reset();
}
}
if (fRawReaderDelete) {
fNumberOfEvents = 999999 ;
}
+//_____________________________________________________________________________
+void AliQAManager::ResetDetectors(AliQAv1::TASKINDEX_t task, AliQAv1::DETECTORINDEX_t det)
+{
+ //calls ResetDetector of specified or all detectors
+ UInt_t iDet = 0 ;
+ UInt_t iDetMax = fgkNDetectors ;
+ if ( det != AliQAv1::kNULLDET ) {
+ iDet = det ;
+ iDetMax = det+1 ;
+ }
+
+ for (iDet = 0; iDet < iDetMax ; iDet++) {
+ if (IsSelected(AliQAv1::GetDetName(iDet))) {
+ AliQADataMaker * qadm = GetQADataMaker(iDet);
+ qadm->ResetDetector(task);
+ }
+ }
+}
+
//_____________________________________________________________________________
AliQAManager * AliQAManager::QAManager(AliQAv1::MODE_t mode, TMap *entryCache, Int_t run)
{
// returns AliQAManager instance (singleton)
if (!fgQAInstance) {
- if ( (mode != AliQAv1::kSIMMODE) && (mode != AliQAv1::kRECMODE) ) {
- AliErrorClass("You must specify kSIMMODE or kRECMODE") ;
+ if ( (mode != AliQAv1::kSIMMODE) && (mode != AliQAv1::kRECMODE) && (mode != AliQAv1::kQAMODE) ) {
+ AliWarningClass("You must specify kSIMMODE or kRECMODE or kQAMODE") ;
return NULL ;
}
fgQAInstance = new AliQAManager(mode) ;
//Runs all the QA data Maker for Raws only and on one event only (event loop done by calling method)
if ( ! rawReader )
return ;
- AliCodeTimerAuto("",0) ;
if (fTasks.Contains(Form("%d", AliQAv1::kRAWS))){
for (UInt_t iDet = 0; iDet < fgkNDetectors; iDet++) {
if (!IsSelected(AliQAv1::GetDetName(iDet)))
if ( qadm->IsCycleDone() ) {
qadm->EndOfCycle() ;
}
- AliCodeTimerStart(Form("running RAW quality assurance data maker for %s", AliQAv1::GetDetName(iDet)));
qadm->SetEventSpecie(fEventSpecie) ;
if ( qadm->GetRecoParam() )
if ( AliRecoParam::Convert(qadm->GetRecoParam()->GetEventSpecie()) != AliRecoParam::kDefault)
qadm->SetEventSpecie(qadm->GetRecoParam()->GetEventSpecie()) ;
qadm->Exec(AliQAv1::kRAWS, rawReader) ;
- AliCodeTimerStop(Form("running RAW quality assurance data maker for %s", AliQAv1::GetDetName(iDet)));
}
}
}
//_____________________________________________________________________________
-void AliQAManager::RunOneEvent(AliESDEvent *& esd)
+void AliQAManager::RunOneEvent(AliESDEvent *& esd, AliESDEvent *& hltesd)
{
//Runs all the QA data Maker for ESDs only and on one event only (event loop done by calling method)
- AliCodeTimerAuto("",0) ;
if (fTasks.Contains(Form("%d", AliQAv1::kESDS))) {
for (UInt_t iDet = 0; iDet < fgkNDetectors; iDet++) {
if (!IsSelected(AliQAv1::GetDetName(iDet)))
if ( qadm->IsCycleDone() ) {
qadm->EndOfCycle() ;
}
- AliCodeTimerStart(Form("running ESD quality assurance data maker for %s", AliQAv1::GetDetName(iDet)));
- qadm->Exec(AliQAv1::kESDS, esd) ;
- AliCodeTimerStop(Form("running ESD quality assurance data maker for %s", AliQAv1::GetDetName(iDet)));
+ if (iDet == AliQAv1::kHLT) {
+ TObjArray esdarray;
+ esdarray.Add(esd);
+ esdarray.Add(hltesd);
+ qadm->Exec(AliQAv1::kESDS, &esdarray);
+ } else {
+ qadm->Exec(AliQAv1::kESDS, esd) ;
+ }
}
}
}
// Runs all the QA data Maker for ESDs only and on one event only (event loop done by calling method)
TString test(tree->GetName()) ;
- AliCodeTimerAuto("",0) ;
if (fTasks.Contains(Form("%d", AliQAv1::kRECPOINTS))) {
if (IsSelected(AliQAv1::GetDetName(det))) {
AliQADataMaker *qadm = GetQADataMaker(det);
if (qadm) {
qadm->SetEventSpecie(fEventSpecie) ;
- if ( qadm->GetRecoParam() )
+ if ( qadm->GetRecoParam() ) {
if ( AliRecoParam::Convert(qadm->GetRecoParam()->GetEventSpecie()) != AliRecoParam::kDefault)
- qadm->SetEventSpecie(qadm->GetRecoParam()->GetEventSpecie()) ;
+ qadm->SetEventSpecie(qadm->GetRecoParam()->GetEventSpecie()) ;
+ else
+ AliError(Form("%d defined by %s is not an event specie", qadm->GetRecoParam()->GetEventSpecie(), qadm->GetName())) ;
+ }
if ( qadm->IsCycleDone() ) {
qadm->EndOfCycle() ;
}
- AliCodeTimerStart(Form("running RecPoints quality assurance data maker for %s", AliQAv1::GetDetName(det)));
if (test.Contains("TreeD")) {
qadm->Exec(AliQAv1::kDIGITSR, tree) ;
} else if (test.Contains("TreeR")) {
qadm->Exec(AliQAv1::kRECPOINTS, tree) ;
- AliCodeTimerStop(Form("running RecPoints quality assurance data maker for %s", AliQAv1::GetDetName(det)));
}
}
}
return rv ;
}
+//_____________________________________________________________________________
+
+void AliQAManager::SetCheckerExternParam(AliQAv1::DETECTORINDEX_t detIndex, TList * parameterList)
+{
+ // set the external parameters list for the detector checkers
+ AliQACheckerBase * qac = AliQAChecker::Instance()->GetDetQAChecker(detIndex) ;
+ qac->SetExternParamlist(parameterList) ;
+ qac->PrintExternParam() ;
+}
+
//_____________________________________________________________________________
void AliQAManager::SetEventSpecie(AliRecoParam::EventSpecie_t es)
{