X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=STEER%2FAliQAManager.cxx;h=323674e5df25151a23ccdad1cef8b7857a122d7e;hb=b16d72b108c1fa7332539de182faa83691989f9c;hp=8d7ea4afd7bb001088a5207c770cf9625aea10e4;hpb=4e25ac795836afea113484651fe7e4a9d3d2c95a;p=u%2Fmrichter%2FAliRoot.git diff --git a/STEER/AliQAManager.cxx b/STEER/AliQAManager.cxx index 8d7ea4afd7b..323674e5df2 100644 --- a/STEER/AliQAManager.cxx +++ b/STEER/AliQAManager.cxx @@ -18,16 +18,17 @@ // // // class for running the QA makers // // // -// AliQAManager qas; // -// qas.Run(AliQAv1::kRAWS, rawROOTFileName); // -// qas.Run(AliQAv1::kHITS); // -// qas.Run(AliQAv1::kSDIGITS); // -// qas.Run(AliQAv1::kDIGITS); // -// qas.Run(AliQAv1::kRECPOINTS); // -// qas.Run(AliQAv1::kESDS); // +// AliQAManager qas; // +// qas.Run(AliQAv1::kRAWS, rawROOTFileName); // +// qas.Run(AliQAv1::kHITS); // +// qas.Run(AliQAv1::kSDIGITS); // +// qas.Run(AliQAv1::kDIGITS); // +// qas.Run(AliQAv1::kRECPOINTS); // +// qas.Run(AliQAv1::kESDS); // // // /////////////////////////////////////////////////////////////////////////////// +#include #include #include #include @@ -85,8 +86,9 @@ AliQAManager::AliQAManager() : fRawReader(NULL), fRawReaderDelete(kTRUE), fRunLoader(NULL), - fTasks(""), - fEventSpecie(AliRecoParam::kDefault) + fTasks(""), + fEventSpecie(AliRecoParam::kDefault), + fPrintImage(kTRUE) { // default ctor fMaxEvents = fNumberOfEvents ; @@ -120,7 +122,8 @@ AliQAManager::AliQAManager(const Char_t * mode, const Char_t* gAliceFilename) : fRawReaderDelete(kTRUE), fRunLoader(NULL), fTasks(""), - fEventSpecie(AliRecoParam::kDefault) + fEventSpecie(AliRecoParam::kDefault), + fPrintImage(kTRUE) { // default ctor fMaxEvents = fNumberOfEvents ; @@ -132,6 +135,11 @@ AliQAManager::AliQAManager(const Char_t * mode, const Char_t* gAliceFilename) : } } SetWriteExpert() ; + fMode.ToLower() ; + if (fMode.Contains("sim")) + fMode.ReplaceAll("s", "S") ; + else if (fMode.Contains("rec")) + fMode.ReplaceAll("r", "R") ; } //_____________________________________________________________________________ @@ -153,8 +161,10 @@ AliQAManager::AliQAManager(const AliQAManager & qas) : fRawReader(NULL), fRawReaderDelete(kTRUE), fRunLoader(NULL), - fTasks(qas.fTasks), - fEventSpecie(qas.fEventSpecie) + fTasks(qas.fTasks), + fEventSpecie(qas.fEventSpecie), + fPrintImage(qas.fPrintImage) + { // cpy ctor for (UInt_t iDet = 0; iDet < fgkNDetectors; iDet++) { @@ -192,6 +202,9 @@ AliQAManager::~AliQAManager() delete fRawReader ; fRawReader = NULL ; } + TCanvas fakeCanvas ; + if (fPrintImage) + fakeCanvas.Print(Form("%s%s%d.%s]", AliQAv1::GetImageFileName(), GetMode(), fRunNumber, AliQAv1::GetImageFileFormat())); } //_____________________________________________________________________________ @@ -205,7 +218,7 @@ Bool_t AliQAManager::DoIt(const AliQAv1::TASKINDEX_t taskIndex) fCurrentEvent++ ; // Get the event if ( iEvent%10 == 0 ) - AliInfo(Form("processing event %d", iEvent)); + AliDebug(AliQAv1::GetQADebugLevel(), Form("processing event %d", iEvent)); if ( taskIndex == AliQAv1::kRAWS ) { if ( !fRawReader->NextEvent() ) break ; @@ -240,8 +253,8 @@ Bool_t AliQAManager::DoIt(const AliQAv1::TASKINDEX_t taskIndex) AliWarning(Form(" Hit Tree not found for %s", AliQAv1::GetDetName(iDet))) ; break ; } + qadm->Exec(taskIndex, data) ; } - qadm->Exec(taskIndex, data) ; break ; case AliQAv1::kSDIGITS : if( loader ) { @@ -251,19 +264,30 @@ Bool_t AliQAManager::DoIt(const AliQAv1::TASKINDEX_t taskIndex) AliWarning(Form(" SDigit Tree not found for %s", AliQAv1::GetDetName(iDet))) ; break ; } + qadm->Exec(taskIndex, data) ; } - qadm->Exec(taskIndex, data) ; break; case AliQAv1::kDIGITS : - if( loader ) { - loader->LoadDigits() ; - data = loader->TreeD() ; - if ( ! data ) { - AliWarning(Form(" Digit Tree not found for %s", AliQAv1::GetDetName(iDet))) ; - break ; - } - } - qadm->Exec(taskIndex, data) ; + if( loader ) { + loader->LoadDigits() ; + data = loader->TreeD() ; + if ( ! data ) { + AliWarning(Form(" Digit Tree not found for %s", AliQAv1::GetDetName(iDet))) ; + break ; + } + qadm->Exec(taskIndex, data) ; + } + break; + case AliQAv1::kDIGITSR : + if( loader ) { + loader->LoadDigits() ; + data = loader->TreeD() ; + if ( ! data ) { + AliWarning(Form(" Digit Tree not found for %s", AliQAv1::GetDetName(iDet))) ; + break ; + } + qadm->Exec(taskIndex, data) ; + } break; case AliQAv1::kRECPOINTS : if( loader ) { @@ -273,8 +297,8 @@ Bool_t AliQAManager::DoIt(const AliQAv1::TASKINDEX_t taskIndex) AliWarning(Form("RecPoints not found for %s", AliQAv1::GetDetName(iDet))) ; break ; } + qadm->Exec(taskIndex, data) ; } - qadm->Exec(taskIndex, data) ; break; case AliQAv1::kTRACKSEGMENTS : break; @@ -314,7 +338,7 @@ Bool_t AliQAManager::Finish(const AliQAv1::TASKINDEX_t taskIndex) } //_____________________________________________________________________________ -TObjArray * AliQAManager::GetFromOCDB(AliQAv1::DETECTORINDEX_t det, AliQAv1::TASKINDEX_t task, const char * year) const +TObjArray * AliQAManager::GetFromOCDB(AliQAv1::DETECTORINDEX_t det, AliQAv1::TASKINDEX_t task, const Char_t * year) const { // Retrieve the list of QA data for a given detector and a given task TObjArray * rv = NULL ; @@ -330,20 +354,31 @@ TObjArray * AliQAManager::GetFromOCDB(AliQAv1::DETECTORINDEX_t det, AliQAv1::TAS Instance()->SetSpecificStorage(Form("%s/*", AliQAv1::GetQAName()), AliQAv1::GetQARefStorage()) ; } TString detOCDBDir(Form("%s/%s/%s", AliQAv1::GetQAName(), AliQAv1::GetDetName((Int_t)det), AliQAv1::GetRefOCDBDirName())) ; - AliInfo(Form("Retrieving reference data from %s/%s for %s", AliQAv1::GetQARefStorage(), detOCDBDir.Data(), AliQAv1::GetTaskName(task).Data())) ; + AliDebug(AliQAv1::GetQADebugLevel(), Form("Retrieving reference data from %s/%s for %s", AliQAv1::GetQARefStorage(), detOCDBDir.Data(), AliQAv1::GetTaskName(task).Data())) ; AliCDBEntry* entry = QAManager()->Get(detOCDBDir.Data(), 0) ; //FIXME 0 --> Run Number - TList * listDetQAD = dynamic_cast(entry->GetObject()) ; + TList * listDetQAD = static_cast(entry->GetObject()) ; if ( listDetQAD ) - rv = dynamic_cast(listDetQAD->FindObject(AliQAv1::GetTaskName(task))) ; + rv = static_cast(listDetQAD->FindObject(AliQAv1::GetTaskName(task))) ; return rv ; } +//_____________________________________________________________________________ +TCanvas ** AliQAManager::GetImage(Char_t * detName) +{ + // retrieves QA Image for the given detector + TCanvas ** rv = NULL ; + Int_t detIndex = AliQAv1::GetDetIndex(detName) ; + AliQADataMaker * qadm = GetQADataMaker(detIndex) ; + rv = qadm->GetImage() ; + return rv ; +} + //_____________________________________________________________________________ AliLoader * AliQAManager::GetLoader(Int_t iDet) { // get the loader for a detector - if ( !fRunLoader || iDet == AliQAv1::kCORR) + if ( !fRunLoader || iDet == AliQAv1::kCORR || iDet == AliQAv1::kGLOBAL ) return NULL ; TString detName = AliQAv1::GetDetName(iDet) ; @@ -360,7 +395,7 @@ AliLoader * AliQAManager::GetLoader(Int_t iDet) TPluginHandler* pluginHandler = pluginManager->FindHandler("AliLoader", detName) ; // if not, add a plugin for it if (!pluginHandler) { - AliDebug(1, Form("defining plugin for %s", loaderName.Data())) ; + AliDebug(AliQAv1::GetQADebugLevel(), Form("defining plugin for %s", loaderName.Data())) ; TString libs = gSystem->GetLibraries() ; if (libs.Contains("lib" + detName + "base.so") || (gSystem->Load("lib" + detName + "base.so") >= 0)) { pluginManager->AddHandler("AliQADataMaker", detName, loaderName, detName + "loader", loaderName + "()") ; @@ -381,13 +416,13 @@ AliLoader * AliQAManager::GetLoader(Int_t iDet) AliQAv1 * AliQAManager::GetQA(UInt_t run, UInt_t evt) { // retrieves the QA object stored in a file named "Run{run}.Event{evt}_1.ESD.tag.root" - char * fileName = Form("Run%d.Event%d_1.ESD.tag.root", run, evt) ; + Char_t * fileName = Form("Run%d.Event%d_1.ESD.tag.root", run, evt) ; TFile * tagFile = TFile::Open(fileName) ; if ( !tagFile ) { AliError(Form("File %s not found", fileName)) ; return NULL ; } - TTree * tagTree = dynamic_cast(tagFile->Get("T")) ; + TTree * tagTree = static_cast(tagFile->Get("T")) ; if ( !tagTree ) { AliError(Form("Tree T not found in %s", fileName)) ; tagFile->Close() ; @@ -406,65 +441,71 @@ AliQADataMaker * AliQAManager::GetQADataMaker(const Int_t iDet) { // get the quality assurance data maker for a detector - if (fQADataMaker[iDet]) { - fQADataMaker[iDet]->SetEventSpecie(fEventSpecie) ; - return fQADataMaker[iDet] ; - } - - AliQADataMaker * qadm = NULL ; - - if (iDet == AliQAv1::kGLOBAL) { //Global QA + AliQADataMaker * qadm = fQADataMaker[iDet] ; + + if (qadm) { + + qadm->SetEventSpecie(fEventSpecie) ; + if ( qadm->GetRecoParam() ) + if ( AliRecoParam::Convert(qadm->GetRecoParam()->GetEventSpecie()) != AliRecoParam::kDefault) + qadm->SetEventSpecie(qadm->GetRecoParam()->GetEventSpecie()) ; + + } else if (iDet == AliQAv1::kGLOBAL) { //Global QA + qadm = new AliGlobalQADataMaker(); qadm->SetName(AliQAv1::GetDetName(iDet)); qadm->SetUniqueID(iDet); fQADataMaker[iDet] = qadm; - qadm->SetEventSpecie(fEventSpecie) ; - return qadm; - } + qadm->SetEventSpecie(fEventSpecie) ; + if ( qadm->GetRecoParam() ) + if ( AliRecoParam::Convert(qadm->GetRecoParam()->GetEventSpecie()) != AliRecoParam::kDefault) + qadm->SetEventSpecie(qadm->GetRecoParam()->GetEventSpecie()) ; - if (iDet == AliQAv1::kCORR) { //the data maker for correlations among detectors + } else if (iDet == AliQAv1::kCORR && strcmp(GetMode(), "Rec") == 0 ) { //the data maker for correlations among detectors qadm = new AliCorrQADataMakerRec(fQADataMaker) ; qadm->SetName(AliQAv1::GetDetName(iDet)); qadm->SetUniqueID(iDet); fQADataMaker[iDet] = qadm; - qadm->SetEventSpecie(fEventSpecie) ; - return qadm; - } - - // load the QA data maker object - TPluginManager* pluginManager = gROOT->GetPluginManager() ; - TString detName = AliQAv1::GetDetName(iDet) ; - TString tmp(fMode) ; - if (tmp.Contains("sim")) - tmp.ReplaceAll("s", "S") ; - else if (tmp.Contains("rec")) - tmp.ReplaceAll("r", "R") ; - - TString qadmName = "Ali" + detName + "QADataMaker" + tmp ; - - // first check if a plugin is defined for the quality assurance data maker - TPluginHandler* pluginHandler = pluginManager->FindHandler("AliQADataMaker", detName) ; - // if not, add a plugin for it - if (!pluginHandler) { - AliDebug(1, Form("defining plugin for %s", qadmName.Data())) ; - TString libs = gSystem->GetLibraries() ; - if (libs.Contains("lib" + detName + fMode + ".so") || (gSystem->Load("lib" + detName + fMode + ".so") >= 0)) { - pluginManager->AddHandler("AliQADataMaker", detName, qadmName, detName + "qadm", qadmName + "()") ; - } else { - pluginManager->AddHandler("AliQADataMaker", detName, qadmName, detName, qadmName + "()") ; - } - pluginHandler = pluginManager->FindHandler("AliQADataMaker", detName) ; - } - if (pluginHandler && (pluginHandler->LoadPlugin() == 0)) { - qadm = (AliQADataMaker *) pluginHandler->ExecPlugin(0) ; - } - if (qadm) { - qadm->SetName(AliQAv1::GetDetName(iDet)); - qadm->SetUniqueID(iDet); - fQADataMaker[iDet] = qadm ; - qadm->SetEventSpecie(fEventSpecie) ; - } + qadm->SetEventSpecie(fEventSpecie) ; + if ( qadm->GetRecoParam() ) + if ( AliRecoParam::Convert(qadm->GetRecoParam()->GetEventSpecie()) != AliRecoParam::kDefault) + qadm->SetEventSpecie(qadm->GetRecoParam()->GetEventSpecie()) ; + } else if ( iDet < AliQAv1::kHLT ) { + + // load the QA data maker object + TPluginManager* pluginManager = gROOT->GetPluginManager() ; + TString detName = AliQAv1::GetDetName(iDet) ; + TString qadmName = "Ali" + detName + "QADataMaker" + GetMode() ; + + // first check if a plugin is defined for the quality assurance data maker + TPluginHandler* pluginHandler = pluginManager->FindHandler("AliQADataMaker", detName) ; + // if not, add a plugin for it + if (!pluginHandler) { + AliDebug(AliQAv1::GetQADebugLevel(), Form("defining plugin for %s", qadmName.Data())) ; + TString libs = gSystem->GetLibraries() ; + TString temp(GetMode()) ; + temp.ToLower() ; + if (libs.Contains("lib" + detName + GetMode() + ".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 + "()") ; + } + pluginHandler = pluginManager->FindHandler("AliQADataMaker", detName) ; + } + if (pluginHandler && (pluginHandler->LoadPlugin() == 0)) { + qadm = (AliQADataMaker *) pluginHandler->ExecPlugin(0) ; + } + if (qadm) { + qadm->SetName(AliQAv1::GetDetName(iDet)); + qadm->SetUniqueID(iDet); + fQADataMaker[iDet] = qadm ; + qadm->SetEventSpecie(fEventSpecie) ; + if ( qadm->GetRecoParam() ) + if ( AliRecoParam::Convert(qadm->GetRecoParam()->GetEventSpecie()) != AliRecoParam::kDefault) + qadm->SetEventSpecie(qadm->GetRecoParam()->GetEventSpecie()) ; + } + } return qadm ; } @@ -473,6 +514,10 @@ void AliQAManager::EndOfCycle(TObjArray * detArray) { // End of cycle QADataMakers + if (fPrintImage) { + TCanvas fakeCanvas ; + fakeCanvas.Print(Form("%s%s%d.%s[", AliQAv1::GetImageFileName(), GetMode(), fRunNumber, AliQAv1::GetImageFileFormat())) ; + } for (UInt_t iDet = 0; iDet < fgkNDetectors ; iDet++) { if (IsSelected(AliQAv1::GetDetName(iDet))) { AliQADataMaker * qadm = GetQADataMaker(iDet) ; @@ -484,6 +529,8 @@ void AliQAManager::EndOfCycle(TObjArray * detArray) if (!det || !det->IsActive()) continue ; } + qadm->SetPrintImage(fPrintImage) ; + for (UInt_t taskIndex = 0; taskIndex < AliQAv1::kNTASKINDEX; taskIndex++) { if ( fTasks.Contains(Form("%d", taskIndex)) ) qadm->EndOfCycle(AliQAv1::GetTaskIndex(AliQAv1::GetTaskName(taskIndex))) ; @@ -498,7 +545,11 @@ void AliQAManager::EndOfCycle(TString detectors) { // End of cycle QADataMakers - for (UInt_t iDet = 0; iDet < fgkNDetectors ; iDet++) { + if (fPrintImage) { + TCanvas fakeCanvas ; + fakeCanvas.Print(Form("%s%s%d.%s[", AliQAv1::GetImageFileName(), GetMode(), fRunNumber, AliQAv1::GetImageFileFormat())) ; + } + for (UInt_t iDet = 0; iDet < fgkNDetectors ; iDet++) { if (IsSelected(AliQAv1::GetDetName(iDet))) { AliQADataMaker * qadm = GetQADataMaker(iDet) ; if (!qadm) @@ -506,6 +557,7 @@ void AliQAManager::EndOfCycle(TString detectors) // skip non active detectors if (!detectors.Contains(AliQAv1::GetDetName(iDet))) continue ; + qadm->SetPrintImage(fPrintImage) ; for (UInt_t taskIndex = 0; taskIndex < AliQAv1::kNTASKINDEX; taskIndex++) { if ( fTasks.Contains(Form("%d", taskIndex)) ) qadm->EndOfCycle(AliQAv1::GetTaskIndex(AliQAv1::GetTaskName(taskIndex))) ; @@ -529,7 +581,7 @@ void AliQAManager::Increment() } //_____________________________________________________________________________ -Bool_t AliQAManager::InitQA(const AliQAv1::TASKINDEX_t taskIndex, const char * input ) +Bool_t AliQAManager::InitQA(const AliQAv1::TASKINDEX_t taskIndex, const Char_t * input ) { // Initialize the event source and QA data makers @@ -553,7 +605,7 @@ Bool_t AliQAManager::InitQA(const AliQAv1::TASKINDEX_t taskIndex, const char * fTasks = AliQAv1::GetTaskName(AliQAv1::kESDS) ; if (!gSystem->AccessPathName("AliESDs.root")) { // AliESDs.root exists TFile * esdFile = TFile::Open("AliESDs.root") ; - fESDTree = dynamic_cast (esdFile->Get("esdTree")) ; + fESDTree = static_cast (esdFile->Get("esdTree")) ; if ( !fESDTree ) { AliError("esdTree not found") ; return kFALSE ; @@ -594,6 +646,10 @@ Bool_t AliQAManager::InitQA(const AliQAv1::TASKINDEX_t taskIndex, const char * AliGeomManager::LoadGeometry() ; InitQADataMaker(fRunNumber, detArray) ; //, fCycleSame, kTRUE, detArray) ; + if (fPrintImage) { + TCanvas fakeCanvas ; + fakeCanvas.Print(Form("%s%s%d.%s[", AliQAv1::GetImageFileName(), GetMode(), fRunNumber, AliQAv1::GetImageFileFormat())) ; + } return kTRUE ; } @@ -601,6 +657,7 @@ Bool_t AliQAManager::InitQA(const AliQAv1::TASKINDEX_t taskIndex, const char * void AliQAManager::InitQADataMaker(UInt_t run, TObjArray * detArray) { // Initializes The QADataMaker for all active detectors and for all active tasks + fRunNumber = run ; for (UInt_t iDet = 0; iDet < fgkNDetectors ; iDet++) { if (IsSelected(AliQAv1::GetDetName(iDet))) { AliQADataMaker * qadm = GetQADataMaker(iDet) ; @@ -610,7 +667,7 @@ void AliQAManager::InitQADataMaker(UInt_t run, TObjArray * detArray) } else { if (fQAWriteExpert[iDet]) qadm->SetWriteExpert() ; - AliDebug(1, Form("Data Maker found for %s %d", qadm->GetName(), qadm->WriteExpert())) ; + AliDebug(AliQAv1::GetQADebugLevel(), Form("Data Maker found for %s %d", qadm->GetName(), qadm->WriteExpert())) ; // skip non active detectors if (detArray) { AliModule* det = static_cast(detArray->FindObject(AliQAv1::GetDetName(iDet))) ; @@ -681,7 +738,7 @@ Bool_t AliQAManager::InitRunLoader() } //_____________________________________________________________________________ -Bool_t AliQAManager::IsSelected(const char * det) +Bool_t AliQAManager::IsSelected(const Char_t * det) { // check whether detName is contained in detectors // if yes, it is removed from detectors @@ -707,19 +764,20 @@ Bool_t AliQAManager::IsSelected(const char * det) } //_____________________________________________________________________________ -Bool_t AliQAManager::Merge(Int_t runNumber) const +Bool_t AliQAManager::Merge(Int_t runNumber, const char *fileName) const { // Merge data from all detectors from a given run in one single file - // Merge the QA results from all the data chunks in one run + // Merge the QA results from all the data chunks in one run + // The 'fileName' is name of the output file with merged QA data if ( runNumber == -1) runNumber = fRunNumber ; - Bool_t rv = MergeData(runNumber) ; + Bool_t rv = MergeData(runNumber,fileName) ; //rv *= MergeResults(runNumber) ; // not needed for the time being return rv ; } //______________________________________________________________________ -Bool_t AliQAManager::MergeXML(const char * collectionFile, const char * subFile, const char * outFile) +Bool_t AliQAManager::MergeXML(const Char_t * collectionFile, const Char_t * subFile, const Char_t * outFile) { // merges files listed in a xml collection // usage Merge(collection, outputFile)) @@ -738,15 +796,13 @@ Bool_t AliQAManager::MergeXML(const char * collectionFile, const char * subFile, return kFALSE ; // Open the file collection - printf("*** Create Collection ***\n"); - printf("*** Wk-Dir = |%s| \n",gSystem->WorkingDirectory()); - printf("*** Coll = |%s| \n",collectionFile); + AliInfoClass(Form("*** Create Collection ***\n*** Wk-Dir = |%s| \n*** Coll = |%s| \n",gSystem->WorkingDirectory(), collectionFile)); TGridCollection * collection = (TGridCollection*)gROOT->ProcessLine(Form("TAlienCollection::Open(\"%s\")",collectionFile)); TGridResult* result = collection->GetGridResult("", 0, 0); Int_t index = 0 ; - const char * turl ; + const Char_t * turl ; TFileMerger merger(kFALSE) ; if (!outFile) { TString tempo(collectionFile) ; @@ -759,13 +815,13 @@ Bool_t AliQAManager::MergeXML(const char * collectionFile, const char * subFile, merger.OutputFile(outFile) ; while ( (turl = result->GetKey(index, "turl")) ) { - char * file ; + Char_t * file ; if ( subFile ) file = Form("%s#%s", turl, subFile) ; else file = Form("%s", turl) ; - AliInfo(Form("%s\n", file)) ; + AliDebug(AliQAv1::GetQADebugLevel(), Form("%s\n", file)) ; merger.AddFile(file) ; index++ ; } @@ -773,7 +829,7 @@ Bool_t AliQAManager::MergeXML(const char * collectionFile, const char * subFile, if (index) merger.Merge() ; - AliInfo(Form("Files merged into %s\n", outFile)) ; + AliDebug(AliQAv1::GetQADebugLevel(), Form("Files merged into %s\n", outFile)) ; rv = kFALSE; return rv ; @@ -802,7 +858,7 @@ void AliQAManager::MergeCustom() const loRun = cuRun ; if (cuRun > hiRun) hiRun = cuRun ; - while ( (srun = dynamic_cast (nextRun())) ) { + while ( (srun = static_cast (nextRun())) ) { if ( cuRun == (srun->String()).Atoi() ) { runExist = kTRUE ; break ; @@ -830,15 +886,15 @@ void AliQAManager::MergeCustom() const } } } - while ( (srun = dynamic_cast (nextRun())) ) { + while ( (srun = static_cast (nextRun())) ) { runNumber = (srun->String()).Atoi() ; hisRun->Fill(runNumber) ; - AliInfo(Form("Merging run number %d", runNumber)) ; + AliDebug(AliQAv1::GetQADebugLevel(), Form("Merging run number %d", runNumber)) ; // search all QA files for runNumber in the current directory - char * fileList[AliQAv1::kNDET] ; + Char_t * fileList[AliQAv1::kNDET] ; index = 0 ; for (Int_t iDet = 0; iDet < AliQAv1::kNDET ; iDet++) { - char * file = gSystem->Which(gSystem->WorkingDirectory(), Form("%s.%s.%d.root", AliQAv1::GetDetName(iDet), AliQAv1::GetQADataFileName(), runNumber)); + Char_t * file = gSystem->Which(gSystem->WorkingDirectory(), Form("%s.%s.%d.root", AliQAv1::GetDetName(iDet), AliQAv1::GetQADataFileName(), runNumber)); if (file) fileList[index++] = file ; } @@ -855,7 +911,7 @@ void AliQAManager::MergeCustom() const while ( (obj1 = nextkey()) ) { TDirectory * directoryDet = inFile->GetDirectory(obj1->GetName()) ; if ( directoryDet ) { -// AliInfo(Form("%s dir = %s", inFile->GetName(), directoryDet->GetName())) ; + AliDebug(AliQAv1::GetQADebugLevel(), Form("%s dir = %s", inFile->GetName(), directoryDet->GetName())) ; dirName += Form("%s/", directoryDet->GetName() ) ; directoryDet->cd() ; TList * listOfTasks = directoryDet->GetListOfKeys() ; @@ -865,7 +921,7 @@ void AliQAManager::MergeCustom() const TDirectory * directoryTask = directoryDet->GetDirectory(obj2->GetName()) ; if ( directoryTask ) { dirName += Form("%s", obj2->GetName()) ; - //AliInfo(Form("%s", dirName.Data())) ; + AliDebug(AliQAv1::GetQADebugLevel(), Form("%s", dirName.Data())) ; directoryTask->cd() ; TList * listOfEventSpecie = directoryTask->GetListOfKeys() ; TIter nextEventSpecie(listOfEventSpecie) ; @@ -874,19 +930,19 @@ void AliQAManager::MergeCustom() const TDirectory * directoryEventSpecie = directoryTask->GetDirectory(obj3->GetName()) ; if ( directoryEventSpecie ) { dirName += Form("/%s/", obj3->GetName()) ; -// AliInfo(Form("%s\n", dirName.Data())) ; + AliDebug(AliQAv1::GetQADebugLevel(), Form("%s\n", dirName.Data())) ; directoryEventSpecie->cd() ; // histograms are here TDirectory * mergedDirectory = mergedFile.GetDirectory(dirName.Data()) ; TList * listOfData = directoryEventSpecie->GetListOfKeys() ; TIter nextData(listOfData) ; TKey * key ; - while ( (key = dynamic_cast(nextData())) ) { + while ( (key = static_cast(nextData())) ) { TString className(key->GetClassName()) ; if ( className.Contains("TH") || className.Contains("TProfile") ) { - TH1 * histIn = dynamic_cast (key->ReadObj()) ; - TH1 * histOu = dynamic_cast (mergedDirectory->FindObjectAny(histIn->GetName())) ; - //AliInfo(Form("%s %x %x\n", key->GetName(), histIn, histOu)) ; + TH1 * histIn = static_cast (key->ReadObj()) ; + TH1 * histOu = static_cast (mergedDirectory->FindObjectAny(histIn->GetName())) ; + AliDebug(AliQAv1::GetQADebugLevel(), Form("%s %x %x\n", key->GetName(), histIn, histOu)) ; mergedDirectory->cd() ; if ( ! histOu ) { histIn->Write() ; @@ -902,11 +958,11 @@ void AliQAManager::MergeCustom() const TList * listOfExpertData = dirExpert->GetListOfKeys() ; TIter nextExpertData(listOfExpertData) ; TKey * keykey ; - while ( (keykey = dynamic_cast(nextExpertData())) ) { + while ( (keykey = static_cast(nextExpertData())) ) { TString classNameExpert(keykey->GetClassName()) ; if (classNameExpert.Contains("TH")) { - TH1 * histInExpert = dynamic_cast (keykey->ReadObj()) ; - TH1 * histOuExpert = dynamic_cast (mergedDirectory->FindObjectAny(histInExpert->GetName())) ; + TH1 * histInExpert = static_cast (keykey->ReadObj()) ; + TH1 * histOuExpert = static_cast (mergedDirectory->FindObjectAny(histInExpert->GetName())) ; mergedDirectoryExpert->cd() ; if ( ! histOuExpert ) { histInExpert->Write() ; @@ -938,15 +994,16 @@ void AliQAManager::MergeCustom() const } //_____________________________________________________________________________ -Bool_t AliQAManager::MergeData(const Int_t runNumber) const +Bool_t AliQAManager::MergeData(const Int_t runNumber, const char *fileName) const { // Merge QA data from all detectors for a given run in one single file - TFileMerger merger ; - TString outFileName = Form("Merged.%s.Data.root",AliQAv1::GetQADataFileName()) ; + TFileMerger merger(kFALSE) ; + TString outFileName = fileName; + if (outFileName.IsNull()) outFileName.Form("Merged.%s.Data.root",AliQAv1::GetQADataFileName()); merger.OutputFile(outFileName.Data()) ; for (UInt_t iDet = 0; iDet < fgkNDetectors ; iDet++) { - char * file = gSystem->Which(gSystem->WorkingDirectory(), Form("%s.%s.%d.root", AliQAv1::GetDetName(iDet), AliQAv1::GetQADataFileName(), runNumber)); + Char_t * file = gSystem->Which(gSystem->WorkingDirectory(), Form("%s.%s.%d.root", AliQAv1::GetDetName(iDet), AliQAv1::GetQADataFileName(), runNumber)); if (file) merger.AddFile(file) ; } @@ -972,7 +1029,7 @@ Bool_t AliQAManager::MergeResults(const Int_t runNumber) const in >> fileList[index] ; if ( !in.good() ) break ; - AliInfo(Form("index = %d file = %s", index, (fileList[index].Data()))) ; + AliDebug(AliQAv1::GetQADebugLevel(), Form("index = %d file = %s", index, (fileList[index].Data()))) ; index++ ; } @@ -1026,6 +1083,10 @@ AliQAManager * AliQAManager::QAManager(const Char_t * mode, TMap *entryCache, In // returns AliQAManager instance (singleton) if (!fgQAInstance) { + if ( (strcmp(mode, "sim") != 0) && (strcmp(mode, "rec") != 0) ) { + AliErrorClass("You must specify sim or rec") ; + return NULL ; + } fgQAInstance = new AliQAManager(mode) ; if (!entryCache) fgQAInstance->Init(); @@ -1036,7 +1097,7 @@ AliQAManager * AliQAManager::QAManager(const Char_t * mode, TMap *entryCache, In } //_____________________________________________________________________________ -TString AliQAManager::Run(const char * detectors, AliRawReader * rawReader, const Bool_t sameCycle) +TString AliQAManager::Run(const Char_t * detectors, AliRawReader * rawReader, const Bool_t sameCycle) { //Runs all the QA data Maker for Raws only @@ -1055,7 +1116,7 @@ TString AliQAManager::Run(const char * detectors, AliRawReader * rawReader, cons if (!fCycleSame) if ( !InitQA(AliQAv1::kRAWS) ) - return kFALSE ; + return "" ; fRawReaderDelete = kFALSE ; DoIt(AliQAv1::kRAWS) ; @@ -1063,7 +1124,7 @@ TString AliQAManager::Run(const char * detectors, AliRawReader * rawReader, cons } //_____________________________________________________________________________ -TString AliQAManager::Run(const char * detectors, const char * fileName, const Bool_t sameCycle) +TString AliQAManager::Run(const Char_t * detectors, const Char_t * fileName, const Bool_t sameCycle) { //Runs all the QA data Maker for Raws only @@ -1090,14 +1151,14 @@ TString AliQAManager::Run(const char * detectors, const char * fileName, const B if (!fCycleSame) if ( !InitQA(AliQAv1::kRAWS, fileName) ) - return kFALSE ; + return "" ; DoIt(AliQAv1::kRAWS) ; return fDetectorsW ; } //_____________________________________________________________________________ -TString AliQAManager::Run(const char * detectors, const AliQAv1::TASKINDEX_t taskIndex, Bool_t const sameCycle, const char * fileName ) +TString AliQAManager::Run(const Char_t * detectors, const AliQAv1::TASKINDEX_t taskIndex, Bool_t const sameCycle, const Char_t * fileName ) { // Runs all the QA data Maker for every detector @@ -1114,33 +1175,29 @@ TString AliQAManager::Run(const char * detectors, const AliQAv1::TASKINDEX_t tas rl->CdGAFile() ; rl->LoadgAlice() ; if ( ! rl->GetAliRun() ) { - AliInfo("AliRun not found in galice.root") ; + AliDebug(AliQAv1::GetQADebugLevel(), "AliRun not found in galice.root") ; } else { rl->LoadHeader() ; man->SetRun(rl->GetHeader()->GetRun()) ; } } } - - - if ( taskIndex == AliQAv1::kNULLTASKINDEX) { + if ( taskIndex == AliQAv1::kNULLTASKINDEX) { for (UInt_t task = 0; task < AliQAv1::kNTASKINDEX; task++) { if ( fTasks.Contains(Form("%d", task)) ) { if (!fCycleSame) if ( !InitQA(AliQAv1::GetTaskIndex(AliQAv1::GetTaskName(task)), fileName) ) - return kFALSE ; + return "" ; DoIt(AliQAv1::GetTaskIndex(AliQAv1::GetTaskName(task))) ; } } } else { if (! fCycleSame ) if ( !InitQA(taskIndex, fileName) ) - return kFALSE ; + return "" ; DoIt(taskIndex) ; } - return fDetectorsW ; - } //_____________________________________________________________________________ @@ -1161,7 +1218,10 @@ void AliQAManager::RunOneEvent(AliRawReader * rawReader) qadm->EndOfCycle() ; } AliCodeTimerStart(Form("running RAW quality assurance data maker for %s", AliQAv1::GetDetName(iDet))); - qadm->SetEventSpecie(fEventSpecie) ; + 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))); } @@ -1181,6 +1241,10 @@ void AliQAManager::RunOneEvent(AliESDEvent *& esd) AliQADataMaker *qadm = GetQADataMaker(iDet); if (!qadm) continue; + qadm->SetEventSpecie(fEventSpecie) ; + if ( qadm->GetRecoParam() ) + if ( AliRecoParam::Convert(qadm->GetRecoParam()->GetEventSpecie()) != AliRecoParam::kDefault) + qadm->SetEventSpecie(qadm->GetRecoParam()->GetEventSpecie()) ; if ( qadm->IsCycleDone() ) { qadm->EndOfCycle() ; } @@ -1195,24 +1259,34 @@ void AliQAManager::RunOneEvent(AliESDEvent *& esd) void AliQAManager::RunOneEventInOneDetector(Int_t det, TTree * tree) { // 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("") ; 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 ( AliRecoParam::Convert(qadm->GetRecoParam()->GetEventSpecie()) != AliRecoParam::kDefault) + qadm->SetEventSpecie(qadm->GetRecoParam()->GetEventSpecie()) ; if ( qadm->IsCycleDone() ) { qadm->EndOfCycle() ; } AliCodeTimerStart(Form("running RecPoints quality assurance data maker for %s", AliQAv1::GetDetName(det))); - qadm->Exec(AliQAv1::kRECPOINTS, tree) ; - AliCodeTimerStop(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))); + } } } } } //_____________________________________________________________________________ -Bool_t AliQAManager::Save2OCDB(const Int_t runNumber, AliRecoParam::EventSpecie_t es, const char * year, const char * detectors) const +Bool_t AliQAManager::Save2OCDB(const Int_t runNumber, AliRecoParam::EventSpecie_t es, const Char_t * year, const Char_t * detectors) const { // take the locasl QA data merge into a single file and save in OCDB Bool_t rv = kTRUE ; @@ -1248,11 +1322,11 @@ Bool_t AliQAManager::Save2OCDB(const Int_t runNumber, AliRecoParam::EventSpecie_ } //_____________________________________________________________________________ -Bool_t AliQAManager::SaveIt2OCDB(const Int_t runNumber, TFile * inputFile, const char * year, AliRecoParam::EventSpecie_t es) const +Bool_t AliQAManager::SaveIt2OCDB(const Int_t runNumber, TFile * inputFile, const Char_t * year, AliRecoParam::EventSpecie_t es) const { // reads the TH1 from file and adds it to appropriate list before saving to OCDB Bool_t rv = kTRUE ; - AliInfo(Form("Saving TH1s in %s to %s", inputFile->GetName(), AliQAv1::GetQARefStorage())) ; + AliDebug(AliQAv1::GetQADebugLevel(), Form("Saving TH1s in %s to %s", inputFile->GetName(), AliQAv1::GetQARefStorage())) ; if ( ! IsDefaultStorageSet() ) { TString tmp( AliQAv1::GetQARefStorage() ) ; if ( tmp.Contains(AliQAv1::GetLabLocalOCDB()) ) @@ -1274,7 +1348,7 @@ Bool_t AliQAManager::SaveIt2OCDB(const Int_t runNumber, TFile * inputFile, const for ( Int_t detIndex = 0 ; detIndex < AliQAv1::kNDET ; detIndex++) { TDirectory * detDir = inputFile->GetDirectory(AliQAv1::GetDetName(detIndex)) ; if ( detDir ) { - AliInfo(Form("Entering %s", detDir->GetName())) ; + AliDebug(AliQAv1::GetQADebugLevel(), Form("Entering %s", detDir->GetName())) ; AliQAv1::SetQARefDataDirName(es) ; TString detOCDBDir(Form("%s/%s/%s", AliQAv1::GetDetName(detIndex), AliQAv1::GetRefOCDBDirName(), AliQAv1::GetRefDataDirName())) ; AliCDBId idr(detOCDBDir.Data(), runNumber, AliCDBRunRange::Infinity()) ; @@ -1285,17 +1359,17 @@ Bool_t AliQAManager::SaveIt2OCDB(const Int_t runNumber, TFile * inputFile, const TList * taskList = detDir->GetListOfKeys() ; TIter nextTask(taskList) ; TKey * taskKey ; - while ( (taskKey = dynamic_cast(nextTask())) ) { + while ( (taskKey = static_cast(nextTask())) ) { TDirectory * taskDir = detDir->GetDirectory(taskKey->GetName()) ; TDirectory * esDir = taskDir->GetDirectory(AliRecoParam::GetEventSpecieName(es)) ; - AliInfo(Form("Saving %s", esDir->GetName())) ; + AliDebug(AliQAv1::GetQADebugLevel(), Form("Saving %s", esDir->GetName())) ; TObjArray * listTaskQAD = new TObjArray(100) ; listTaskQAD->SetName(Form("%s/%s", taskKey->GetName(), AliRecoParam::GetEventSpecieName(es))) ; listDetQAD->Add(listTaskQAD) ; TList * histList = esDir->GetListOfKeys() ; TIter nextHist(histList) ; TKey * histKey ; - while ( (histKey = dynamic_cast(nextHist())) ) { + while ( (histKey = static_cast(nextHist())) ) { TObject * odata = esDir->Get(histKey->GetName()) ; if ( !odata ) { AliError(Form("%s in %s/%s returns a NULL pointer !!", histKey->GetName(), detDir->GetName(), taskDir->GetName())) ; @@ -1305,23 +1379,23 @@ Bool_t AliQAManager::SaveIt2OCDB(const Int_t runNumber, TFile * inputFile, const TList * expertHistList = expertDir->GetListOfKeys() ; TIter nextExpertHist(expertHistList) ; TKey * expertHistKey ; - while ( (expertHistKey = dynamic_cast(nextExpertHist())) ) { + while ( (expertHistKey = static_cast(nextExpertHist())) ) { TObject * expertOdata = expertDir->Get(expertHistKey->GetName()) ; if ( !expertOdata ) { AliError(Form("%s in %s/%s/Expert returns a NULL pointer !!", expertHistKey->GetName(), detDir->GetName(), taskDir->GetName())) ; } else { - AliInfo(Form("Adding %s", expertHistKey->GetName())) ; + AliDebug(AliQAv1::GetQADebugLevel(), Form("Adding %s", expertHistKey->GetName())) ; if ( expertOdata->IsA()->InheritsFrom("TH1") ) { - AliInfo(Form("Adding %s", expertHistKey->GetName())) ; + AliDebug(AliQAv1::GetQADebugLevel(), Form("Adding %s", expertHistKey->GetName())) ; TH1 * hExpertdata = static_cast(expertOdata) ; listTaskQAD->Add(hExpertdata) ; } } } } - AliInfo(Form("Adding %s", histKey->GetName())) ; + AliDebug(AliQAv1::GetQADebugLevel(), Form("Adding %s", histKey->GetName())) ; if ( odata->IsA()->InheritsFrom("TH1") ) { - AliInfo(Form("Adding %s", histKey->GetName())) ; + AliDebug(AliQAv1::GetQADebugLevel(), Form("Adding %s", histKey->GetName())) ; TH1 * hdata = static_cast(odata) ; listTaskQAD->Add(hdata) ; } @@ -1338,7 +1412,7 @@ Bool_t AliQAManager::SaveIt2OCDB(const Int_t runNumber, TFile * inputFile, const void AliQAManager::SetEventSpecie(AliRecoParam::EventSpecie_t es) { // set the current event specie and inform AliQAv1 that this event specie has been encountered - fEventSpecie = es ; + fEventSpecie = es ; AliQAv1::Instance()->SetEventSpecie(es) ; } @@ -1359,3 +1433,22 @@ void AliQAManager::SetWriteExpert() fQAWriteExpert[iDet] = kTRUE ; } } + +//_____________________________________________________________________________ +void AliQAManager::Destroy() { + // delete AliQAManager instance and + // all associated objects + + if (fgQAInstance) { + delete fgQAInstance ; + fgQAInstance = NULL ; + } +} + +//_____________________________________________________________________________ +void AliQAManager::ShowQA() { + // Show the result of the QA checking + // for all detectors + for ( Int_t detIndex = 0 ; detIndex < AliQAv1::kNDET ; detIndex++) + AliQAv1::Instance(AliQAv1::GetDetIndex(AliQAv1::GetDetName(detIndex)))->Show() ; +}