From 4ecde5fcae912ba460d819423455260e821cf419 Mon Sep 17 00:00:00 2001 From: schutz Date: Tue, 6 Nov 2007 13:48:58 +0000 Subject: [PATCH] Put all the naming conventions into AlIQA --- STEER/AliQA.cxx | 103 +++++++++++++++++++++++++++++----- STEER/AliQA.h | 29 +++++++--- STEER/AliQAChecker.cxx | 86 ++++++++++++++-------------- STEER/AliQAChecker.h | 12 ++-- STEER/AliQADataMaker.cxx | 2 +- STEER/AliQADataMakerSteer.cxx | 14 ++++- STEER/AliQADataMakerSteer.h | 4 +- 7 files changed, 174 insertions(+), 76 deletions(-) diff --git a/STEER/AliQA.cxx b/STEER/AliQA.cxx index 6ea84d8b68e..19904bdb186 100644 --- a/STEER/AliQA.cxx +++ b/STEER/AliQA.cxx @@ -38,18 +38,25 @@ // --- Standard library --- // --- AliRoot header files --- +#include "AliCDBManager.h" +#include "AliCDBMetaData.h" +#include "AliCDBEntry.h" #include "AliLog.h" #include "AliQA.h" #include "AliQAChecker.h" ClassImp(AliQA) - AliQA * AliQA::fgQA = 0x0 ; - TFile * AliQA::fgDataFile = 0x0 ; - TString AliQA::fgDataName = "QA" ; - TString AliQA::fgDetNames[] = {"ITS", "TPC", "TRD", "TOF", "PHOS", "HMPID", "EMCAL", "MUON", "FMD", + AliQA * AliQA::fgQA = 0x0 ; + TFile * AliQA::fgDataFile = 0x0 ; + TString AliQA::fgDataName = "QA" ; // will transform into Det.QA.run.cycle.root + TString AliQA::fgQARefDirName = "local://Ref/" ; + TString AliQA::fgQARefFileName = "QA.root" ; + TString AliQA::fgQAResultDirName = "local://RUN/" ; + TString AliQA::fgQAResultFileName = "QA.root" ; + TString AliQA::fgDetNames[] = {"ITS", "TPC", "TRD", "TOF", "PHOS", "HMPID", "EMCAL", "MUON", "FMD", "ZDC", "PMD", "T0", "VZERO", "ACORDE", "HLT"} ; - TString AliQA::fgTaskNames[] = {"Raws", "Hits", "SDigits", "Digits", "RecPoints", "TrackSegments", "RecParticles", "ESDs"} ; + TString AliQA::fgTaskNames[] = {"Raws", "Hits", "SDigits", "Digits", "RecPoints", "TrackSegments", "RecParticles", "ESDs"} ; //____________________________________________________________________________ AliQA::AliQA() : @@ -61,6 +68,7 @@ AliQA::AliQA() : { // default constructor // beware singleton: not to be used + for (Int_t index = 0 ; index < fNdet ; index++) fQA[index] = 0 ; } @@ -129,6 +137,32 @@ AliQA::~AliQA() delete[] fQA ; } +//_______________________________________________________________ +const Bool_t AliQA::AddQAData2CDB(const char * defSto) const +{ + // loads the QA data into the OCDB + Bool_t rv = kTRUE ; + AliCDBManager* man = AliCDBManager::Instance() ; + man->SetDefaultStorage(defSto) ; + AliCDBMetaData md ; + // loop over detectors + AliCDBId id("QA/Ref/PHOS",0,999999999) ; + + + return rv ; +} + +//_______________________________________________________________ +const Bool_t AliQA::CheckFatal() const +{ + // check if any FATAL status is set + Bool_t rv = kFALSE ; + Int_t index ; + for (index = 0; index < kNDET ; index++) + rv = rv || IsSet(DETECTORINDEX(index), fTask, kFATAL) ; + return rv ; +} + //_______________________________________________________________ const Bool_t AliQA::CheckRange(DETECTORINDEX det) const { @@ -161,7 +195,6 @@ const Bool_t AliQA::CheckRange(QABIT bit) const return rv ; } - //_______________________________________________________________ TFile * AliQA::GetQADMOutFile(const char * name, const Int_t run, const Int_t cycle) { @@ -187,6 +220,7 @@ TFile * AliQA::GetQADMOutFile(const char * name, const Int_t run, const Int_t cy return fgDataFile ; } + //_______________________________________________________________ const char * AliQA::GetDetName(Int_t det) { @@ -229,14 +263,33 @@ const char * AliQA::GetAliTaskName(ALITASK tsk) } //_______________________________________________________________ -const Bool_t AliQA::CheckFatal() const +TFile * AliQA::GetQARefFile() { - // check if any FATAL status is set - Bool_t rv = kFALSE ; - Int_t index ; - for (index = 0; index < kNDET ; index++) - rv = rv || IsSet(DETECTORINDEX(index), fTask, kFATAL) ; - return rv ; + // opens the file whwre Quality Assurance Reference Data are stored + + TString fileName(fgQARefDirName + fgQARefFileName) ; + + if ( fileName.Contains("local://")) + fileName.ReplaceAll("local://", "") ; + + return TFile::Open(fileName.Data(), "READ") ; +} + +//_______________________________________________________________ +TFile * AliQA::GetQAResultFile() +{ + // opens the file to store the Quality Assurance Data Checker results + + TString fileName(fgQAResultDirName + fgQAResultFileName) ; + if ( fileName.Contains("local://")) + fileName.ReplaceAll("local://", "") ; + TString opt("") ; + if ( !gSystem->AccessPathName(fileName) ) + opt = "UPDATE" ; + else + opt = "NEW" ; + + return TFile::Open(fileName, opt) ; } //_______________________________________________________________ @@ -352,6 +405,30 @@ void AliQA::Set(QABIT bit) SetStatusBit(fDet, fTask, bit) ; } +//_____________________________________________________________________________ +void AliQA::SetQARefDir(const char * name) +{ + // Set the root directory where the QA reference data are stored + + fgQARefDirName.Prepend(name) ; + printf("AliQA::SetQARefDir: QA references are in %s\n", fgQARefDirName.Data()) ; + if ( fgQARefDirName.Contains("local://")) + fgQARefDirName.ReplaceAll("local:/", "") ; + fgQARefFileName.Prepend(fgQARefDirName) ; +} + +//_____________________________________________________________________________ +void AliQA::SetQAResultDirName(const char * name) +{ + // Set the root directory where to store the QA status object + + fgQAResultDirName.Prepend(name) ; + printf("AliQA::SetQAResultDirName: QA results are in %s\n", fgQAResultDirName.Data()) ; + if ( fgQAResultDirName.Contains("local://")) + fgQAResultDirName.ReplaceAll("local:/", "") ; + fgQAResultFileName.Prepend(fgQAResultDirName) ; +} + //_______________________________________________________________ void AliQA::SetStatusBit(DETECTORINDEX det, ALITASK tsk, QABIT bit) { diff --git a/STEER/AliQA.h b/STEER/AliQA.h index aad43646cdf..9394732ac45 100644 --- a/STEER/AliQA.h +++ b/STEER/AliQA.h @@ -43,6 +43,7 @@ public: static AliQA * Instance() ; static AliQA * Instance(const DETECTORINDEX det) ; static AliQA * Instance(const ALITASK tsk) ; + const Bool_t AddQAData2CDB(const char * defSto) const ; const Bool_t CheckFatal() const ; static const char * GetAliTaskName(ALITASK tsk) ; static const char * GetDataName() { return fgDataName.Data() ; } @@ -50,8 +51,14 @@ public: static const TString GetTaskName(TASKINDEX tsk) { return fgTaskNames[tsk] ; } static const char * GetDetName(Int_t det) ; static TFile * GetQADMOutFile(const char * name, const Int_t run, const Int_t cycle) ; + static TFile * GetQAResultFile() ; + static TFile * GetQARefFile() ; + static const char * GetQAResultFileName() { return (fgQAResultDirName + fgQAResultFileName).Data() ; } + static const char * GetQARefFileName() { return (fgQARefDirName + fgQARefFileName).Data() ; } const Bool_t IsSet(DETECTORINDEX det, ALITASK tsk, QABIT bit) const ; void Set(QABIT bit) ; + static void SetQAResultDirName(const char * name) ; + static void SetQARefDir(const char * name) ; void Show() const { ShowStatus(fDet) ; } void ShowAll() const ; @@ -71,15 +78,19 @@ private: void SetStatus(DETECTORINDEX det, UShort_t status) { fQA[det] = status ; } void SetStatusBit(DETECTORINDEX det, ALITASK tsk, QABIT bit) ; - static AliQA *fgQA ; // pointer to the instance of the singleton - Int_t fNdet ; // number of detectors - ULong_t * fQA ; //[fNdet] the status word 4 bits for SIM, REC, ESD, ANA each - DETECTORINDEX fDet ; //! the current detector (ITS, TPC, ....) - ALITASK fTask ; //! the current environment (SIM, REC, ESD, ANA) - static TFile * fgDataFile ; //! the output file where the quality assurance maker store their results - static TString fgDataName ; //! the name of the file where the quality assurance maker store their results - static TString fgDetNames[] ; //! list of detector names - static TString fgTaskNames[]; //! list of tasks names + static AliQA *fgQA ; // pointer to the instance of the singleton + Int_t fNdet ; // number of detectors + ULong_t * fQA ; //[fNdet] the status word 4 bits for SIM, REC, ESD, ANA each + DETECTORINDEX fDet ; //! the current detector (ITS, TPC, ....) + ALITASK fTask ; //! the current environment (SIM, REC, ESD, ANA) + static TFile * fgDataFile ; //! the output file where the quality assurance maker store their results + static TString fgDataName ; //! the name of the file where the quality assurance maker store their results + static TString fgDetNames[] ; //! list of detector names + static TString fgQAResultDirName ; //! the location of the output file where the QA results are stored + static TString fgQAResultFileName ; //! the output file where the QA results are stored + static TString fgQARefDirName ; //! name of directory where to find the reference data file + static TString fgQARefFileName ; //! file name where to find the reference data + static TString fgTaskNames[] ; //! list of tasks names ClassDef(AliQA,1) //ALICE Quality Assurance Object }; diff --git a/STEER/AliQAChecker.cxx b/STEER/AliQAChecker.cxx index cf2776e5f68..22173614a26 100644 --- a/STEER/AliQAChecker.cxx +++ b/STEER/AliQAChecker.cxx @@ -39,31 +39,30 @@ ClassImp(AliQAChecker) AliQAChecker * AliQAChecker::fgQAChecker = 0x0 ; TFile * AliQAChecker::fgQAResultFile = 0x0 ; - TString AliQAChecker::fgQAResultDirName = "local://RUN/"; - TString AliQAChecker::fgQAResultFileName = "QA.root" ; +// 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"), +// fRefDirName("./Ref/"), +// fRefName("QA.root"), fFoundDetectors(".") { // ctor: initialise checkers and open the data file for (Int_t det = 0 ; det < AliQA::kNDET ; det++) fCheckers[det] = NULL ; - //GetDataFile() ; - fRefDirName.Append(fRefName) ; +// fRefDirName.Append(fRefName) ; } //_____________________________________________________________________________ AliQAChecker::AliQAChecker(const AliQAChecker& qac) : TNamed(qac), fDataFile(qac.fDataFile), - fRefDirName(qac.fRefDirName), - fRefName(qac.fRefName), +// fRefDirName(qac.fRefDirName), +// fRefName(qac.fRefName), fFoundDetectors(qac.fFoundDetectors) { // copy constructor @@ -117,16 +116,17 @@ TFile * AliQAChecker:: GetQAResultFile() 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) ; - +// 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 ; } @@ -174,19 +174,19 @@ TFile * AliQAChecker:: GetQAResultFile() TDirectory * AliQAChecker::GetRefSubDir(const char * det, const char * task) { // Opens and returns the file with the reference data - TFile * f = TFile::Open(fRefDirName, "READ") ; + TFile * f = AliQA::GetQARefFile() ; //TFile::Open(fRefDirName, "READ") ; TDirectory * rv = NULL ; if (!f) { - AliError(Form("Cannot find reference file %s", fRefDirName.Data())) ; + 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, fRefDirName.Data())) ; + 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, fRefDirName.Data())) ; + AliWarning(Form("Directory %s/%s not found in %s", det, task, (AliQA::GetQARefFileName()))) ; } return rv ; } @@ -322,29 +322,29 @@ Bool_t AliQAChecker::Run(AliQA::DETECTORINDEX det, AliQA::TASKINDEX task, TList } //_____________________________________________________________________________ -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::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:/", "") ; -} - +//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:/", "") ; +//} +// diff --git a/STEER/AliQAChecker.h b/STEER/AliQAChecker.h index 6a9697e909f..9ed3e545d75 100644 --- a/STEER/AliQAChecker.h +++ b/STEER/AliQAChecker.h @@ -32,8 +32,8 @@ public: AliQACheckerBase * GetDetQAChecker(Int_t det) ; TDirectory * GetRefSubDir(const char * det, const char * task) ; static TFile * GetQAResultFile() ; - static const char * GetQAResultFileName() { return fgQAResultFileName.Data() ; } - void SetQAResultDirName(const char * name) ; +// static const char * GetQAResultFileName() { return fgQAResultFileName.Data() ; } +// void SetQAResultDirName(const char * name) ; void SetRefDirName(const char * name) ; virtual Bool_t Run(const char * fileName = NULL) ; @@ -45,10 +45,10 @@ private: static AliQAChecker *fgQAChecker ; // pointer to the instance of the singleton TFile * fDataFile ; //! Data file to check static TFile * fgQAResultFile ; //! File where to find the QA result - static TString fgQAResultDirName ; //! directory where to find the QA result - static TString fgQAResultFileName ; //! file name where to find the QA result - TString fRefDirName ; //! name of directory where to find the reference data file - TString fRefName ; //! file name where to find the reference data +// static TString fgQAResultDirName ; //! directory where to find the QA result +// static TString fgQAResultFileName ; //! file name where to find the QA result +// TString fRefDirName ; //! name of directory where to find the reference data file +// TString fRefName ; //! file name where to find the reference data TString fFoundDetectors ; //! detectors for which the Quality assurance could be done AliQACheckerBase * fCheckers[AliQA::kNDET] ; //! list of detectors checkers ClassDef(AliQAChecker, 1) // class for running generation, simulation and digitization diff --git a/STEER/AliQADataMaker.cxx b/STEER/AliQADataMaker.cxx index c240b33b603..c23f8ec958b 100644 --- a/STEER/AliQADataMaker.cxx +++ b/STEER/AliQADataMaker.cxx @@ -71,7 +71,7 @@ AliQADataMaker::AliQADataMaker(const AliQADataMaker& qadm) : fDigitsQAList(qadm.fDigitsQAList), fESDsQAList(qadm.fESDsQAList), fHitsQAList(qadm.fHitsQAList), - fRawsQAList(qadm.fRecPointsQAList), + fRawsQAList(qadm.fRawsQAList), fRecPointsQAList(qadm.fRecPointsQAList), fSDigitsQAList(qadm.fSDigitsQAList), fCurrentCycle(qadm.fCurrentCycle), diff --git a/STEER/AliQADataMakerSteer.cxx b/STEER/AliQADataMakerSteer.cxx index e3d2c4fa509..5384c37c8a6 100644 --- a/STEER/AliQADataMakerSteer.cxx +++ b/STEER/AliQADataMakerSteer.cxx @@ -28,6 +28,8 @@ #include "AliQA.h" #include "AliQADataMaker.h" #include "AliQADataMakerSteer.h" +#include "AliRawReaderDate.h" +#include "AliRawReaderFile.h" #include "AliRawReaderRoot.h" #include "AliRun.h" #include "AliRunLoader.h" @@ -178,12 +180,20 @@ AliQADataMaker * AliQADataMakerSteer::GetQADataMaker(Int_t iDet) } //_____________________________________________________________________________ -Bool_t AliQADataMakerSteer::Init(const AliQA::TASKINDEX taskIndex, const char * fileName ) +Bool_t AliQADataMakerSteer::Init(const AliQA::TASKINDEX taskIndex, const char * input ) { // Initialize the event source and QA data makers if (taskIndex == AliQA::kRAWS) { - fRawReader = new AliRawReaderRoot(fileName) ; + TString fileName(input); + if (fileName.EndsWith("/")) { + fRawReader = new AliRawReaderFile(fileName); + } else if (fileName.EndsWith(".root")) { + fRawReader = new AliRawReaderRoot(fileName); + } else if (!fileName.IsNull()) { + fRawReader = new AliRawReaderDate(fileName); + fRawReader->SelectEvents(7); + } if ( ! fRawReader ) return kFALSE ; fRawReader->NextEvent() ; diff --git a/STEER/AliQADataMakerSteer.h b/STEER/AliQADataMakerSteer.h index 7436f6679fb..a8bfec24c95 100644 --- a/STEER/AliQADataMakerSteer.h +++ b/STEER/AliQADataMakerSteer.h @@ -24,7 +24,7 @@ #include "AliLoader.h" class AliQADataMaker ; -class AliRawReaderRoot ; +class AliRawReader ; class AliRunLoader ; class AliESDEvent ; @@ -57,7 +57,7 @@ private: TString fGAliceFileName ; //! name of the galice file UInt_t fRunNumber ; //! current run number Long64_t fNumberOfEvents ; //! number of events in the run - AliRawReaderRoot * fRawReader ; //! current raw reader object + AliRawReader * fRawReader ; //! current raw reader object AliRunLoader * fRunLoader ; //! current run loader object static const UInt_t fgkNDetectors = AliQA::kNDET ; //! number of detectors AliLoader * fLoader[fgkNDetectors]; //! array of detectors loader -- 2.39.3