From c8357caafd2c04f2ddae2fbf923dcce9800b5d63 Mon Sep 17 00:00:00 2001 From: Peter Onyisi <ponyisi@utexas.edu> Date: Thu, 13 Dec 2018 17:49:07 +0000 Subject: [PATCH] Remove DetectorStatus package (mostly) --- DataQuality/GoodRunsLists/CMakeLists.txt | 3 +- .../GoodRunsLists/GoodRunsListSelectorTool.h | 5 - .../src/GoodRunsListSelectorTool.cxx | 118 +------- .../share/GoodRunsListsUser_coolQuery.py | 47 ---- .../DetectorStatus/CMakeLists.txt | 22 +- .../DetectorStatus/DetStatusAlg.h | 35 --- .../DetectorStatus/IDetStatusSvc.h | 39 --- .../DetectorStatus/doc/packagedoc.h | 116 +------- .../share/DetStatusSvc_CondDB.py | 16 -- .../share/DetStatusSvc_ToFileMetaData.py | 10 - .../DetectorStatus/share/detStatus_merge.py | 228 ---------------- .../DetectorStatus/share/detStatus_query.py | 233 ---------------- .../DetectorStatus/share/detStatus_set.py | 141 ---------- .../DetectorStatus/share/detStatus_upload.py | 169 ------------ .../DetectorStatus/src/DetStatusAlg.cxx | 74 ----- .../DetectorStatus/src/DetStatusSvc.cxx | 257 ------------------ .../DetectorStatus/src/DetStatusSvc.h | 66 ----- .../src/components/DetectorStatus_entries.cxx | 6 - .../utils/detStatus_AddComment.py | 42 --- .../utils/detStatus_AddNumbers.py | 44 --- .../DetectorStatus/utils/detStatus_AsBuilt.py | 73 ----- .../utils/detStatus_NameChannels.py | 48 ---- .../DetectorStatus/utils/detStatus_nameAll.py | 53 ---- .../share/MuonDQAMonitoring_CommRunsTier0.py | 1 - .../share/AnalysisCommon_topOptions.py | 18 -- .../RecExCond/share/RecExCommon_flags.py | 6 - .../RecExample/RecExConfig/python/RecFlags.py | 9 +- .../share/skeleton.FTKStandaloneSim.py | 7 - .../share/L1Simulation_topOptions.py | 15 - 29 files changed, 11 insertions(+), 1890 deletions(-) delete mode 100644 DataQuality/GoodRunsListsUser/share/GoodRunsListsUser_coolQuery.py delete mode 100755 DetectorDescription/DetDescrCond/DetectorStatus/DetectorStatus/DetStatusAlg.h delete mode 100755 DetectorDescription/DetDescrCond/DetectorStatus/DetectorStatus/IDetStatusSvc.h delete mode 100755 DetectorDescription/DetDescrCond/DetectorStatus/share/DetStatusSvc_CondDB.py delete mode 100644 DetectorDescription/DetDescrCond/DetectorStatus/share/DetStatusSvc_ToFileMetaData.py delete mode 100755 DetectorDescription/DetDescrCond/DetectorStatus/share/detStatus_merge.py delete mode 100755 DetectorDescription/DetDescrCond/DetectorStatus/share/detStatus_query.py delete mode 100755 DetectorDescription/DetDescrCond/DetectorStatus/share/detStatus_set.py delete mode 100755 DetectorDescription/DetDescrCond/DetectorStatus/share/detStatus_upload.py delete mode 100755 DetectorDescription/DetDescrCond/DetectorStatus/src/DetStatusAlg.cxx delete mode 100755 DetectorDescription/DetDescrCond/DetectorStatus/src/DetStatusSvc.cxx delete mode 100755 DetectorDescription/DetDescrCond/DetectorStatus/src/DetStatusSvc.h delete mode 100644 DetectorDescription/DetDescrCond/DetectorStatus/src/components/DetectorStatus_entries.cxx delete mode 100755 DetectorDescription/DetDescrCond/DetectorStatus/utils/detStatus_AddComment.py delete mode 100755 DetectorDescription/DetDescrCond/DetectorStatus/utils/detStatus_AddNumbers.py delete mode 100755 DetectorDescription/DetDescrCond/DetectorStatus/utils/detStatus_AsBuilt.py delete mode 100755 DetectorDescription/DetDescrCond/DetectorStatus/utils/detStatus_NameChannels.py delete mode 100755 DetectorDescription/DetDescrCond/DetectorStatus/utils/detStatus_nameAll.py diff --git a/DataQuality/GoodRunsLists/CMakeLists.txt b/DataQuality/GoodRunsLists/CMakeLists.txt index f237272c768..510b81d2bfb 100644 --- a/DataQuality/GoodRunsLists/CMakeLists.txt +++ b/DataQuality/GoodRunsLists/CMakeLists.txt @@ -26,7 +26,6 @@ else() GaudiKernel PRIVATE Control/StoreGate - DetectorDescription/DetDescrCond/DetectorStatus Event/EventInfo Tools/PathResolver AtlasTest/TestTools ) @@ -56,7 +55,7 @@ if( NOT XAOD_STANDALONE ) atlas_add_component( GoodRunsLists src/*.cxx src/components/*.cxx LINK_LIBRARIES AthenaBaseComps AthenaKernel xAODEventInfo GaudiKernel - StoreGateLib DetectorStatusLib EventInfo PathResolver GoodRunsListsLib ) + StoreGateLib EventInfo PathResolver GoodRunsListsLib ) endif() atlas_add_dictionary( GoodRunsListsDict diff --git a/DataQuality/GoodRunsLists/GoodRunsLists/GoodRunsListSelectorTool.h b/DataQuality/GoodRunsLists/GoodRunsLists/GoodRunsListSelectorTool.h index b76bbc74f55..8a099a222bb 100644 --- a/DataQuality/GoodRunsLists/GoodRunsLists/GoodRunsListSelectorTool.h +++ b/DataQuality/GoodRunsLists/GoodRunsLists/GoodRunsListSelectorTool.h @@ -33,7 +33,6 @@ namespace Root { class TGoodRunsListReader; } -class IDetStatusSvc; class StoreGateSvc; class GoodRunsListSelectorTool : virtual public AthAlgTool, virtual public IGoodRunsListSelectorTool, virtual public IAthenaEvtLoopPreSelectTool @@ -80,7 +79,6 @@ class GoodRunsListSelectorTool : virtual public AthAlgTool, virtual public IGood std::vector<std::string> m_goodrunslistVec; std::vector<std::string> m_blackrunslistVec; - std::vector<std::string> m_dqflagsqueryVec; Root::TGRLCollection* m_grlcollection; Root::TGRLCollection* m_brlcollection; @@ -96,13 +94,10 @@ class GoodRunsListSelectorTool : virtual public AthAlgTool, virtual public IGood bool m_rejectanybrl; bool m_eventselectormode; - const IDetStatusSvc* m_detstatussvc; StoreGateSvc* m_storeGate; std::map< std::string, vvPair > m_registry; - std::string m_runrangeexpr; - Root::RegularFormula m_inrunrange; }; #endif diff --git a/DataQuality/GoodRunsLists/src/GoodRunsListSelectorTool.cxx b/DataQuality/GoodRunsLists/src/GoodRunsListSelectorTool.cxx index 5ceb2b62354..2c7603bd822 100644 --- a/DataQuality/GoodRunsLists/src/GoodRunsListSelectorTool.cxx +++ b/DataQuality/GoodRunsLists/src/GoodRunsListSelectorTool.cxx @@ -11,7 +11,6 @@ #include "PathResolver/PathResolver.h" -#include "DetectorStatus/IDetStatusSvc.h" #include "GaudiKernel/MsgStream.h" #include "EventInfo/EventInfo.h" #include "EventInfo/EventID.h" @@ -29,11 +28,9 @@ GoodRunsListSelectorTool::GoodRunsListSelectorTool( const std::string& type, con , m_reader(0) , m_boolop(0) , m_passthrough(true) - , m_usecool(false) , m_verbose(false) , m_rejectanybrl(false) , m_eventselectormode(false) - , m_detstatussvc(0) { declareInterface<IGoodRunsListSelectorTool>(this); declareInterface<IAthenaEvtLoopPreSelectTool>(this); @@ -42,10 +39,7 @@ GoodRunsListSelectorTool::GoodRunsListSelectorTool( const std::string& type, con declareProperty( "BlackRunsListVec", m_blackrunslistVec, "list of input xml files" ); declareProperty( "BoolOperation", m_boolop ); declareProperty( "PassThrough", m_passthrough = true); - declareProperty( "DQFlagsFromCOOL", m_usecool = false); declareProperty( "VerboseDetStatus", m_verbose = false); - declareProperty( "DQFlagsQueryVec", m_dqflagsqueryVec, "vector of dqflags query strings"); - declareProperty( "RunRangeExpressionCOOL", m_runrangeexpr = "1" ); declareProperty( "RejectBlackRunsInEventSelector", m_rejectanybrl = false ); declareProperty( "EventSelectorMode", m_eventselectormode = false ); @@ -172,34 +166,6 @@ GoodRunsListSelectorTool::initialize() } } - if (m_dqflagsqueryVec.empty()) { m_usecool = false; } - /// get DetStatusSvc interface - if (!m_dqflagsqueryVec.empty() && m_usecool) { - if (service("DetStatusSvc",m_detstatussvc).isFailure()) { - ATH_MSG_ERROR ("Cannot get DetStatusSvc."); - return StatusCode::FAILURE; - } - } - - /// parse dqflags queries for cool - for (itr=m_dqflagsqueryVec.begin(); itr!=m_dqflagsqueryVec.end() && m_usecool; ++itr) { - ATH_MSG_DEBUG ("Parsing dqflags query : " << *itr); - std::vector<std::string> dqvec = GRLStrUtil::split(*itr); - if (dqvec.size()==3) { // assume that dqvec[2] == "LBSUMM" - m_dqformula[dqvec[0]] = new TFormula(dqvec[0].c_str(),dqvec[1].c_str()); - } else { - ATH_MSG_ERROR ("Error parsing dq query : " << *itr); - return StatusCode::FAILURE; - } - } - - /// parse any run-range expression - int formOk = m_inrunrange.setFormula(m_runrangeexpr.c_str()) ; - if ( 0!=formOk ) { - ATH_MSG_ERROR ("Cannot parse run range expression : " << m_runrangeexpr << " . Return Failure."); - return StatusCode::FAILURE; - } - return StatusCode::SUCCESS; } @@ -227,48 +193,8 @@ GoodRunsListSelectorTool::passEvent(const EventInfo* pEvent) pass = true; } /// decide from XML files - else if (!m_usecool) { - pass = this->passRunLB(runNumber,lumiBlockNr); - } - /// Cool based decision else { - /// check if run is in runrange, only done for Cool decision - if (m_inrunrange.getNPars()==1) { - double dummy(0); - double drunNr = static_cast<double>(runNumber); - pass = static_cast<bool>(m_inrunrange.EvalPar(&dummy,&drunNr)); - if (!pass) { - ATH_MSG_DEBUG ("passEvent() :: Event rejected based on provided run range."); - return false; - } - } - /// loop over all status words, print those which are bad - if (m_verbose) { - ATH_MSG_WARNING ("Now printing list of DQ flags:"); - DetStatusMap::const_iterator begin,end; - m_detstatussvc->getIter(begin,end); - for (DetStatusMap::const_iterator itr=begin;itr!=end;++itr) { - ATH_MSG_WARNING ("Status of " << itr->first << " is fullcode : " << itr->second.fullCode()); - } - } - /// decide based on COOL - double color(0.); - TFormula* form(0); - std::map< std::string,TFormula* >::iterator itr= m_dqformula.begin(); - for (; itr!=m_dqformula.end() && pass; ++itr) { - form = itr->second; - const DetStatus* ptr = m_detstatussvc->findStatus( (itr->first).c_str() ); - if (ptr!=0) { - ATH_MSG_DEBUG (itr->first << " status in LBSUMM found to be : " << ptr->colour()) ; - color = static_cast<double>( ptr->code() ) ; - pass = pass && static_cast<bool>( form->EvalPar( &color ) ); - } else { - ATH_MSG_ERROR ( "Could not find status for flag : " << itr->first << ". Do not pass LB." ); - pass = false; - } - } - if (pass) ATH_MSG_DEBUG ("passEvent() :: Event accepted based on info in LBSUMM."); - else ATH_MSG_DEBUG ("passEvent() :: Event rejected based on info in LBSUMM."); + pass = this->passRunLB(runNumber,lumiBlockNr); } return pass; @@ -307,48 +233,8 @@ GoodRunsListSelectorTool::passThisRunLB( const std::vector<std::string>& grlname pass = true; } /// decide from XML files - else if (!m_usecool) { - pass = this->passRunLB(runNumber,lumiBlockNr,grlnameVec,brlnameVec); - } - /// Cool based decision else { - /// check if run is in runrange, only done for Cool decision - if (m_inrunrange.getNPars()==1) { - double dummy(0); - double drunNr = static_cast<double>(runNumber); - pass = static_cast<bool>(m_inrunrange.EvalPar(&dummy,&drunNr)); - if (!pass) { - ATH_MSG_DEBUG ("passThisRunLB() :: Event rejected based on provided run range."); - return false; - } - } - /// loop over all status words, print those which are bad - if (m_verbose) { - ATH_MSG_WARNING ("Now printing list of DQ flags:"); - DetStatusMap::const_iterator begin,end; - m_detstatussvc->getIter(begin,end); - for (DetStatusMap::const_iterator itr=begin;itr!=end;++itr) { - ATH_MSG_WARNING ("Status of " << itr->first << " is fullcode : " << itr->second.fullCode()); - } - } - /// decide based on COOL - double color(0.); - TFormula* form(0); - std::map< std::string,TFormula* >::iterator itr= m_dqformula.begin(); - for (; itr!=m_dqformula.end() && pass; ++itr) { - form = itr->second; - const DetStatus* ptr = m_detstatussvc->findStatus( (itr->first).c_str() ); - if (ptr!=0) { - ATH_MSG_DEBUG (itr->first << " status in LBSUMM found to be : " << ptr->colour()) ; - color = static_cast<double>( ptr->code() ) ; - pass = pass && static_cast<bool>( form->EvalPar( &color ) ); - } else { - ATH_MSG_ERROR ( "Could not find status for flag : " << itr->first << ". Do not pass LB." ); - pass = false; - } - } - if (pass) ATH_MSG_DEBUG ("passThisRunLB() :: Event accepted based on info in LBSUMM."); - else ATH_MSG_DEBUG ("passThisRunLB() :: Event rejected based on info in LBSUMM."); + pass = this->passRunLB(runNumber,lumiBlockNr,grlnameVec,brlnameVec); } return pass; diff --git a/DataQuality/GoodRunsListsUser/share/GoodRunsListsUser_coolQuery.py b/DataQuality/GoodRunsListsUser/share/GoodRunsListsUser_coolQuery.py deleted file mode 100644 index 50bd78de1c6..00000000000 --- a/DataQuality/GoodRunsListsUser/share/GoodRunsListsUser_coolQuery.py +++ /dev/null @@ -1,47 +0,0 @@ -########################################################################################### -## IMPORTANT: Configuring the goodrunslist selector tool to work from COOL -## does not work in combination with the LumiBlockMetaDataTool -## USE WITH CAUTION! -########################################################################################### - -from AthenaCommon.AppMgr import ServiceMgr -from PoolSvc.PoolSvcConf import PoolSvc -ServiceMgr+=PoolSvc(SortReplicas=True) -from DBReplicaSvc.DBReplicaSvcConf import DBReplicaSvc -ServiceMgr+=DBReplicaSvc(UseCOOLSQLite=False) -from AthenaCommon.GlobalFlags import globalflags -globalflags.DetDescrVersion.set_Value_and_Lock('ATLAS-GEO-02-01-00') -#globalflags.ConditionsTag.set_Value_and_Lock('OFLCOND-SIM-00-00-03') - -from IOVDbSvc.CondDB import conddb -conddb.setGlobalTag('OFLCOND-SIM-00-00-03') -include("RecExCond/AllDet_detDescr.py") - -include("DetectorStatus/DetStatusSvc_CondDB.py") -conddb.addOverride('/GLOBAL/DETSTATUS/LBSUMM','DetStatusLBSumm-TopMix1') - -########################################################################################### -## Configure the goodrunslist selector tool to work from COOL -########################################################################################### - -from GoodRunsLists.GoodRunsListsConf import GoodRunsListSelectorTool -from GoodRunsLists.TopMixConfig import TopMixConfig -GoodRunsTool = GoodRunsListSelectorTool('GoodRunsTool') -dqflagsconfig = TopMixConfig() -GoodRunsTool.DQFlagsQueryVec = dqflagsconfig.getparseddqflags() -GoodRunsTool.DQFlagsFromCOOL = True -GoodRunsTool.RunRangeExpressionCOOL = '1' # 'run>=108175 || run>=10000 && run<=100000' # ala TFormula -#GoodRunsTool.VerboseDetStatus = True -#GoodRunsTool.OutputLevel = DEBUG - -########################################################################################### -## Add GRL selector tool to pre-eventselector -########################################################################################### - -## Klugde: eventselector currently needs private tool, will become public very soon! -## Public version is used by eg. LumiBlockMetaDataTool -## add the (private version of) grl selector tool to the eventselector -AthenaEventLoopMgr = Service( "AthenaEventLoopMgr" ) -AthenaEventLoopMgr.PreSelectTools += [ GoodRunsTool ] -AthenaEventLoopMgr.OutputLevel = WARNING - diff --git a/DetectorDescription/DetDescrCond/DetectorStatus/CMakeLists.txt b/DetectorDescription/DetDescrCond/DetectorStatus/CMakeLists.txt index 7d2f040c458..feedc4d9052 100644 --- a/DetectorDescription/DetDescrCond/DetectorStatus/CMakeLists.txt +++ b/DetectorDescription/DetDescrCond/DetectorStatus/CMakeLists.txt @@ -1,32 +1,18 @@ ################################################################################ # Package: DetectorStatus ################################################################################ +# Package is now a rump of a few Python libraries kept around for potential +# Run 1 compatibility + # Declare the package name: atlas_subdir( DetectorStatus ) # Declare the package's dependencies: atlas_depends_on_subdirs( PUBLIC - Control/AthenaBaseComps DetectorDescription/DetDescrCond/DetDescrConditions - GaudiKernel - PRIVATE - Control/StoreGate - Database/AthenaPOOL/AthenaPoolUtilities ) - -# Component(s) in the package: -atlas_add_library( DetectorStatusLib - src/*.cxx - PUBLIC_HEADERS DetectorStatus - LINK_LIBRARIES AthenaBaseComps DetDescrConditions GaudiKernel StoreGateLib SGtests - PRIVATE_LINK_LIBRARIES AthenaPoolUtilities ) - -atlas_add_component( DetectorStatus - src/components/*.cxx - LINK_LIBRARIES AthenaBaseComps DetDescrConditions GaudiKernel StoreGateLib SGtests AthenaPoolUtilities DetectorStatusLib ) + ) # Install files from the package: atlas_install_python_modules( python/*.py ) -atlas_install_joboptions( share/DetStatusSvc_CondDB.py share/DetStatusSvc_ToFileMetaData.py ) -atlas_install_scripts( share/detStatus_set.py share/detStatus_query.py share/detStatus_upload.py share/detStatus_merge.py ) diff --git a/DetectorDescription/DetDescrCond/DetectorStatus/DetectorStatus/DetStatusAlg.h b/DetectorDescription/DetDescrCond/DetectorStatus/DetectorStatus/DetStatusAlg.h deleted file mode 100755 index 457047b3276..00000000000 --- a/DetectorDescription/DetDescrCond/DetectorStatus/DetectorStatus/DetStatusAlg.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef DETSTATUS_DETSTATALG_H -#define DETSTATUS_DETSTATALG_H -// DetStatusAlg.h - a simple algorithm illustrating access to detector status -// information via the DetStatusSvc -// Richard Hawkings, started 18/12/06 - -#include "AthenaBaseComps/AthAlgorithm.h" -#include "GaudiKernel/MsgStream.h" - -class IDetStatusSvc; - -class DetStatusAlg: public AthAlgorithm { - public: - DetStatusAlg(const std::string& name, ISvcLocator* pSvcLocator); - ~DetStatusAlg(); - - StatusCode initialize(void); - StatusCode execute(void); - StatusCode finalize(void); - - private: - void doVeto(); - - const IDetStatusSvc* m_detstatussvc; - bool m_par_print; - bool m_par_veto; - unsigned int m_count; - unsigned int m_nveto; -}; - -#endif // DETSTATUS_DETSTATALG_H diff --git a/DetectorDescription/DetDescrCond/DetectorStatus/DetectorStatus/IDetStatusSvc.h b/DetectorDescription/DetDescrCond/DetectorStatus/DetectorStatus/IDetStatusSvc.h deleted file mode 100755 index c6d70a534e7..00000000000 --- a/DetectorDescription/DetDescrCond/DetectorStatus/DetectorStatus/IDetStatusSvc.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef DETSTATUS_IDETSTATUSSVC_H -#define DETSTATUS_IDETSTATUSSVC_H -// IDetStatusSvc.h - abstract interface to service managing detector status -// Richard Hawkings, started 13/12/06 - -#include "GaudiKernel/IInterface.h" -#include "DetDescrConditions/DetStatusMap.h" - -class IDetStatusSvc : virtual public IInterface { - - public: - static const InterfaceID& interfaceID(); - - // print all the detector status information - virtual void print() const =0; - - // return a pointer to the DetStatus object with the given name - // return 0 if there is none, or the DetStatus map cannot be found - virtual const DetStatus* findStatus(const std::string& name) const =0; - - // return const iterators to the DetStatusMap, or null if it cannot be found - virtual void getIter(DetStatusMap::const_iterator& begin, - DetStatusMap::const_iterator& end) const =0; - - // return true if the event is vetoed, according to the jo requirements - virtual bool vetoed() const =0; - -}; - -inline const InterfaceID& IDetStatusSvc::interfaceID() { - static const InterfaceID IID_IDetStatusSvc("IDetStatusSvc",1,0); - return IID_IDetStatusSvc; -} - -#endif // DETSTATUS_IDETSTATUSSVC_H diff --git a/DetectorDescription/DetDescrCond/DetectorStatus/doc/packagedoc.h b/DetectorDescription/DetDescrCond/DetectorStatus/doc/packagedoc.h index 0e43c75b430..5538c4bb58b 100644 --- a/DetectorDescription/DetDescrCond/DetectorStatus/doc/packagedoc.h +++ b/DetectorDescription/DetDescrCond/DetectorStatus/doc/packagedoc.h @@ -7,6 +7,8 @@ @section DetectorStatus_introductionDetectorStatus Introduction +*** THIS PACKAGE IS COMPLETELY DEPRECATED *** + The DetectorStatus package implements a service to manage detector status information, primarily to flag events where some or all subdetectors are unusable, or should be used with caution. The service maintains a DetStatusMap @@ -20,16 +22,6 @@ DetDescrConditons data objects package. For more details on detector status handling, see the CoolDetStatus wiki page at https://twiki.cern.ch/twiki/bin/view/Atlas/CoolDetStatus -The DetStatusSvc reads detector status information -from the conditions database, or from file-level meta-data. -A common interface is used to query the DetStatusMap object, which resides -in the transient detector store. To read detector status -information from the conditions database, include the following in your -job options: -<pre> -include("DetectorStatus/DetStatusSvc_CondDB.py") -</pre> - @section DetectorStatus_flagsDetectorStatus Flags and conditions DB storage Each DetStatus object has a corresponding string identifier, which is stored @@ -175,109 +167,7 @@ The LBSUMM folder in the OFLP200 database contains a default set of entries valid for all runs, given GREEN status for all detectors with zero dead fraction, tagged with the COOL tag DetStatusLBSumm_nominal. Entering the status for a particular run will then -override this default information. For testing purposes, it is possible to -enter information using a different tag, for example the predefined tag -DetStatusLBSumm_undefined has all status flags set to undefined for all runs, -and can be selected by using the job option line: -<pre> -include("DetectorStatus/DetStatusSvc_CondDB.py") -from IOVDbSvc.CondDB import conddb -conddb.addOverride('/GLOBAL/DETSTATUS/LBSUMM','DetStatusLBSumm_BadEMB') -</pre> - -@section DetectorStatus_queryDetectorStatus Querying the Detector Status in Athena algorithms - -The DetStatusSvc has various methods which provide access to the DetStatus -object asociated with a particular identifier string. You can retrieve a -pointer to the DetStatus for a given identifier, or retrieve iterators to -let you loop over all the status objects. The following code shows how -to do this: -<pre> - // get DetStatusSvc interface - const IDetStatusSvc* p_detstatussvc; - if (StatusCode::SUCCESS!=service("DetStatusSvc",p_detstatussvc)) { - m_log << MSG::ERROR << "Cannot get DetStatusSvc" << endmsg; - return StatusCode::FAILURE; - } - - // print all status information to MsgSvc - if (par_print) p_detstatussvc->print(); - - // test a particular one - SCTB - const DetStatus* ptr=p_detstatussvc->findStatus("SCTB"); - if (ptr!=0) { - m_log << MSG::INFO << "SCTB status found to be " << ptr->colour() << endmsg; - } else { - m_log << MSG::ERROR << "Could not find status of SCTB" << endmsg; - } - // loop over all status words, print those which are bad - DetStatusMap::const_iterator begin,end; - p_detstatussvc->getIter(begin,end); - for (DetStatusMap::const_iterator itr=begin;itr!=end;++itr) { - if (itr->second.code()<3) m_log << MSG::WARNING << "Status of " << - itr->first << " is bad: fullcode " << itr->second.fullCode() << endmsg; - } -</pre> - -The DetStatusSvc also implements a veto functionality, allowing you to specify -status requirements on events to be analysed. The joboption properties -StatusNames and StatusReqs are used to specify pairs of names and minimum -status levels (red=1, yellow=2, green=3). For example: -<pre> -DetStatusSvc.StatusNames=['SCTB','SCTECA'] -DetStatusSvc.StatusReqs=[2,3] -</pre> -specifies that the SCTB status must be at least 2 (yellow) and the SCTECA -(endcap A) -status must be at least 3 (green). There must be an equal number of entries -in the two lists. Once this is specified, the bool vetoed() method will be true -if the event should be vetoed according to these criteria. Detector status -identifiers whose first letters match up to the length of the matching -string will be considered to match, so e.g. the string SCT will match -SCTB, SCTECA and SCTECB. This is an easy way to set status requirements -on all parts of a detector. - -An alternative way to specify detector status is with a string of the form: -<pre> -DetStatusSvc.StringReqs='SCTB 2 SCTEA 3' -</pre> -This is of the same form as detector status requirements specifications in -the LumiCalc.py tool. - -@section DetectorStatus_algDetectorStatus The DetStatusAlg algorithm - -The DetStatusAlg algorithm provides a way to trigger use of the services, and -also serves as an example for accessing detector status information in user -code. It has the following joboption properties: - - Print: call DetStatusSvc::print() to print the current status objects - - Veto: call DetStatusSvc::vetoed() and count how many events are vetoed. -The veto functionality also sets the DetStatusAlg filterPassed property to -false, allowing it to be used in algorithm sequences. - -@section DetectorStatus_detStatustools Command-line tools - -Two command-line tools are provided to interact with the detector status -information: detStatus_query.py and detStatus_set.py. They can be used to -query or set the detector status for one or all of the status flags, and -print their options if given without arguments. For more -details, see the CoolDetStatus wiki page. - -@section DetectorStatus_jobOptionsDetectorStatus Job-option files - -The package has two main job-options, that setup the DetStatusSvc to -enable detector status to be read -from the conditions database, and write it to file-level meta-data. - -@subsection jobOptions1DetectorStatus DetStatusSvc_CondDB.py - -@include DetStatusSvc_CondDB.py - -@subsection joboptions2DetectorStatus DetStatusSvc_ToFileMetaData.py - -@include DetStatusSvc_ToFileMetaData.py - - - +override this default information. */ diff --git a/DetectorDescription/DetDescrCond/DetectorStatus/share/DetStatusSvc_CondDB.py b/DetectorDescription/DetDescrCond/DetectorStatus/share/DetStatusSvc_CondDB.py deleted file mode 100755 index ad0c7950f72..00000000000 --- a/DetectorDescription/DetDescrCond/DetectorStatus/share/DetStatusSvc_CondDB.py +++ /dev/null @@ -1,16 +0,0 @@ -# Setup DetStatusSvc to read from conditions database -# -# service setup is implicit - only needed explicitly if you set parameters -# as given in following commented out 3 lines -# from AthenaCommon.AppMgr import ServiceMgr -# from DetectorStatus.DetectorStatusConf import DetStatusSvc -# ServiceMgr+=DetStatusSvc(StringReqs='TRTB 2') - -# set up conditions DB access -# conditions DB tag is not specified - will be taken from hierarchical tagging -#from IOVDbSvc.CondDB import conddb -#conddb.addFolder('GLOBAL_OFL','/GLOBAL/DETSTATUS/LBSUMM') -import logging -local_logger = logging.getLogger('DetStatusSvc_CondDB.py') -local_logger.warning('Use of DetStatusSvc DEPRECATED for Run 2; this file will go away soon') -del local_logger diff --git a/DetectorDescription/DetDescrCond/DetectorStatus/share/DetStatusSvc_ToFileMetaData.py b/DetectorDescription/DetDescrCond/DetectorStatus/share/DetStatusSvc_ToFileMetaData.py deleted file mode 100644 index 8b0101360e3..00000000000 --- a/DetectorDescription/DetDescrCond/DetectorStatus/share/DetStatusSvc_ToFileMetaData.py +++ /dev/null @@ -1,10 +0,0 @@ -include.block("DetectorStatus/DetStatusSvc_ToFileMetaData.py") -# write Detector Status information to FileMetaData -# add the folder to the list of objects which IOVDbSvc will transfer to the meta-data -# We no longer want to write any of this stuff -#from IOVDbSvc.CondDB import conddb -#conddb.toMetaData('/GLOBAL/DETSTATUS/LBSUMM') -import logging -local_logger = logging.getLogger('DetectorStatus/DetStatusSvc_ToFileMetaData.py') -local_logger.warning('Use of DetStatusSvc DEPRECATED for Run 2; this file will go away soon') -del local_logger diff --git a/DetectorDescription/DetDescrCond/DetectorStatus/share/detStatus_merge.py b/DetectorDescription/DetDescrCond/DetectorStatus/share/detStatus_merge.py deleted file mode 100755 index c7dadec844b..00000000000 --- a/DetectorDescription/DetDescrCond/DetectorStatus/share/detStatus_merge.py +++ /dev/null @@ -1,228 +0,0 @@ -#!/usr/bin/env python -# detStatus_merge.py - tool for merging detector status info / several folders -# Richard Hawkings, 28/1/08 -# execute without arguments for help - -from CoolConvUtilities import AtlCoolLib -from DetectorStatus import DetStatusLib -from PyCool import cool - -class mergeStatus(AtlCoolLib.coolTool): - def setup(self,args): - # set values of non-optional parameters - self.destdbstr=str(args[0]) - # access to name encoding - self.namelookup=DetStatusLib.DetStatusNames() - self.folderinfo=[] - self.destfolder='/GLOBAL/DETSTATUS/LBSUMM' - self.tag='' - self.truncate=False - self.numbers=False - - def usage(self): - "Define additional syntax for options" - self._usage1() - print 'destdbname' - print '--and=<folder> : set folder name to be Anded' - print '--override=<folder>:<tag> : set folder and tag name for override' - print '--destfolder=<folder> : set destinaton folder (default /GLOBAL/DETSTATUS/LBSUMM' - print '--desttag=<tag> : set destination tag' - print '--numbers : Transfer NConfig and NWorking from source folders if given' - print '--truncate : truncate IOVs which exceed given interval' - self._usage2() - - def procopts(self,opts): - "Process additional options" - for o,a in opts: - if (o=='--and' or o=='--override'): - fields=str(a).split(':') - folder=fields[0] - if len(fields)>1: - tag=fields[1] - else: - tag='HEAD' - self.folderinfo+=[(folder,tag,(o=='--override'))] - if (o=='--destfolder'): - self.destfolder=str(a) - if (o=='--numbers'): - self.numbers=True - if (o=='--desttag'): - self.tag=str(a) - if (o=='--truncate'): - self.truncate=True - - def execute(self): - # print "Name is %s" AtlCoolLib.getHostname() - # prepare an empty StatusList for each channel - statuslists={} - for chan in self.namelookup.allNums(): - statuslists[chan]=DetStatusLib.StatusList() - - # deduce the source database instance name, looking for xyzP200 - idx=self.conn.find('P200') - if (idx>=3): - dbinst=self.conn[idx-3:idx+4] - print "Working with database instance %s" % dbinst - else: - print "Cannot deduce database instance name, assume COMP200" - dbinst='COMP200' - - # Extract timestamp information for mapping to run/LB - tsconvdb=AtlCoolLib.indirectOpen('COOLONL_TRIGGER/'+dbinst,oracle=self.oracle) - # initialize the converter - tsToRLB = AtlCoolLib.TimeStampToRLB(tsconvdb,self.since,self.until) - tsconvdb.closeDatabase() - - StartTime = tsToRLB.StartTime - EndTime = tsToRLB.EndTime - - # open auxillary databases for online and DCS info - onlinedb=AtlCoolLib.indirectOpen('COOLONL_GLOBAL/'+dbinst,oracle=self.oracle) - dcsdb=AtlCoolLib.indirectOpen('COOLOFL_GLOBAL/'+dbinst,oracle=self.oracle) - - # loop over all 'AND' folders and merge information - ngood=0 - nbad=0 - for (afolder,atag,override) in self.folderinfo: - print "Process folder %s tag %s override %d" % (afolder,atag, override) - try: - atsindexed=0 - isonline=0 - if (afolder.find("ONL") != -1): - isonline=1 - - isdcs=0 - if (afolder.find("DCS") != -1): - isdcs=1 - - tostart=self.since - toend=self.until - ifolder=None - - if (isonline): - ifolder=onlinedb.getFolder(afolder) - elif (isdcs): - ifolder=dcsdb.getFolder(afolder) - else: - ifolder=self.db.getFolder(afolder) - - descr=ifolder.description() - - if (descr.find("<timeStamp>time") != -1): - atsindexed=1 - tostart=StartTime - toend=EndTime - - objs=None - if (isonline | isdcs): - objs=ifolder.browseObjects(tostart,toend,cool.ChannelSelection.all()) - else: - objs=ifolder.browseObjects(tostart,toend,cool.ChannelSelection.all(),atag) - - while objs.goToNext(): - obj=objs.currentRef() - chan=obj.channelId() - if (chan in statuslists.keys()): - start=obj.since() - stop=obj.until() - payload=obj.payload() - code=payload['Code'] - deadfrac=payload['deadFrac'] - thrust=payload['Thrust'] - if ('NConfig' in payload.keys()): - nconfig=payload['NConfig'] - nworking=payload['NWorking'] - else: - nconfig=-1 - nworking=-1 - - if ('Comment' in payload.keys()): - comment=payload['Comment'] - else: - comment='' - #override=False - - if (atsindexed): - start=tsToRLB.getRLB(start, True) - stop=tsToRLB.getRLB(stop, False)+1 - - statuslists[chan].merge(DetStatusLib.StatusObj(start,stop,code,deadfrac,thrust,nconfig,nworking,comment),override) - ngood+=1 - else: - print "Data found for unexpected channel %i" % chan - nbad+=1 - except Exception,e: - print e - print "Problem accessing folder %s" % afolder - nbad+=1 - - print "All folders processed with %i good and %i items of bad data" % (ngood,nbad) - - # now compose COOL update - # establish write connection - writedb=AtlCoolLib.forceOpen(self.destdbstr) - if (writedb is None): return - try: - cfolder=writedb.getFolder(self.destfolder) - print "Write data to existing folder %s" % self.destfolder - spec=cfolder.payloadSpecification() - except Exception,e: - print "Creating destination folder %s" % self.destfolder - spec=cool.RecordSpecification() - spec.extend("Code",cool.StorageType.Int32) - spec.extend("deadFrac",cool.StorageType.Float) - spec.extend("Thrust",cool.StorageType.Float) - if self.numbers: - spec.extend("NConfig",cool.StorageType.Int32) - spec.extend("NWorking",cool.StorageType.Int32) - spec.extend("Comment",cool.StorageType.String255) - - cfolder=AtlCoolLib.ensureFolder(writedb,self.destfolder,spec,AtlCoolLib.athenaDesc(self.runLumi,'CondAttrListCollection'),cool.FolderVersioning.MULTI_VERSION) - # folder now exists, prepare for bulk update - nobj=0 - nbad=0 - cfolder.setupStorageBuffer() - if (self.tag==''): - print "Storing data to HEAD" - else: - print "Storing data to tag %s" % self.tag - - for (chan,slist) in statuslists.items(): - size1=slist.size() - size2=slist.compress() - print "List for channel %i size %i / %i after compression" % (chan,size1,size2) - for sobj in slist.list(): - data=cool.Record(spec) - data['Code']=sobj.code - data['deadFrac']=sobj.deadfrac - data['Thrust']=sobj.thrust - if self.numbers: - data['NConfig']=sobj.nconfig - data['NWorking']=sobj.nworking - if spec.exists('Comment'): - data['Comment']=sobj.comment - since=sobj.start - until=sobj.stop - # truncate IOV if needed - if (self.truncate and (sobj.start<self.since or sobj.stop>self.until)): - since=max(sobj.start,self.since) - until=min(sobj.stop,self.until) - print "Channel %i: truncating IOV [%i,%i] to range [%i,%i]" % (chan,sobj.start,sobj.stop,since,until) - if (since<until): - try: - cfolder.storeObject(since,until,data,chan,self.tag) - nobj+=1 - except Exception,e: - print "Exception when storing data",e - nbad+=1 - else: - print "IOV removed by truncation" - - cfolder.flushStorageBuffer() - print "Data stored with %i good and %i bad updates" % (nobj,nbad) - - - - -# run the tool -mytool=mergeStatus("detStatus_merge.py",True,2,2,['and=','override=','destfolder=','desttag=','numbers','truncate']) diff --git a/DetectorDescription/DetDescrCond/DetectorStatus/share/detStatus_query.py b/DetectorDescription/DetDescrCond/DetectorStatus/share/detStatus_query.py deleted file mode 100755 index 8627dd041e9..00000000000 --- a/DetectorDescription/DetDescrCond/DetectorStatus/share/detStatus_query.py +++ /dev/null @@ -1,233 +0,0 @@ -#!/usr/bin/env python -# detStatus_query.py - tool for querying detector status in COOL conditions DB -# Richard Hawkings, 5/2/07 -# execute without arguments for help -import os,sys -from PyCool import cool,coral -from CoolConvUtilities import AtlCoolLib -from DetectorStatus import DetStatusLib - -class queryStatus(AtlCoolLib.coolTool): - def setup(self,args): - # set values of non-optional parameters - self.foldername='' - self.tag=str(args[0]) - self.dets=args[1:] - self.summ=False - self.graphics=False - self.pictfile="" - # access to name encoding - self.namelookup=DetStatusLib.DetStatusNames() - - def usage(self): - """ Define the additional syntax for options """ - self._usage1() - print 'COOL_tag det1 {det2 ..}' - print 'det specifies a flag or flags to be checked (ALL=all flags)' - print '--folder <folder>: Set foldername to be used' - print '--summ : Produce summary statistics instead of listing all flags' - print '--graphics : Display status matrix graphically' - print '--pictfile=file : Write matrix to file (.eps,.gif etc)' - self._usage2() - - def procopts(self,opts): - "Process the additional non-standard options" - for o,a in opts: - if (o=='--folder'): - self.foldername=str(a) - elif (o=='--summ'): - self.summ=True - elif (o=='--graphics'): - self.graphics=True - self.summ=True - elif (o=='--pictfile'): - self.pictfile=str(a) - self.graphics=True - self.summ=True - - def execute(self): - # find folder name from timestamp options - if (self.foldername==''): - folder=DetStatusLib.folderName(self.runLumi) - else: - folder=self.foldername - # setup channel object - (chanlist,chansel)=self.getChannels(self.dets) - if (self.summ): - # prepare for summary - get number of LBs in each folder - lumiblocks=self.getLBs() - runlist=lumiblocks.keys() - runlist.sort() - lbtot=0 - lboffset={} - for run in runlist: - lb=lumiblocks[run] - lboffset[run]=lbtot - lbtot+=lb - statusbychan={} - chanindex={} - index=0 - for chan in chanlist: - # statusbychan gives [nBLACK,nUNKNOWN,nRED,nYELLOW,nGREEN] - statusbychan[chan]=[0,0,0,0,0] - chanindex[chan]=index - index+=1 - if (self.graphics): - hist,canvas=self.initGraphics(len(chanlist),lbtot) - print ">== Reading status from folder %s tag %s" % (folder,self.tag) - try: - cfolder=self.db.getFolder(folder) - tag=self.tag - if (tag=="HEAD"): tag="" - objs=cfolder.browseObjects(self.since,self.until,chansel,tag) - while objs.goToNext(): - obj=objs.currentRef() - chan=obj.channelId() - if chan not in chanlist: continue - name=self.namelookup.name(obj.channelId()) - since=obj.since() - until=obj.until() - sincerun=since >> 32 - untilrun=until >> 32 - payload=obj.payload() - code=payload['Code'] - if (code>=0): code=code & 3 - deadFrac=payload['deadFrac'] - deadThrust=payload['Thrust'] - if (self.summ): - # increment the counts of all appropriate runs - for (run,lbn) in lumiblocks.iteritems(): - # slice represents IOV of LBs in this run - startslice=1+(run<<32) - endslice=1+(run<<32)+lbn - comstart=max(startslice,since) - comend=min(endslice,until) - nlb=comend-comstart - if nlb>0: - #print "Overlap %i LB for db [%i %i] [%i %i] in run %i with %i LB status %i %i" % (nlb,since >> 32, since & 0xFFFFFFFF, until >> 32, until & 0xFFFFFFFF, run,lbn,code,chan) - ((statusbychan[chan])[code+1])+=nlb - if (self.graphics): - for i in range(0,nlb): - ixfill=i+lboffset[run]+(comstart & 0xFFFFFFFF) - - hist.Fill(chanindex[chan]+1,ixfill,[7,4,41,30,45][code+1]) - else: - # printout data - print name,":", - if (self.runLumi): - print '[',(since >> 32),',',(since % (1 << 32) ),'] - [',(until >> 32),',',(until % (1 << 32) ),' ]', - else: - print '{',AtlCoolLib.timeString(since),',',AtlCoolLib.timeString(until),'} ', - print '%s %5.3f %5.3f' % (DetStatusLib.colour(code),deadFrac,deadThrust), - if ('Comment' in payload.keys()): - print payload['Comment'], - if ('NConfig' in payload.keys()): - print "(%i/%i)" % (payload['NConfig'],payload['NWorking']), - print - except Exception,e: - print e - print 'Problem accessing COOL data' - sys.exit(1) - # produce summary if required - if (self.summ): - print ">=== Status flags for runs %i to %i with total of %i LBs\n>=== Folder %s tag %s" % (self.runmin,self.runmax,lbtot,self.foldername,self.tag) - print "Chan Flag NMiss (frac) NBlck (frac) NUnkn (frac) NRed (frac) NYlw (frac) NGrn (frac)" - for chan in chanlist: - counters=statusbychan[chan] - cfrac=5*[0] - nmiss=lbtot - for i in range(0,5): - cfrac[i]=float(counters[i])/float(lbtot) - nmiss-=counters[i] - print "%i %6s %6i %5.3f %6i %5.3f %6i %5.3f %6i %5.3f %6i %5.3f %6i %5.3f" % (chan,self.namelookup.name(chan),nmiss,float(nmiss)/float(lbtot),counters[0],cfrac[0],counters[1],cfrac[1],counters[2],cfrac[2],counters[3],cfrac[3],counters[4],cfrac[4]) - if (self.graphics): - hist.Draw("COL") - self.addAxis(canvas,chanindex,chanlist,runlist,lboffset,lbtot) - canvas.Update() - if (self.pictfile!=""): - print "Writing picture to %s" % self.pictfile - canvas.Print(self.pictfile) - raw_input("Press return to remove canvas when done") - - def getLBs(self): - "Get the number of lumiblocks in each run, using the LBLB folder" - lbdata={} - tdaqdbname='COOLONL_TRIGGER/COMP200' - tdaqdb=AtlCoolLib.indirectOpen(tdaqdbname,True,True) - if tdaqdb is None: - print "ERROR - cannot access %s for run/LB mapping lookup" % tdaqdbname - try: - lbfolder=tdaqdb.getFolder('/TRIGGER/LUMI/LBLB') - objs=lbfolder.browseObjects(self.since,self.until,cool.ChannelSelection(0)) - oldrun=0 - maxlb=0 - while objs.goToNext(): - obj=objs.currentRef() - iovsince=obj.since() - run=int(iovsince >> 32) - lb=int(iovsince & 0xFFFFFFFF) - if (run!=oldrun): - if oldrun!=0: - lbdata[oldrun]=maxlb - maxlb=0 - oldrun=run - if lb>maxlb: maxlb=lb - if oldrun!=0: lbdata[oldrun]=maxlb - - except Exception,e: - print e - print "ERROR accessing data for run/LB mapping" - return lbdata - - def getChannels(self,dets): - "Return a list of the channels to be selected, and COOL selector" - # COOL selector may give more channels - chanlist=[] - for det in dets: - updet=det.upper() - if updet in ['ALL','A']: - chanlist+=self.namelookup.allNums() - else: - chanlist+=self.namelookup.nums(updet) - chanlist.sort() - chansel=cool.ChannelSelection(min(chanlist),max(chanlist)) - return (chanlist,chansel) - - def initGraphics(self,ndet,nlb): - "Initialise graphics and setup histogram for status matrix" - from ROOT import gROOT,TCanvas,TH2F,gStyle - hist=TH2F("DetectorStatus","%s tag %s runs %i to %i (%i LBs)" % (self.foldername,self.tag,self.runmin,self.runmax,nlb),ndet+1,0.5,ndet+1.5,nlb,0.5,nlb+0.5) - hist.Fill(ndet+1,1,49.) - hist.SetNdivisions(0) - gROOT.SetStyle("Plain") - gStyle.SetPalette(0) - gStyle.SetOptStat(0) - gStyle.SetOptFit(0) - canvas=TCanvas(self.foldername,self.foldername,0,0,500,600) - return (hist,canvas) - - def addAxis(self,canvas,chanindex,chanlist,runlist,lboffset,lbtot): - from ROOT import TLatex - txt=TLatex() - txt.SetNDC() - txt.SetTextAngle(90.) - txt.SetTextSize(0.012) - for chan in chanlist: - txt.DrawLatex(0.11+0.8*float(chanindex[chan])/(len(chanindex)+1),0.06,self.namelookup.name(chan)) - txt.SetTextAngle(0.) - txt.SetTextSize(0.02) - ndiv=1+len(lboffset)/20 - j=0 - for run in runlist: - lb=lboffset[run] - j+=1 - if (j==ndiv): - txt.DrawLatex(0.91,0.11+0.8*float(lb)/lbtot,str(run)) - j=0 - - - -mytool=queryStatus('detStatus_query.py',True,3,99,['summ','graphics','folder=','pictfile=']) - - - diff --git a/DetectorDescription/DetDescrCond/DetectorStatus/share/detStatus_set.py b/DetectorDescription/DetDescrCond/DetectorStatus/share/detStatus_set.py deleted file mode 100755 index 59993e5a364..00000000000 --- a/DetectorDescription/DetDescrCond/DetectorStatus/share/detStatus_set.py +++ /dev/null @@ -1,141 +0,0 @@ -#!/usr/bin/env python -# detStatus_set.py - tool for setting detector status in COOL conditions DB -# Richard Hawkings, 5/2/07 -# execute without arguments for help -import os,sys -from PyCool import cool -from CoolConvUtilities import AtlCoolLib -from DetectorStatus import DetStatusLib - -class setStatus(AtlCoolLib.coolTool): - def setup(self,args): - # set values of non-optional parameters - self.isdata=False - self.comments=False - self.numbers=False - self.foldername='' - self.fversion=cool.FolderVersioning.MULTI_VERSION - if (len(args)>0): - self.tag=str(args[0]) - self.det=str(args[1]) - self.light=str(args[2]) - self.isdata=True - else: - self.det='ALL' - self.deadfrac=0. - self.deadthrust=1. - self.commstr='' - self.nconfig=0 - self.nworking=0 - self.newtag=False - if len(args)>3: self.deadfrac=float(args[3]) - if len(args)>4: self.deadthrust=float(args[4]) - if len(args)==6: - self.commstr=str(args[5]) - self.comments=True - if len(args)==7: - self.nconfig=int(args[5]) - self.nworking=int(args[6]) - self.numbers=True - # access to name encoding - self.namelookup=DetStatusLib.DetStatusNames() - - def usage(self): - """ Define the additional syntax for options """ - self._usage1() - print 'COOL_tag detector traffic_light dead_frac dead_thr {<comm> | NConfig NWorking}' - self._usage2() - print '--folder <folder>: Set foldername to be used' - print '--comm: Include comment field when creating structure' - print '--newtag: Allow creation of a new tag, not already existing in folder' - print '--numbers: Include numbers fields (NConfig, NWorking) when creating structure' - print '--single: Create folder as single version (default multi)' - - def procopts(self,opts): - "Process the additional non-standard options" - for o,a in opts: - if (o=='--comm'): - self.comments=True - if (o=='--numbers'): - self.numbers=True - if (o=='--folder'): - self.foldername=str(a) - if (o=='--single'): - self.fversion=cool.FolderVersioning.SINGLE_VERSION - if (o=='--newtag'): - self.newtag=True - - def execute(self): - chanlist=self.getchans() - if len(chanlist)==0: sys.exit(1) - # now do update - setup folder specification and create if needed - spec=cool.RecordSpecification() - spec.extend("Code",cool.StorageType.Int32) - spec.extend("deadFrac",cool.StorageType.Float) - spec.extend("Thrust",cool.StorageType.Float) - if (self.numbers): - spec.extend("NConfig",cool.StorageType.Int32) - spec.extend("NWorking",cool.StorageType.Int32) - if (self.comments): - spec.extend("Comment",cool.StorageType.String255) - # folder name depends on choice of run-lumi or timestamp - if (self.foldername==''): - folder=DetStatusLib.folderName(self.runLumi) - else: - folder=self.foldername - print ">== Store object in folder",folder - cfolder=AtlCoolLib.ensureFolder(self.db,folder,spec,AtlCoolLib.athenaDesc(self.runLumi,'CondAttrListCollection')+'<named/>',self.fversion) - if (cfolder is None): sys.exit(1) - # if we do not have data to add - finish here - if (not self.isdata): return - - # translate detector to COOL channel - status=DetStatusLib.colourVal(self.light) - if (status is None): - print"Cannot define status from value",self.light - sys.exit(1) - # check if tag exists - if self.tag!='HEAD': - taglist=cfolder.listTags() - if self.tag not in taglist: - if self.newtag: - print ">== Tag %s will be created" % self.tag - else: - print ">== ERROR: Tag %s does not exist (use --newtag if you really want to create it)" % self.tag - sys.exit(1) - # now write data - payload=cool.Record(spec) - payload['Code']=status - payload['deadFrac']=self.deadfrac - payload['Thrust']=self.deadthrust - if (self.comments): - payload['Comment']=self.commstr - if (self.numbers): - payload['NConfig']=self.nconfig - payload['NWorking']=self.nworking - for channel in chanlist: - print '>== Store object with IOV [',self.since,',',self.until,'] channel',channel,'and tag',self.tag,'status info',status,self.deadfrac,self.deadthrust - try: - if (self.tag=="HEAD"): - cfolder.storeObject(self.since,self.until,payload,channel) - else: - cfolder.storeObject(self.since,self.until,payload,channel,self.tag,True) - except Exception,e: - print e - print 'Exception thrown when storing for channel',channel - print '>== Storing COOL object FAILED' - sys.exit(1) - - def getchans(self): - updet=self.det.upper() - if (updet=='ALL'): - chanlist=self.namelookup.allNums() - else: - try: - chanlist=[self.namelookup.num(updet)] - except KeyError: - print '>== ERROR: Status name',self.det,'is not defined' - chanlist=[] - return chanlist - -mytool=setStatus('detStatus_set.py',False,1,8,['comm','numbers','single','newtag','folder=']) diff --git a/DetectorDescription/DetDescrCond/DetectorStatus/share/detStatus_upload.py b/DetectorDescription/DetDescrCond/DetectorStatus/share/detStatus_upload.py deleted file mode 100755 index 16b7ccab3cd..00000000000 --- a/DetectorDescription/DetDescrCond/DetectorStatus/share/detStatus_upload.py +++ /dev/null @@ -1,169 +0,0 @@ -#!/usr/bin/env python -# detStatus_upload.py - tool for uploading detector status in COOL -# conditions DB from a file giving list of runs (and optionally LBs) -# Richard Hawkings, 5/2/07 -# execute without arguments for help -# the format of the file is a list of runs on separate lines, -# or a list of <run> <LB1> <LB2> (inclusive) for LB ranges within run - -import os,sys -from PyCool import cool -from CoolConvUtilities import AtlCoolLib -from DetectorStatus import DetStatusLib - -class setStatus(AtlCoolLib.coolTool): - def setup(self,args): - # set values of non-optional parameters - self.filename=str(args[0]) - self.tag=str(args[1]) - self.detlist=args[2:] - self.foldername='' - self.flag='' - self.newtag=False - # access to name encoding - self.namelookup=DetStatusLib.DetStatusNames() - - def usage(self): - """ Define the additional syntax for options """ - self._usage1() - print 'input_filename COOL_tag det1 {det2 det3 ...}' - print 'Options are:' - print '--folder=<folder> : Folder to use (default /GLOBAL/DETSTATUS/LBSUMM)' - print '--flag=<flag> : Flag value to assume if not in input file (R/Y/G or 1/2/3)' - print '--newtag: Allow creation of a new tag, not already existing in folder' - print 'Provides a way to bulk upload a set of flag values from a file' - print 'specifying run numbers or run-LB ranges' - - - def procopts(self,opts): - "Process the additional non-standard options" - for o,a in opts: - if (o=='--folder'): - self.foldername=str(a) - if (o=='--flag'): - self.flag=str(a) - if (o=='--newtag'): - self.newtag=True - - def execute(self): - # check if flag given on command line, if not will get from each file - # input line - if (self.flag!=''): - status=DetStatusLib.colourVal(self.flag) - if (status is None): sys.exit(1) - chanlist=self.getchans() - if len(chanlist)==0: sys.exit(1) - - # folder name depends on choice of run-lumi or timestamp, or explicit - if (self.foldername==''): - folder=DetStatusLib.folderName(self.runLumi) - else: - folder=self.foldername - print ">== Store object in folder",folder - hascomment=(folder=='/GLOBAL/DETSTATUS/SHIFTOFL' or folder=='/GLOBAL/DETSTATUS/SHIFTONL') - - # now do update - setup folder specification and create if needed - spec=cool.RecordSpecification() - spec.extend("Code",cool.StorageType.Int32) - spec.extend("deadFrac",cool.StorageType.Float) - spec.extend("Thrust",cool.StorageType.Float) - if (hascomment): - spec.extend("Comment",cool.StorageType.String255) - - cfolder=AtlCoolLib.ensureFolder(self.db,folder,spec,AtlCoolLib.athenaDesc(self.runLumi,'CondAttrListCollection')+'<named/>',cool.FolderVersioning.MULTI_VERSION) - if (cfolder is None): sys.exit(1) - - # check if tag exists - if self.tag!='HEAD': - taglist=cfolder.listTags() - if self.tag not in taglist: - if self.newtag: - print ">== Tag %s will be created" % self.tag - else: - print ">== ERROR: Tag %s does not exist (use --newtag if you really want to create it)" % self.tag - sys.exit(1) - - # now write data according to list in file - datafile=open(self.filename,'r') - # setup storage buffer ready for input - cfolder.setupStorageBuffer() - nobj=0 - print "Reading data from file %s to insert in tag %s" % (self.filename,self.tag) - for line in datafile.readlines(): - tokens=line[:-1].split() - if (len(tokens)>0 and tokens[0][0]!='#'): - # if no flag value specified on command line, take from first - # argument on line - if (self.flag==''): - status=DetStatusLib.colourVal(tokens[0]) - if (status is None): - print "Cannot define status from line %s" % line - sys.exit(-1) - del tokens[0] - run1=int(tokens[0]) - run2=run1 - if len(tokens)==2: run2=int(tokens[1]) - if len(tokens)<3: - lb1=0 - lb2=(1 << 32)-1 - else: - lb1=int(tokens[1]) - lb2=int(tokens[2]) - if len(tokens)>3: - # take the rest of the line from where the comment starts - comment=line[line.find(tokens[3]):-1] - else: - comment="" - if (comment!="" and not hascomment): - print "Comment %s specified for folder type without comments" % comment - sys.exit(-1) - if comment=="": - commstr="" - else: - commstr=' comment "%s"' % comment - print "Update status for [%i,%i] to [%i,%i] to %s%s" % (run1,lb1,run2,lb2,DetStatusLib.colour(status),commstr) - payload=cool.Record(spec) - payload['Code']=status - payload['deadFrac']=0. - payload['Thrust']=0. - if (hascomment): - payload['Comment']=comment - since=(run1 << 32)+lb1 - until=(run2 << 32)+lb2+1 - for chan in chanlist: - if (self.tag=="HEAD"): - cfolder.storeObject(since,until,payload,chan) - else: - cfolder.storeObject(since,until,payload,chan,self.tag,True) - nobj+=1 - datafile.close() - if (nobj>0): - chk=raw_input("Execute upload of %i objects (y/n)" % nobj) - if (chk.upper()=="Y"): - try: - cfolder.flushStorageBuffer() - print "Data written to COOL" - except Exception,e: - print "Error during bulk upload",e - else: - print "Upload ABORTED - not done" - print "All done" - - def getchans(self): - chanlist=[] - for det in self.detlist: - updet=det.upper() - if (updet=='ALL'): - # set chanlist to ONLY all detectors - chanlist=self.namelookup.allNums() - else: - try: - chanlist+=self.namelookup.nums(updet) - except KeyError: - print '>== ERROR: Status name',det,'is not defined' - print "Defined list of %i status channels:" % len(chanlist) , - for i in chanlist: print self.namelookup.name(i), - print - return chanlist - -mytool=setStatus('detStatus_upload.py',False,3,99,['newtag','flag=','folder=']) diff --git a/DetectorDescription/DetDescrCond/DetectorStatus/src/DetStatusAlg.cxx b/DetectorDescription/DetDescrCond/DetectorStatus/src/DetStatusAlg.cxx deleted file mode 100755 index 8f526e17532..00000000000 --- a/DetectorDescription/DetDescrCond/DetectorStatus/src/DetStatusAlg.cxx +++ /dev/null @@ -1,74 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// DetStatusAlg.cxx -// Richard Hawkings, started 18/12/04 -// implementation for DetStatusAlg algorithm - -#include "DetectorStatus/IDetStatusSvc.h" -#include "DetDescrConditions/DetStatus.h" -#include "DetectorStatus/DetStatusAlg.h" - - -DetStatusAlg::DetStatusAlg(const std::string& name, ISvcLocator* pSvcLocator) - :AthAlgorithm (name, pSvcLocator), - m_detstatussvc(nullptr), - m_par_print(false),m_par_veto(false), - m_count(0),m_nveto(0) -{ - // declare properties - declareProperty("Print",m_par_print); - declareProperty("Veto",m_par_veto); -} - -DetStatusAlg::~DetStatusAlg() -{} - -StatusCode DetStatusAlg::initialize() { - ATH_MSG_INFO( "Initialize called" ); - // get DetStatusSvc - if (StatusCode::SUCCESS!=service("DetStatusSvc",m_detstatussvc)) { - ATH_MSG_ERROR( "Cannot get DetStatusSvc" ); - return StatusCode::FAILURE; - } - if (m_par_veto) ATH_MSG_INFO( "Events with bad status will be vetoed" ); - return StatusCode::SUCCESS; -} - -StatusCode DetStatusAlg::execute() { - // execute method - dispatch calls to DetStatusSvc - if (m_par_print) m_detstatussvc->print(); - - // veto functionality - if (m_par_veto) doVeto(); - - // if nothing done, retrieve the map anyway, to ensure conditions data - // gets read in to StoreGate from CondDB - // this is needed to ensure it can be written out to file-level meta-data - if (!(m_par_print || m_par_veto)) { - DetStatusMap::const_iterator begin,end; - m_detstatussvc->getIter(begin,end); - ATH_MSG_DEBUG( "Dummy retrieve of DetStatusMap done" ); - } - - return StatusCode::SUCCESS; -} - -void DetStatusAlg::doVeto() { - ++m_count; - if (m_detstatussvc->vetoed()) { - ATH_MSG_DEBUG( "Event vetoed due to bad status" ); - ++m_nveto; - // set filter to false so this can be used in an algorithm Sequence - setFilterPassed(false); - } -} - -StatusCode DetStatusAlg::finalize() { - if (m_par_veto) { - ATH_MSG_INFO( "Saw " << m_count << " events of which " << - m_nveto << " vetoed due to bad status" ); - } - return StatusCode::SUCCESS; -} diff --git a/DetectorDescription/DetDescrCond/DetectorStatus/src/DetStatusSvc.cxx b/DetectorDescription/DetDescrCond/DetectorStatus/src/DetStatusSvc.cxx deleted file mode 100755 index 10e372b9258..00000000000 --- a/DetectorDescription/DetDescrCond/DetectorStatus/src/DetStatusSvc.cxx +++ /dev/null @@ -1,257 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// DetStatusSvc.cxx -// Richard Hawkings, started 13/12/06 - -#include "GaudiKernel/MsgStream.h" -#include "GaudiKernel/MsgStream.h" -#include "StoreGate/StoreGateSvc.h" -#include "AthenaPoolUtilities/CondAttrListCollection.h" -#include "DetDescrConditions/DetStatusMap.h" -#include "DetStatusSvc.h" - -DetStatusSvc::DetStatusSvc(const std::string& name, ISvcLocator* svc) : - AthService(name,svc), - m_detStore ("DetectorStore", name), - m_par_conddbfolder("/GLOBAL/DETSTATUS/LBSUMM"), - m_par_detreqs(""), - m_sgkey("DetectorStatus") -{ - // declare properties - declareProperty("CondDBFolder",m_par_conddbfolder); - declareProperty("StatusNames",m_par_detname); - declareProperty("StatusReqs",m_par_detreq); - declareProperty("StringReqs",m_par_detreqs); -} - -DetStatusSvc::~DetStatusSvc() {} - -const InterfaceID& DetStatusSvc::type() const -{ -return IDetStatusSvc::interfaceID(); -} - -StatusCode DetStatusSvc::queryInterface(const InterfaceID& riid, void** ppvInterface) -{ - if (IDetStatusSvc::interfaceID().versionMatch(riid)) { - *ppvInterface=(IDetStatusSvc*)this; - } else { - return Service::queryInterface(riid,ppvInterface); - } - return StatusCode::SUCCESS; -} - -StatusCode DetStatusSvc::initialize() -{ - // service initialisation - get parameters, setup default cache - // and register for condDB callbacks if needed - - if (StatusCode::SUCCESS!=Service::initialize()) - ATH_MSG_ERROR("Service initialisation failed" ); - - ATH_MSG_DEBUG( "in initialize()" ); - - ATH_CHECK( m_detStore.retrieve() ); - - // register callback if needed - const DataHandle<CondAttrListCollection> cptr; - if (StatusCode::SUCCESS==m_detStore->regFcn(&DetStatusSvc::update,this, - cptr,m_par_conddbfolder)) { - ATH_MSG_INFO( "Register callback to read detector status from CondDB folder " - << m_par_conddbfolder ); - } else { - ATH_MSG_FATAL( "Could not register callback to CondDB folder " - << m_par_conddbfolder ); - return StatusCode::FAILURE; - } - // put (empty) DetStatusMap in TDS ready for callback to update - DetStatusMap* statmap=new DetStatusMap(); - ATH_CHECK( m_detStore->record(statmap,m_sgkey) ); - - // check status requirements - list from separate folders - if (m_par_detname.size()!=m_par_detreq.size()) { - ATH_MSG_INFO( - "Inconsistent setting of StatusNames and StatusReqs properities" ); - return StatusCode::FAILURE; - } - m_detname.clear(); - m_detreq.clear(); - for (unsigned int i=0;i<m_par_detname.size();++i) { - m_detname.push_back(m_par_detname[i]); - m_detreq.push_back(m_par_detreq[i]); - } - // add in list from string - if (m_par_detreqs!="") { - if (StatusCode::FAILURE==parseDetReqString()) return StatusCode::FAILURE; - } - if (m_detname.size()>0) { - ATH_MSG_INFO( "Number of detector status requirements set: " << - m_detname.size() ); - for (unsigned int i=0;i<m_detname.size();++i) - ATH_MSG_VERBOSE( m_detname[i] << ": >= " << m_detreq[i] ); - } - return StatusCode::SUCCESS; -} - -StatusCode DetStatusSvc::finalize() { - return StatusCode::SUCCESS; -} - -StatusCode DetStatusSvc::parseDetReqString() { - // parse the detreq string into pairs of status flags and values - size_t iofs0,iofs1,iofs2; - iofs0=0; - while (iofs0!=std::string::npos) { - iofs1=m_par_detreqs.find(' ',iofs0); - iofs2=std::string::npos; - if (iofs1!=std::string::npos) { - iofs2=m_par_detreqs.find(' ',iofs1+1); - std::string nums=m_par_detreqs.substr(iofs1+1,1); - const char* numv=nums.c_str(); - int status=0; - if (isdigit(*numv)) { - status=atoi(numv); - } else if (nums=="B" || nums=="b") { - status=-1; - } else if (nums=="U" || nums=="u") { - status=0; - } else if (nums=="R" || nums=="r") { - status=1; - } else if (nums=="Y" || nums=="y") { - status=2; - } else if (nums=="G" || nums=="g") { - status=3; - } else { - ATH_MSG_ERROR( "Character " << *numv << " does not define status" ); - return StatusCode::FAILURE; - } - m_detname.push_back(m_par_detreqs.substr(iofs0,iofs1-iofs0)); - m_detreq.push_back(status); - } - if (iofs2!=std::string::npos) { - iofs0=iofs2+1; - } else { - iofs0=std::string::npos; - } - } - return StatusCode::SUCCESS; -} - -StatusCode DetStatusSvc::update( IOVSVC_CALLBACK_ARGS_P( /* I */ ,keys) ) { - if (msgLvl(MSG::DEBUG)) { - msg() << MSG::DEBUG << "Update callback invoked for keys: "; - for (std::list<std::string>::const_iterator itr=keys.begin(); - itr!=keys.end(); ++itr) msg() << " " << *itr; - msg() << endmsg; - } - // read the conditions object - const CondAttrListCollection* cptr=0; - if (StatusCode::SUCCESS==m_detStore->retrieve(cptr,m_par_conddbfolder) && - cptr!=0) { - // find status object in TDS and reset it ready for new status info - DetStatusMap* statmap=0; - ATH_CHECK( m_detStore->retrieve(statmap,m_sgkey) ); - statmap->clear(); - // loop over all the elements in the collection - for (CondAttrListCollection::const_iterator citr=cptr->begin(); - citr!=cptr->end();++citr) { - unsigned int chan=citr->first; - const coral::AttributeList& alist=citr->second; - // find the string name for this channel - const std::string name=cptr->chanName(chan); - if (name!="") { - statmap->add(name,DetStatus(alist["Code"].data<int>(), - alist["deadFrac"].data<float>(), - alist["Thrust"].data<float>())); - } else { - ATH_MSG_ERROR( - "COOL data problem: no status name defined for channel " << - chan ); - } - } - ATH_MSG_DEBUG( "Updated DetStatusMap has size " << statmap->size() ); - statmap->toOutputStream(msg()); - msg() << endmsg; - } else { - ATH_MSG_ERROR( "Problem reading detector status from CondDB" ); - return StatusCode::FAILURE; - } - return StatusCode::SUCCESS; -} - -const DetStatusMap* DetStatusSvc::getStatusMap() const { - const DetStatusMap* statmap=0; - // return DetStatusMap maintained in the TDS - if (StatusCode::SUCCESS == m_detStore->retrieve(statmap,m_sgkey)) - return statmap; - // No map found, return empty one - static DetStatusMap empty; - return ∅ -} - -void DetStatusSvc::print() const { - const DetStatusMap* statmap=getStatusMap(); - if (statmap!=0) { - msg() << MSG::INFO; - statmap->toOutputStream(msg()); - } else { - ATH_MSG_ERROR( "Cannot find DetStatusMap to print" ); - } -} - -const DetStatus* DetStatusSvc::findStatus(const std::string& name) - const { - // return a pointer to the DetStatus object for a given name - // or null pointer if nothing found - const DetStatusMap* statmap=getStatusMap(); - if (statmap!=0) { - DetStatusMap::const_iterator itr=statmap->find(name); - if (itr!=statmap->end()) return &(itr->second); - } - return 0; -} - -void DetStatusSvc::getIter(DetStatusMap::const_iterator& begin, - DetStatusMap::const_iterator& end) const { - const DetStatusMap* statmap=getStatusMap(); - begin=statmap->begin(); - end=statmap->end(); -} - -bool DetStatusSvc::vetoed() const { - bool veto=false; - DetStatusMap::const_iterator begin,end; - getIter(begin,end); - // for each detector status, check if there is a requirement on it - // also check that all requirements were satisfied in case there - // is no status flag seen corresponding to a requirement - // this will not catch all status flags satisfying a wildcard requirement - std::vector<int> usedreq(m_detname.size()); - for (unsigned int i=0;i<m_detname.size();++i) usedreq[i]=0; - unsigned int nseen=0; - for (DetStatusMap::const_iterator itr=begin;itr!=end;++itr) { - const std::string& name=itr->first; - for (unsigned int i=0;i<m_detname.size();++i) { - if (m_detname[i]==name.substr(0,m_detname[i].size())) { - if (usedreq[i]==0) ++nseen; - ++usedreq[i]; - if (itr->second.code()<m_detreq[i]) { - ATH_MSG_DEBUG( "Event vetoed by status " << name << ", code " - << itr->second.code() << " below requirement of " << - m_detreq[i] ); - veto=true; - } - break; - } - } - } - // check all requirements saw a status flag - if (nseen<m_detname.size()) { - ATH_MSG_DEBUG( "Only " << nseen << " of " << m_detname.size() - << " requirements saw status flags - event vetoed" ); - veto=true; - } - return veto; -} diff --git a/DetectorDescription/DetDescrCond/DetectorStatus/src/DetStatusSvc.h b/DetectorDescription/DetDescrCond/DetectorStatus/src/DetStatusSvc.h deleted file mode 100755 index 3fa48838c57..00000000000 --- a/DetectorDescription/DetDescrCond/DetectorStatus/src/DetStatusSvc.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef DETSTATUS_DETSTATSVC_H -#define DETSTATUS_DETSTATSVC_H -// DetStatusSvc.h - concrete implementation of service managing detector status -// Richard Hawkings, started 13/12/06 - -#include "AthenaBaseComps/AthService.h" -#include "StoreGate/StoreGate.h" -#include "DetectorStatus/IDetStatusSvc.h" - -class StoreGateSvc; -class DetStatusMap; - -class DetStatusSvc : public virtual IDetStatusSvc, public virtual AthService -{ - template <class TYPE> class SvcFactory; - -public: - DetStatusSvc(const std::string& name, ISvcLocator* svc); - virtual ~DetStatusSvc(); - - virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvInterface); - - virtual const InterfaceID& type() const; - - virtual StatusCode initialize(); - virtual StatusCode finalize(); - - // print all the detector status information - virtual void print() const; - - // return a pointer to the DetStatus object with the given name - // return 0 if there is none, or the DetStatus map cannot be found - virtual const DetStatus* findStatus(const std::string& name) const; - - // return const iterators to the DetStatusMap, or null if it cannot be found - virtual void getIter(DetStatusMap::const_iterator& begin, - DetStatusMap::const_iterator& end) const; - - // return true if the event is vetoed, according to the jo requirements - virtual bool vetoed() const; - - private: - StatusCode parseDetReqString(); - StatusCode update( IOVSVC_CALLBACK_ARGS ); - const DetStatusMap* getStatusMap() const; - - ServiceHandle<StoreGateSvc> m_detStore; - - std::string m_par_conddbfolder; - // detstatus parameters given as pairs of values in separate params - std::vector<std::string> m_par_detname; - std::vector<int> m_par_detreq; - // detstatus parameters given as a single string - std::string m_par_detreqs; - // resulting actual list of pairs used - std::vector<std::string> m_detname; - std::vector<int> m_detreq; - const std::string m_sgkey; -}; - -#endif // DETSTATUS_DETSTATSVC_H - diff --git a/DetectorDescription/DetDescrCond/DetectorStatus/src/components/DetectorStatus_entries.cxx b/DetectorDescription/DetDescrCond/DetectorStatus/src/components/DetectorStatus_entries.cxx deleted file mode 100644 index a460af7061f..00000000000 --- a/DetectorDescription/DetDescrCond/DetectorStatus/src/components/DetectorStatus_entries.cxx +++ /dev/null @@ -1,6 +0,0 @@ -#include "../DetStatusSvc.h" -#include "DetectorStatus/DetStatusAlg.h" - -DECLARE_COMPONENT( DetStatusSvc ) -DECLARE_COMPONENT( DetStatusAlg ) - diff --git a/DetectorDescription/DetDescrCond/DetectorStatus/utils/detStatus_AddComment.py b/DetectorDescription/DetDescrCond/DetectorStatus/utils/detStatus_AddComment.py deleted file mode 100755 index a0c642bf955..00000000000 --- a/DetectorDescription/DetDescrCond/DetectorStatus/utils/detStatus_AddComment.py +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env python - -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -# simple utility to add Comment column to given folder -# Richard Hawkings, 1/2/10 -# Please do not run this script - -import sys -from PyCool import cool -from CoolConvUtilities import AtlCoolLib - -if len(sys.argv)<2: - print "usage",sys.argv[0],"<dbname> {<foldername>}" - print "Adds Comment column to detector status folder (default /GLOBAL/DETSTATUS/LBSUMM)" - sys.exit(-1) - -dbname=sys.argv[1] -foldername="/GLOBAL/DETSTATUS/LBSUMM" -if len(sys.argv)>2: foldername=sys.argv[2] - -print "Opening database",dbname -try: - db=AtlCoolLib.forceOpen(dbname) - print "Access folder",foldername - folder=db.getFolder(foldername) -except Exception,e: - print "Could not get access to folder",foldername - sys.exit(-1) -oldspec=folder.payloadSpecification() -if ('Comment' not in oldspec.keys()): - newspec=cool.RecordSpecification() - newspec.extend("Comment",cool.StorageType.String255) - newrec=cool.Record(newspec) - # set default values - newrec["Comment"]="" - try: - folder.extendPayloadSpecification(newrec) - print "Folder updated OK" - except Exception,e: - print "Exception",e,"when trying to extend payload" -else: - print "Folder already updated to contain Comment field" diff --git a/DetectorDescription/DetDescrCond/DetectorStatus/utils/detStatus_AddNumbers.py b/DetectorDescription/DetDescrCond/DetectorStatus/utils/detStatus_AddNumbers.py deleted file mode 100755 index c7a7b6d9038..00000000000 --- a/DetectorDescription/DetDescrCond/DetectorStatus/utils/detStatus_AddNumbers.py +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env python - -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -# simple utility to add NConfig and NWorking columns to given folder -# Richard Hawkings, 28/7/09 -# Please do not run this script - -import sys -from PyCool import cool -from CoolConvUtilities import AtlCoolLib - -if len(sys.argv)<2: - print "usage",sys.argv[0],"<dbname> {<foldername>}" - print "Adds number columns to detector status folder (default /GLOBAL/DETSTATUS/LBSUMM)" - sys.exit(-1) - -dbname=sys.argv[1] -foldername="/GLOBAL/DETSTATUS/LBSUMM" -if len(sys.argv)>2: foldername=sys.argv[2] - -print "Opening database",dbname -try: - db=AtlCoolLib.forceOpen(dbname) - print "Access folder",foldername - folder=db.getFolder(foldername) -except Exception,e: - print "Could not get access to folder",foldername - sys.exit(-1) -oldspec=folder.payloadSpecification() -if ('NConfig' not in oldspec.keys()): - newspec=cool.RecordSpecification() - newspec.extend("NConfig",cool.StorageType.Int32) - newspec.extend("NWorking",cool.StorageType.Int32) - newrec=cool.Record(newspec) - # set default values - newrec["NConfig"]=-1 - newrec["NWorking"]=-1 - try: - folder.extendPayloadSpecification(newrec) - print "Folder updated OK" - except Exception,e: - print "Exception",e,"when trying to extend payload" -else: - print "Folder already updated to contain NConfig" diff --git a/DetectorDescription/DetDescrCond/DetectorStatus/utils/detStatus_AsBuilt.py b/DetectorDescription/DetDescrCond/DetectorStatus/utils/detStatus_AsBuilt.py deleted file mode 100755 index 1a2ad1252be..00000000000 --- a/DetectorDescription/DetDescrCond/DetectorStatus/utils/detStatus_AsBuilt.py +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/env python - -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -# detStatus_AsBuilt.py - tool for setting /GLOBAL/DETSTATUS/ASBUILT folder -# Richard Hawkings, 28/7/09 -# execute without arguments for help -import os,sys -from PyCool import cool -from CoolConvUtilities import AtlCoolLib -from DetectorStatus import DetStatusLib - -class setBuilt(AtlCoolLib.coolTool): - def setup(self,args): - # set values of non-optional parameters - self.isdata=False - self.det='ALL' - if len(args)>0: - self.det=str(args[0]) - self.nbuilt=int(args[1]) - self.isdata=True - self.foldername='/GLOBAL/DETSTATUS/ASBUILT' - # access to name encoding - self.namelookup=DetStatusLib.DetStatusNames() - - def usage(self): - """ Define the additional syntax for options """ - self._usage1() - print 'detector value' - self._usage2() - - def procopts(self,opts): - "Process the additional non-standard options" - for o,a in opts: - pass - - def execute(self): - chanlist=self.getchans() - if len(chanlist)==0: sys.exit(1) - # now do update - setup folder specification and create if needed - spec=cool.RecordSpecification() - spec.extend("NBuilt",cool.StorageType.Int32) - print ">== Store object in folder",self.foldername - cfolder=AtlCoolLib.ensureFolder(self.db,self.foldername,spec,AtlCoolLib.athenaDesc(True,'CondAttrListCollection')+'<named/>',cool.FolderVersioning.SINGLE_VERSION) - if (cfolder is None): sys.exit(1) - # if we do not have data to add - finish here - if (not self.isdata): return - - # now write data - payload=cool.Record(spec) - payload['NBuilt']=self.nbuilt - for channel in chanlist: - print '>== Store object with IOV [',self.since,',',self.until,'] channel',channel,'NBuilt=',self.nbuilt - try: - cfolder.storeObject(self.since,self.until,payload,channel) - except Exception,e: - print e - print 'Exception thrown when storing for channel',channel - print '>== Storing COOL object FAILED' - sys.exit(1) - - def getchans(self): - updet=self.det.upper() - if (updet=='ALL'): - chanlist=self.namelookup.allNums() - else: - try: - chanlist=[self.namelookup.num(updet)] - except KeyError: - print '>== ERROR: Status name',self.det,'is not defined' - chanlist=[] - return chanlist - -mytool=setBuilt('detStatus_AsBuilt.py',False,1,3,[]) diff --git a/DetectorDescription/DetDescrCond/DetectorStatus/utils/detStatus_NameChannels.py b/DetectorDescription/DetDescrCond/DetectorStatus/utils/detStatus_NameChannels.py deleted file mode 100755 index 546d85300d7..00000000000 --- a/DetectorDescription/DetDescrCond/DetectorStatus/utils/detStatus_NameChannels.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env python - -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -# simple utility to set channel names for a detector status folder -# Richard Hawkings, 16/2/07 -# should not normally be needed, unless have to restart the DB - -import sys -from CoolConvUtilities import AtlCoolLib -from DetectorStatus import DetStatusLib - -if len(sys.argv)<2: - print "usage",sys.argv[0],"<dbname> {<foldername>}" - print "Adds channel names to detector status folder (default /GLOBAL/DETSTATUS/LBSUMM)" - sys.exit(-1) - -dbname=sys.argv[1] -foldername="/GLOBAL/DETSTATUS/LBSUMM" -if len(sys.argv)>2: foldername=sys.argv[2] - -mynames=DetStatusLib.DetStatusNames() -print "Opening database",dbname -db=AtlCoolLib.forceOpen(dbname) -print "Access folder",foldername -folder=db.getFolder(foldername) -chanlist=mynames.allNums() -for ichan in chanlist: - channame=mynames.name(ichan) - print "Channel ",ichan," name ",channame, - if (folder.existsChannel(ichan)): - folder.setChannelName(ichan,channame) - print "... Name set for existing channel" - else: - folder.createChannel(ichan,channame) - print "... Created" -# check we have <named/> in the metadata -namestr='<named/>' -desc=folder.description() -if (desc.find(namestr)==-1): - print "Folder description does not have %s - will add it" % namestr - desc=desc+namestr - print "Setting folder description to",desc - try: - folder.setDescription(desc) - print "Folder description modified" - except Exception,e: - print "Could not set folder description:",e -print "All done" diff --git a/DetectorDescription/DetDescrCond/DetectorStatus/utils/detStatus_nameAll.py b/DetectorDescription/DetDescrCond/DetectorStatus/utils/detStatus_nameAll.py deleted file mode 100755 index ec9026cd64c..00000000000 --- a/DetectorDescription/DetDescrCond/DetectorStatus/utils/detStatus_nameAll.py +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/env python - -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -# detStatus_nameAll.py <onlpwd> <oflpwd> -# execute detStatus_NameChannels.py for all production DB folders in Oracle -# please do not run this script - -import os,sys - -if len(sys.argv)!=3: - print "Usage",sys.argv[0]," <global_onl_pwd> <global_ofl_pwd>" - sys.exit(-1) -pwd=[sys.argv[1],sys.argv[2]] -print pwd - -# entries specified as (X,Y,leaffolder) -# X=0 for online, 1 for offline -# Y=0 for OFLP200, 1 for COMP200 - -todo=[(1,0,'LBSUMM'), - (1,0,'DQCALCOFL'), - (1,0,'DQMFOFL'), - (1,0,'SHIFTOFL'), - (0,1,'DQMFONL'), - (0,1,'SHIFTONL'), - (0,1,'DQMFONLLB'), - (1,1,'DCSOFL'), - (1,1,'DQCALCOFL'), - (1,1,'DQMFOFL'), - (1,1,'LBSUMM'), - (1,1,'SHIFTOFL') - ] - -ndone=0 -nbad=0 -for (iofl,icom,folder) in todo: - server=['ATONR_GPN','ATLAS_COOLWRITE'][iofl] - schema=['ATLAS_COOLONL_GLOBAL','ATLAS_COOLOFL_GLOBAL'][iofl] - dbname=['OFLP200','COMP200'][icom] - user=schema+'_W' - password=pwd[iofl] - chanlist='131 134 135 141 144 145' - comm='./detStatus_NameChannels.py "oracle://%s;schema=%s;dbname=%s;user=%s;password=%s" /GLOBAL/DETSTATUS/%s' % (server,schema,dbname,user,password,folder) - # comm='~/w0/cool/pytools/cool_dropChannel.py %s %s %s %s /GLOBAL/DETSTATUS/%s %s' % (server,schema,password,dbname,folder,chanlist) - #print comm - rc=os.system(comm) - # rc=0 - if (rc==0): - ndone+=1 - else: - nbad=+1 - -print "Loop done: %i folders updated, %i bad" % (ndone,nbad) diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonDQAMonitoring/share/MuonDQAMonitoring_CommRunsTier0.py b/MuonSpectrometer/MuonValidation/MuonDQA/MuonDQAMonitoring/share/MuonDQAMonitoring_CommRunsTier0.py index a91288b8a4b..da8d4924900 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonDQAMonitoring/share/MuonDQAMonitoring_CommRunsTier0.py +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonDQAMonitoring/share/MuonDQAMonitoring_CommRunsTier0.py @@ -46,7 +46,6 @@ recFlags.doMuon = True recFlags.doMuonCombined = False recFlags.doHist = True #====================================================================== -recFlags.doDetStatus = False # because of bug in DetectorStatus/DetStatusSvc_CondDB.py" recFlags.doInDet = False recFlags.doCalo = False recFlags.doLArg = False diff --git a/Reconstruction/RecExample/RecExCommon/share/AnalysisCommon_topOptions.py b/Reconstruction/RecExample/RecExCommon/share/AnalysisCommon_topOptions.py index 2e2f17f498e..abba4bb4e4c 100644 --- a/Reconstruction/RecExample/RecExCommon/share/AnalysisCommon_topOptions.py +++ b/Reconstruction/RecExample/RecExCommon/share/AnalysisCommon_topOptions.py @@ -120,24 +120,6 @@ except Exception: protectedInclude( "PartPropSvc/PartPropSvc.py" ) include.block( "PartPropSvc/PartPropSvc.py" ) -# Detector Status -if rec.doDetStatus() and not athenaCommonFlags.isOnline(): - try: - include("DetectorStatus/DetStatusSvc_CondDB.py") - pass - except Exception: - treatException("Could not load DetStatusSvc_CondDb !") - rec.doFileMetaData=False - pass - - if rec.doFileMetaData(): - #DR FIXME not sure about commissioing exception, filemetadata should be in filteredESD as well - if rec.doWriteRDO() or rec.doWriteESD() or rec.doWriteAOD() or rec.doDPD(): - protectedInclude("DetectorStatus/DetStatusSvc_ToFileMetaData.py") - pass - pass - pass - #Output file TagInfo and metadata #from AthenaCommon.AppMgr import ServiceMgr as svcMgr #svcMgr.TagInfoMgr.ExtraTagValuePairs += ["beam_type", jobproperties.Beam.beamType()] diff --git a/Reconstruction/RecExample/RecExCond/share/RecExCommon_flags.py b/Reconstruction/RecExample/RecExCond/share/RecExCommon_flags.py index bd2be7c3e88..7ac7e2664d1 100755 --- a/Reconstruction/RecExample/RecExCond/share/RecExCommon_flags.py +++ b/Reconstruction/RecExample/RecExCond/share/RecExCommon_flags.py @@ -125,7 +125,6 @@ RecExCommonFlags = { 'doAODall' : True, # write all ID track particles if available 'doAODCaloCells' : True, # make AOD cell container 'OutputLevel': INFO, # general msg output level VERBOSE DEBUG INFO - 'doDetStatus' : True, # include DetStatusSvc_CondDB.py and optionaly DetStatusSvc_ToFileMetaData.py 'doTimeLimit': False, # if stop execution when allocated time elapsed 'doTruth' : True, # id use the truth 'doDumpMC' : False, # if dump mc truth in log file @@ -539,10 +538,6 @@ if rec.doWriteRDO(): if rec.readESD or rec.readAOD: raise RuntimeError, "Cannot have readESD or readAOD if doWriteRDO" - if rec.readRDO() and globalflags.InputFormat()!='bytestream': - # this is a RDO to RDO copy, do not put detector status - rec.doDetStatus=False - # in case several read specified, favour the highest one if rec.readAOD(): logRecExCommon_flags.info( "read AOD : all algs switched off " ) @@ -665,7 +660,6 @@ if rec.Commissioning(): rec.doWriteTAG = False rec.doWriteTAGCOM = False rec.doWriteESD = False - rec.doDetStatus=False rec.doHist=False #-------------------------------------------------------------- diff --git a/Reconstruction/RecExample/RecExConfig/python/RecFlags.py b/Reconstruction/RecExample/RecExConfig/python/RecFlags.py index a1bcccfc254..cc9632c4a58 100755 --- a/Reconstruction/RecExample/RecExConfig/python/RecFlags.py +++ b/Reconstruction/RecExample/RecExConfig/python/RecFlags.py @@ -550,13 +550,6 @@ class OutputLevel(JobProperty): allowedValues=[ ALL,VERBOSE,DEBUG,INFO,WARNING,ERROR,FATAL ] StoredValue=INFO # -class doDetStatus(JobProperty): - """ If True, include DetStatusSvc_CondDB.py and optionaly DetStatusSvc_ToFileMetaData.py - """ - statusOn=True - allowedTypes=['bool'] - StoredValue=True -# class readAOD(JobProperty): """ If True reads AOD file """ @@ -1035,7 +1028,7 @@ doDumpTDS, doDumpTES, doFloatingPointException, abortOnUncheckedStatusCode, abor doEdmMonitor, doHist, doJiveXML, doPersint,doVP1, doNameAuditor, \ doRestrictedESD, doShowSizeStatistics, doTimeLimit, doTruth,\ doWriteAOD, doWritexAOD, doWriteESD, doWriteDPD, doWriteBS, doWriteRDO, doWriteTAG, doWriteTAGCOM, PoolTAGCOMOutput, readAOD, readTAG, readRDO, \ -readESD, doDetStatus, AMITag, AutoConfiguration, RunNumber, triggerStream, projectName, \ +readESD, AMITag, AutoConfiguration, RunNumber, triggerStream, projectName, \ doInDet,doLArg,doTile,doCalo,doMuon,doForwardDet,doLucid,doZdc,doAlfa,doAFP,doFwdRegion,doJetMissingETTag,doEgamma,doMuonCombined,doTau,doFTK,doTrigger,doBTagging, Production, doPhysValMonHists, \ doHeavyIon, doHIP, doLowPt, doMinimalRec, noESDTrigger,doFileMetaData,ScopingLevel, Commissioning, oldRecExCommissionConfig, mergingStreamName, LCGCMTVersion, \ AtlasReleaseVersion, inputFileFromAthenaVersion, doApplyAODFix, doAODSelect, doRDOTrigger, doFastPhysMonitoring, RootFastPhysMonOutput,doWriteCalibHits, doTriggerFilter, triggerFilterList, doContainerRemapping, doPhysicsValidationAugmentation, doESDReconstruction, doExpressProcessing, doPersistencyOptimization, doCaloRinger, doAODMerging] diff --git a/Trigger/TrigFTK/TrigFTKSim/share/skeleton.FTKStandaloneSim.py b/Trigger/TrigFTK/TrigFTKSim/share/skeleton.FTKStandaloneSim.py index 522acda7688..07d810f8b80 100644 --- a/Trigger/TrigFTK/TrigFTKSim/share/skeleton.FTKStandaloneSim.py +++ b/Trigger/TrigFTK/TrigFTKSim/share/skeleton.FTKStandaloneSim.py @@ -927,13 +927,6 @@ elif hasattr(runArgs, 'inputRDOFile') : protectedInclude( "PartPropSvc/PartPropSvc.py" ) include.block( "PartPropSvc/PartPropSvc.py" ) - # Detector Status - if rec.doDetStatus() and not athenaCommonFlags.isOnline(): - try: - include("DetectorStatus/DetStatusSvc_CondDB.py") - except Exception: - treatException("Could not load DetStatusSvc_CondDb !") - rec.doFileMetaData=False else: raise RuntimeError('No FTK inputs given. A TXT_FTKIP, NTUP_FTKIP or RDO file is mandatory.') diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/share/L1Simulation_topOptions.py b/Trigger/TrigT1/L1Topo/L1TopoSimulation/share/L1Simulation_topOptions.py index 3adcb674d2e..945838b183d 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/share/L1Simulation_topOptions.py +++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/share/L1Simulation_topOptions.py @@ -51,21 +51,6 @@ if rec.LoadGeometry(): protectedInclude( "PartPropSvc/PartPropSvc.py" ) include.block( "PartPropSvc/PartPropSvc.py" ) -# Detector Status -if rec.doDetStatus() and not athenaCommonFlags.isOnline(): - try: - include("DetectorStatus/DetStatusSvc_CondDB.py") - except Exception: - treatException("Could not load DetStatusSvc_CondDb !") - rec.doFileMetaData=False - - if rec.doFileMetaData(): - #DR FIXME not sure about commissioing exception, filemetadata should be in filteredESD as well - if rec.doWriteRDO() or rec.doWriteESD() or rec.doWriteAOD() or rec.doDPD(): - protectedInclude("DetectorStatus/DetStatusSvc_ToFileMetaData.py") - - - #Output file TagInfo and metadata if rec.oldFlagCompatibility: print "RecExCommon_flags.py flags values:" -- GitLab