From f1c1204db4914a19f49337ab4cfbca57ad086d96 Mon Sep 17 00:00:00 2001 From: schutz Date: Thu, 5 Mar 2009 16:28:19 +0000 Subject: [PATCH] QA ref defaut storage setter in sim and rec --- STEER/AliReconstruction.cxx | 111 +++++++++++++++++++++++++----------- STEER/AliReconstruction.h | 7 ++- STEER/AliSimulation.cxx | 53 ++++++++++++++++- STEER/AliSimulation.h | 8 ++- test/PbPbbench/rec.C | 2 +- test/PbPbbench/recraw/rec.C | 2 +- test/PbPbbench/sim.C | 2 +- test/QA/rec.C | 2 +- test/QA/recqa.C | 2 +- test/QA/recraw.C | 2 +- test/QA/sim.C | 2 +- test/ppbench/rec.C | 2 +- test/ppbench/recraw/rec.C | 2 +- test/ppbench/sim.C | 5 +- 14 files changed, 155 insertions(+), 47 deletions(-) diff --git a/STEER/AliReconstruction.cxx b/STEER/AliReconstruction.cxx index 1e3c1e6262f..cb0132dcd5c 100644 --- a/STEER/AliReconstruction.cxx +++ b/STEER/AliReconstruction.cxx @@ -1,6 +1,6 @@ /************************************************************************** * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * * + * *QARef * Author: The ALICE Off-line Project. * * Contributors are mentioned in the code where appropriate. * * * @@ -244,6 +244,7 @@ AliReconstruction::AliReconstruction(const char* gAliceFilename) : fAlignObjArray(NULL), fCDBUri(), + fQARefUri(), fSpecCDBUri(), fInitCDBCalled(kFALSE), fSetRunNumberFromDataCalled(kFALSE), @@ -253,7 +254,7 @@ AliReconstruction::AliReconstruction(const char* gAliceFilename) : fRunQA(kTRUE), fRunGlobalQA(kTRUE), fSameQACycle(kFALSE), - + fInitQACalled(kFALSE), fRunPlaneEff(kFALSE), fesd(NULL), @@ -336,6 +337,7 @@ AliReconstruction::AliReconstruction(const AliReconstruction& rec) : fAlignObjArray(rec.fAlignObjArray), fCDBUri(rec.fCDBUri), + fQARefUri(rec.fQARefUri), fSpecCDBUri(), fInitCDBCalled(rec.fInitCDBCalled), fSetRunNumberFromDataCalled(rec.fSetRunNumberFromDataCalled), @@ -345,6 +347,7 @@ AliReconstruction::AliReconstruction(const AliReconstruction& rec) : fRunQA(rec.fRunQA), fRunGlobalQA(rec.fRunGlobalQA), fSameQACycle(rec.fSameQACycle), + fInitQACalled(rec.fInitQACalled), fRunPlaneEff(rec.fRunPlaneEff), fesd(NULL), @@ -465,6 +468,7 @@ AliReconstruction& AliReconstruction::operator = (const AliReconstruction& rec) delete fAlignObjArray; fAlignObjArray = NULL; fCDBUri = ""; + fQARefUri = rec.fQARefUri; fSpecCDBUri.Delete(); fInitCDBCalled = rec.fInitCDBCalled; fSetRunNumberFromDataCalled = rec.fSetRunNumberFromDataCalled; @@ -474,6 +478,7 @@ AliReconstruction& AliReconstruction::operator = (const AliReconstruction& rec) fRunQA = rec.fRunQA; fRunGlobalQA = rec.fRunGlobalQA; fSameQACycle = rec.fSameQACycle; + fInitQACalled = rec.fInitQACalled; fRunPlaneEff = rec.fRunPlaneEff; fesd = NULL; @@ -507,6 +512,67 @@ AliReconstruction::~AliReconstruction() AliCodeTimer::Instance()->Print(); } +//_____________________________________________________________________________ +void AliReconstruction::InitQA() +{ + //Initialize the QA and start of cycle + AliCodeTimerAuto(""); + + if (fInitQACalled) return; + fInitQACalled = kTRUE; + + fQAManager = AliQAManager::QAManager("rec") ; + if (fQAManager->IsDefaultStorageSet()) { + AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); + AliWarning("Default QA reference storage has been already set !"); + AliWarning(Form("Ignoring the default storage declared in AliReconstruction: %s",fQARefUri.Data())); + AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); + fQARefUri = fQAManager->GetDefaultStorage()->GetURI(); + } else { + if (fQARefUri.Length() > 0) { + AliDebug(2,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); + AliDebug(2, Form("Default QA reference storage is set to: %s", fQARefUri.Data())); + AliDebug(2, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); + } else { + fQARefUri="local://$ALICE_ROOT/QAref"; + AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); + AliWarning("Default QA refeference storage not yet set !!!!"); + AliWarning(Form("Setting it now to: %s", fQARefUri.Data())); + AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); + + } + fQAManager->SetDefaultStorage(fQARefUri); + } + + if (fRunQA) { + fQAManager->SetActiveDetectors(fQADetectors) ; + for (Int_t det = 0 ; det < AliQA::kNDET ; det++) { + fQAManager->SetCycleLength(AliQA::DETECTORINDEX_t(det), fQACycles[det]) ; + fQAManager->SetWriteExpert(AliQA::DETECTORINDEX_t(det)) ; + } + if (!fRawReader && fQATasks.Contains(AliQA::kRAWS)) + fQATasks.ReplaceAll(Form("%d",AliQA::kRAWS), "") ; + fQAManager->SetTasks(fQATasks) ; + fQAManager->InitQADataMaker(AliCDBManager::Instance()->GetRun()) ; + } + if (fRunGlobalQA) { + Bool_t sameCycle = kFALSE ; + AliQADataMaker *qadm = fQAManager->GetQADataMaker(AliQA::kGLOBAL); + AliInfo(Form("Initializing the global QA data maker")); + if (fQATasks.Contains(Form("%d", AliQA::kRECPOINTS))) { + qadm->StartOfCycle(AliQA::kRECPOINTS, AliCDBManager::Instance()->GetRun(), sameCycle) ; + TObjArray **arr=qadm->Init(AliQA::kRECPOINTS); + AliTracker::SetResidualsArray(arr); + sameCycle = kTRUE ; + } + if (fQATasks.Contains(Form("%d", AliQA::kESDS))) { + qadm->StartOfCycle(AliQA::kESDS, AliCDBManager::Instance()->GetRun(), sameCycle) ; + qadm->Init(AliQA::kESDS); + } + AliSysInfo::AddStamp("InitQA"); + } +} + //_____________________________________________________________________________ void AliReconstruction::InitCDB() { @@ -565,6 +631,15 @@ void AliReconstruction::SetDefaultStorage(const char* uri) { } +//_____________________________________________________________________________ +void AliReconstruction::SetQARefDefaultStorage(const char* uri) { + // Store the desired default CDB storage location + // Activate it later within the Run() method + + fQARefUri = uri; + AliQA::SetQARefStorage(fQARefUri.Data()) ; + +} //_____________________________________________________________________________ void AliReconstruction::SetSpecificStorage(const char* calibType, const char* uri) { // Store a detector-specific CDB storage location @@ -1392,36 +1467,8 @@ void AliReconstruction::SlaveBegin(TTree*) //QA //Initialize the QA and start of cycle - if (fRunQA) { - fQAManager = AliQAManager::QAManager("rec") ; - fQAManager->SetActiveDetectors(fQADetectors) ; - for (Int_t det = 0 ; det < AliQA::kNDET ; det++) { - fQAManager->SetCycleLength(AliQA::DETECTORINDEX_t(det), fQACycles[det]) ; - fQAManager->SetWriteExpert(AliQA::DETECTORINDEX_t(det)) ; - } - if (!fRawReader && fQATasks.Contains(AliQA::kRAWS)) - fQATasks.ReplaceAll(Form("%d",AliQA::kRAWS), "") ; - fQAManager->SetTasks(fQATasks) ; - fQAManager->InitQADataMaker(AliCDBManager::Instance()->GetRun()) ; - } - - if (fRunGlobalQA) { - Bool_t sameCycle = kFALSE ; - if (!fQAManager) - fQAManager = AliQAManager::QAManager("rec") ; - AliQADataMaker *qadm = fQAManager->GetQADataMaker(AliQA::kGLOBAL); - AliInfo(Form("Initializing the global QA data maker")); - if (fQATasks.Contains(Form("%d", AliQA::kRECPOINTS))) { - qadm->StartOfCycle(AliQA::kRECPOINTS, AliCDBManager::Instance()->GetRun(), sameCycle) ; - TObjArray **arr=qadm->Init(AliQA::kRECPOINTS); - AliTracker::SetResidualsArray(arr); - sameCycle = kTRUE ; - } - if (fQATasks.Contains(Form("%d", AliQA::kESDS))) { - qadm->StartOfCycle(AliQA::kESDS, AliCDBManager::Instance()->GetRun(), sameCycle) ; - qadm->Init(AliQA::kESDS); - } - } + if (fRunQA || fRunGlobalQA) + InitQA() ; //Initialize the Plane Efficiency framework if (fRunPlaneEff && !InitPlaneEff()) { diff --git a/STEER/AliReconstruction.h b/STEER/AliReconstruction.h index 071cf9431a7..0b16b4a24e1 100644 --- a/STEER/AliReconstruction.h +++ b/STEER/AliReconstruction.h @@ -11,7 +11,7 @@ // Clusters and tracks are created for all detectors and all events by // // typing: // // // -// AliReconstruction rec; // +// AliReconstruction rec; QARef // // rec.Run(); // // // /////////////////////////////////////////////////////////////////////////////// @@ -142,6 +142,9 @@ public: void SetQAWriteExpert(AliQA::DETECTORINDEX_t det) { fQAWriteExpert[det] = kTRUE ; } Bool_t SetRunQA(TString detAndAction="ALL:ALL") ; void SetRunGlobalQA(Bool_t flag=kTRUE){fRunGlobalQA = flag;} + void SetQARefDefaultStorage(const char* uri); + void InitQA(); + // Plane Efficiency Evaluation void SetRunPlaneEff(Bool_t flag=kFALSE) {fRunPlaneEff = flag;} @@ -256,6 +259,7 @@ private: TObjArray* fAlignObjArray; //! array with the alignment objects to be applied to the geometry TString fCDBUri; //! Uri of the default CDB storage + TString fQARefUri; //! Uri of the default QA reference storage TObjArray fSpecCDBUri; //! Array with detector specific CDB storages Bool_t fInitCDBCalled; //! flag to check if CDB storages are already initialized Bool_t fSetRunNumberFromDataCalled; //! flag to check if run number is already loaded from run loader @@ -269,6 +273,7 @@ private: Bool_t fRunQA ; // Run QA flag Bool_t fRunGlobalQA; // Run global QA flag Bool_t fSameQACycle; //! open a new QA data file or not + Bool_t fInitQACalled; //! control of QA intialisation // Plane Efficiency Evaluation Bool_t fRunPlaneEff ; // Evaluate Plane Efficiency diff --git a/STEER/AliSimulation.cxx b/STEER/AliSimulation.cxx index 07e0fb4af2f..04d222e372f 100644 --- a/STEER/AliSimulation.cxx +++ b/STEER/AliSimulation.cxx @@ -181,6 +181,7 @@ AliSimulation::AliSimulation(const char* configFileName, fUseBkgrdVertex(kTRUE), fRegionOfInterest(kFALSE), fCDBUri(""), + fQARefUri(""), fSpecCDBUri(), fRun(-1), fSeed(0), @@ -239,6 +240,43 @@ void AliSimulation::SetNumberOfEvents(Int_t nEvents) fNEvents = nEvents; } +//_____________________________________________________________________________ +void AliSimulation::InitQA() +{ + // activate a default CDB storage + // First check if we have any CDB storage set, because it is used + // to retrieve the calibration and alignment constants + + if (fInitCDBCalled) return; + fInitCDBCalled = kTRUE; + + fQAManager = AliQAManager::QAManager("sim") ; + fQAManager->SetActiveDetectors(fQADetectors) ; + fQATasks = Form("%d %d %d", AliQA::kHITS, AliQA::kSDIGITS, AliQA::kDIGITS) ; + fQAManager->SetTasks(fQATasks) ; + + if (fQAManager->IsDefaultStorageSet()) { + AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); + AliWarning("Default QA reference storage has been already set !"); + AliWarning(Form("Ignoring the default storage declared in AliSimulation: %s",fQARefUri.Data())); + AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); + fQARefUri = fQAManager->GetDefaultStorage()->GetURI(); + } else { + if (fQARefUri.Length() > 0) { + AliDebug(2,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); + AliDebug(2, Form("Default QA reference storage is set to: %s", fQARefUri.Data())); + AliDebug(2, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); + } else { + fQARefUri="local://$ALICE_ROOT/QARef"; + AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); + AliWarning("Default QA reference storage not yet set !!!!"); + AliWarning(Form("Setting it now to: %s", fQARefUri.Data())); + AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); + } + fQAManager->SetDefaultStorage(fQARefUri); + } +} + //_____________________________________________________________________________ void AliSimulation::InitCDB() { @@ -329,11 +367,20 @@ void AliSimulation::SetCDBLock() { //_____________________________________________________________________________ void AliSimulation::SetDefaultStorage(const char* uri) { -// Store the desired default CDB storage location -// Activate it later within the Run() method - + // Store the desired default CDB storage location + // Activate it later within the Run() method + fCDBUri = uri; + +} +//_____________________________________________________________________________ +void AliSimulation::SetQARefDefaultStorage(const char* uri) { + // Store the desired default CDB storage location + // Activate it later within the Run() method + + fQARefUri = uri; + AliQA::SetQARefStorage(fQARefUri.Data()) ; } //_____________________________________________________________________________ diff --git a/STEER/AliSimulation.h b/STEER/AliSimulation.h index 6ac2977ab68..d50ae2c9162 100644 --- a/STEER/AliSimulation.h +++ b/STEER/AliSimulation.h @@ -115,7 +115,12 @@ public: void SetQACycles(AliQA::DETECTORINDEX_t det, const Int_t cycles) { fQAManager->SetCycleLength(det, cycles) ; } Bool_t RunQA() ; Bool_t SetRunQA(TString detAndAction="ALL:ALL") ; - void SetQAWriteExpert(AliQA::DETECTORINDEX_t det) { fQAManager->SetWriteExpert(det) ; } + void SetQAWriteExpert(AliQA::DETECTORINDEX_t det) { fQAManager->SetWriteExpert(det) ; } + void SetQARefDefaultStorage(const char* uri); + void InitQA(); + + + void SetWriteGRPEntry(Bool_t flag = kTRUE) { fWriteGRPEntry = flag; } void WriteGRPEntry(); @@ -160,6 +165,7 @@ private: Bool_t fRegionOfInterest; // digitization in region of interest TString fCDBUri; //! Uri of the default CDB storage + TString fQARefUri; //! Uri of the default QA reference storage TObjArray fSpecCDBUri; //! Array with detector specific CDB storages Int_t fRun; //! Run number, will be passed to CDB and gAlice!! Int_t fSeed; //! Seed for random number generator diff --git a/test/PbPbbench/rec.C b/test/PbPbbench/rec.C index c9c881a73c2..e8fa9022be9 100644 --- a/test/PbPbbench/rec.C +++ b/test/PbPbbench/rec.C @@ -9,7 +9,7 @@ void rec() { Form("local://%s",gSystem->pwd())); reco.SetRunQA("ALL:ALL") ; - AliQA::SetQARefStorage("local://$ALICE_ROOT/QAref") ; + reco.SetQARefefaultStorage("local://$ALICE_ROOT/QAref") ; for (Int_t det = 0 ; det < AliQA::kNDET ; det++) { reco.SetQACycles(det, 999) ; diff --git a/test/PbPbbench/recraw/rec.C b/test/PbPbbench/recraw/rec.C index 2730c02e3f0..2793548aa43 100644 --- a/test/PbPbbench/recraw/rec.C +++ b/test/PbPbbench/recraw/rec.C @@ -12,7 +12,7 @@ void rec() { reco.SetRunQA("ALL:ALL") ; - AliQA::SetQARefStorage("local://$ALICE_ROOT/QAref") ; + reco.SetQARefDefaultStorage("local://$ALICE_ROOT/QAref") ; for (Int_t det = 0 ; det < AliQA::kNDET ; det++) { reco.SetQACycles(det, 999) ; diff --git a/test/PbPbbench/sim.C b/test/PbPbbench/sim.C index 2918ddcda28..2d50b01f235 100644 --- a/test/PbPbbench/sim.C +++ b/test/PbPbbench/sim.C @@ -8,7 +8,7 @@ void sim(Int_t nev=1) { simulator.SetSpecificStorage("GRP/GRP/Data", Form("local://%s",gSystem->pwd())); simulator.SetRunQA("ALL:ALL") ; - AliQA::SetQARefStorage("local://$ALICE_ROOT/QAref") ; + simulator.SetQARefDefaultStorage("local://$ALICE_ROOT/QAref") ; for (Int_t det = 0 ; det < AliQA::kNDET ; det++) { simulator.SetQACycles(det, nev+1) ; diff --git a/test/QA/rec.C b/test/QA/rec.C index 4041f0de108..ee68a9c5e5e 100644 --- a/test/QA/rec.C +++ b/test/QA/rec.C @@ -12,7 +12,7 @@ reco.SetRunQA("ALL:ALL") ; - AliQA::SetQARefStorage("local://$ALICE_ROOT/OCDB") ; + reco.SetQARefDefaultStorage("local://$ALICE_ROOT/OCDB") ; for (Int_t det = 0 ; det < AliQA::kNDET ; det++) { reco.SetQACycles(det, 999) ; diff --git a/test/QA/recqa.C b/test/QA/recqa.C index c0d9932bdee..bf665db8379 100644 --- a/test/QA/recqa.C +++ b/test/QA/recqa.C @@ -13,6 +13,6 @@ void recqa() AliQA::SetQARefStorage("local://$ALICE_ROOT/OCDB") ; //AliQA::SetQARefDataDirName(AliQA::kMONTECARLO) ; //RUN_TYPE - AliQADataMakerSteer qas("rec") ; + AliQADataMamanager qas("rec") ; qas.Run(detectors.Data(), AliQA::kRECPOINTS); } diff --git a/test/QA/recraw.C b/test/QA/recraw.C index 545796e9d34..82be9ac7810 100644 --- a/test/QA/recraw.C +++ b/test/QA/recraw.C @@ -22,7 +22,7 @@ void recraw() { reco.SetRunQA("ALL:ALL") ; - AliQA::SetQARefStorage("local://$ALICE_ROOT/OCDB") ; + reco.SetQARefDefaultStorage("local://$ALICE_ROOT/OCDB") ; for (Int_t det = 0 ; det < AliQA::kNDET ; det++) { reco.SetQACycles(det, 9999) ; reco.SetQAWriteExpert(det) ; diff --git a/test/QA/sim.C b/test/QA/sim.C index d7f2e65c8b8..7d7162aca67 100644 --- a/test/QA/sim.C +++ b/test/QA/sim.C @@ -9,7 +9,7 @@ void sim(Int_t nev=1) { Form("local://%s",gSystem->pwd())); simu.SetRunQA("ALL:ALL") ; - AliQA::SetQARefStorage("local://$ALICE_ROOT/OCDB") ; + simu.SetQARefDefaultStorage("local://$ALICE_ROOT/OCDB") ; for (Int_t det = 0 ; det < AliQA::kNDET ; det++) { simu.SetQACycles(det, 2) ; diff --git a/test/ppbench/rec.C b/test/ppbench/rec.C index 43723677983..3c8735e5134 100644 --- a/test/ppbench/rec.C +++ b/test/ppbench/rec.C @@ -10,7 +10,7 @@ void rec() { reco.SetRunQA("ALL:ALL") ; - AliQA::SetQARefStorage("local://$ALICE_ROOT/QAref") ; + reco.SetQARefDefaultStorage("local://$ALICE_ROOT/QAref") ; for (Int_t det = 0 ; det < AliQA::kNDET ; det++) { reco.SetQACycles(det, 999) ; diff --git a/test/ppbench/recraw/rec.C b/test/ppbench/recraw/rec.C index d8afb2415ca..9f373de5ddb 100644 --- a/test/ppbench/recraw/rec.C +++ b/test/ppbench/recraw/rec.C @@ -16,7 +16,7 @@ void rec() { reco.SetRunQA("ALL:ALL") ; - AliQA::SetQARefStorage("local://$ALICE_ROOT/QAref") ; + reco.SetQARefDefaultStorage("local://$ALICE_ROOT/QAref") ; for (Int_t det = 0 ; det < AliQA::kNDET ; det++) { reco.SetQACycles(det, 999) ; diff --git a/test/ppbench/sim.C b/test/ppbench/sim.C index a989354ee01..c88e6d90e0d 100644 --- a/test/ppbench/sim.C +++ b/test/ppbench/sim.C @@ -1,6 +1,7 @@ void sim(Int_t nev=20) { if (gSystem->Getenv("EVENT")) nev = atoi(gSystem->Getenv("EVENT")) ; + AliSimulation simulator; simulator.SetMakeSDigits("TRD TOF PHOS HMPID EMCAL MUON FMD ZDC PMD T0 VZERO"); simulator.SetMakeDigitsFromHits("ITS TPC"); @@ -9,9 +10,11 @@ void sim(Int_t nev=20) { simulator.SetDefaultStorage("local://$ALICE_ROOT/OCDB"); simulator.SetSpecificStorage("GRP/GRP/Data", Form("local://%s",gSystem->pwd())); + simulator.SetRunQA("ALL:ALL") ; - AliQA::SetQARefStorage("local://$ALICE_ROOT/QAref") ; + simulator.SetQARefDefaultStorage("local://$ALICE_ROOT/QAref") ; + for (Int_t det = 0 ; det < AliQA::kNDET ; det++) { simulator.SetQACycles(det, nev+1) ; } -- 2.43.0