diff --git a/CMakeLists.txt b/CMakeLists.txt index e47b76d8be..51b6dc0764 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -136,7 +136,6 @@ add_subdirectory(CalPatRec) add_subdirectory(CommonMC) add_subdirectory(CommonReco) add_subdirectory(Compression) -add_subdirectory(ConditionsService) add_subdirectory(ConfigTools) add_subdirectory(CosmicRayShieldGeom) add_subdirectory(CosmicReco) diff --git a/ConditionsService/CMakeLists.txt b/ConditionsService/CMakeLists.txt deleted file mode 100644 index 06392478cf..0000000000 --- a/ConditionsService/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -cet_make_library( - SOURCE - src/ConditionsService.cc - LIBRARIES PUBLIC - - Offline::ConfigTools - Offline::Mu2eInterfaces - Offline::GeometryService - art::Framework_Services_Registry -) - -cet_build_plugin(ConditionsService art::service - REG_SOURCE src/ConditionsService_service.cc - LIBRARIES REG - Offline::ConditionsService - -) - - -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/data/conditions_01.txt ${CURRENT_BINARY_DIR} data/conditions_01.txt ) - -install(DIRECTORY data DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/Offline/ConditionsService) - -install_source(SUBDIRS src) -install_headers(USE_PROJECT_NAME SUBDIRS inc) diff --git a/ConditionsService/data/conditions_01.txt b/ConditionsService/data/conditions_01.txt deleted file mode 100644 index 11dd90c583..0000000000 --- a/ConditionsService/data/conditions_01.txt +++ /dev/null @@ -1 +0,0 @@ -//THIS IS A DEPRECATED FILE, DO NOT EDIT AND REMOVE ITS USE FROM YOUR SCRIPTS diff --git a/ConditionsService/inc/ConditionsHandle.hh b/ConditionsService/inc/ConditionsHandle.hh deleted file mode 100644 index 247adceab0..0000000000 --- a/ConditionsService/inc/ConditionsHandle.hh +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef ConditionsService_ConditionsHandle_hh -#define ConditionsService_ConditionsHandle_hh - -// -// A safe pointer to a ConditionsEntity. -// -// -// Original author Rob Kutschke -// - -#include - -#include "Offline/ConditionsService/inc/ConditionsService.hh" - -namespace mu2e { - template - class ConditionsHandle - { - public: - ConditionsHandle( std::string const& key, - std::string const& version="current") - { - art::ServiceHandle sg; - _entity = sg->getElement(key,version); - } - ~ConditionsHandle() { } - - ENTITY const * operator->() const { return _entity;} - ENTITY const & operator*() const { return *_entity;} - ENTITY const * operator->() { return _entity;} - ENTITY const & operator*() { return *_entity;} - - ConditionsHandle() : _entity(0) {} - ConditionsHandle(const ConditionsHandle& other ) : _entity(other._entity) {} - ConditionsHandle& operator=(const ConditionsHandle& other) { - if(this != &other){ - _entity = other._entity; - } - return *this; - } - - private: - // unnecessary - ENTITY* operator&(); - - ENTITY* _entity; - }; -} - -#endif /* ConditionsService_ConditionsHandle_hh */ diff --git a/ConditionsService/inc/ConditionsService.hh b/ConditionsService/inc/ConditionsService.hh deleted file mode 100644 index 826c803456..0000000000 --- a/ConditionsService/inc/ConditionsService.hh +++ /dev/null @@ -1,124 +0,0 @@ -#ifndef ConditionsService_ConditionsService_hh -#define ConditionsService_ConditionsService_hh - -// -// Primitive conditions data service. -// It does not yet do validty checking. -// -// -// Original author Rob Kutschke -// -// -// Notes -// 1) There are two types of accessors. -// a) ones that just forward to the config file, for those types of entities. -// b) The method that we want to move to eventually. -// CalibHandle handle; -// conditionsService->get( key, handle, version) -// -// C++ include files -#include - -// Framework include files -#include "fhiclcpp/ParameterSet.h" -#include "art/Framework/Services/Registry/ActivityRegistry.h" -#include "art/Framework/Services/Registry/ServiceHandle.h" -#include "art/Framework/Services/Registry/ServiceDeclarationMacros.h" -#include "cetlib_except/exception.h" - -// Mu2e include files. -#include "Offline/ConfigTools/inc/SimpleConfig.hh" -#include "Offline/Mu2eInterfaces/inc/ConditionsEntity.hh" - -// Other external include files. -#include "boost/shared_ptr.hpp" - -namespace mu2e { - - class ConditionsService { - - public: - ConditionsService(const fhicl::ParameterSet&, art::ActivityRegistry&); - ~ConditionsService(); - - void preBeginRun(art::Run const &); - void postEndJob(); - - // Not sure if we really want this. It might be abused more than used? - SimpleConfig const& config() const { return _config;} - - private: - fhicl::ParameterSet _pset; - - // The name of the input file. Later will be a db key or similar. - std::string _conditionsFile; - - // Control the behaviour of messages from the SimpleConfig object holding - // the geometry parameters. - bool _allowReplacement; - bool _messageOnReplacement; - bool _messageOnDefault; - int _configStatsVerbosity; - - // Print final config file after all replacements. - bool _printConfig; - - // FIXME: should be initialized in beginRun, not c'tor. - // For how the conditions data is held in the file managed by - // this config object. It can later evolve to a database. - SimpleConfig _config; - - // Perform any consistency checks. - void checkConsistency(); - - typedef boost::shared_ptr ConditionsEntityPtr; - typedef std::map ConditionsMap; - - template friend class ConditionsHandle; - - // For now the key and version arguments are ignored. - template - ENTITY* getElement( std::string const& , std::string const& ) - { - if(_run_count==0) - throw cet::exception("GEOM") - << "Cannot get _entities from an unconfigured conditions service.\n" - << "You've attempted to a get an element before the first run\n"; - - // to use this generic way requires a map of names (typeid?) to - // abstract elements. - // find the conditions entity element requested - std::string name = typeid(ENTITY).name(); - ConditionsMap::iterator it(_entities.find(name)); - if(it==_entities.end()) - throw cet::exception("GEOM") - << "Failed to retrieve conditions entity of type " << name << "\n"; - - // this must succeed or there is something terribly wrong - ENTITY* d = dynamic_cast(it->second.get()); - - if(d==0) - throw cet::exception("GEOM") - << "Failed to convert found conditions entity " << name - << " to its correct type. There is a serious problem.\n"; - - return d; - } - - - ConditionsMap _entities; - int _run_count; - - // This is not copyable or assignable - private and unimplemented. - ConditionsService const& operator=(ConditionsService const& rhs); - ConditionsService(ConditionsService const& rhs); - - // Don't need to expose definition of private template in header - template void addEntity(std::unique_ptr d); - - }; - -} - -DECLARE_ART_SERVICE(mu2e::ConditionsService, SHARED) -#endif /* ConditionsService_ConditionsService_hh */ diff --git a/ConditionsService/src/ConditionsService.cc b/ConditionsService/src/ConditionsService.cc deleted file mode 100644 index 5b43cdb288..0000000000 --- a/ConditionsService/src/ConditionsService.cc +++ /dev/null @@ -1,88 +0,0 @@ -// -// Primitive conditions data service. -// It does not yet do validty checking. -// -// Original author Rob Kutschke -// - -// C++ include files -#include -#include - -// Framework include files -#include "messagefacility/MessageLogger/MessageLogger.h" -#include "art/Framework/Services/Registry/ServiceDefinitionMacros.h" - -// Mu2e include files -#include "Offline/ConditionsService/inc/ConditionsService.hh" -#include "Offline/GeometryService/inc/GeometryService.hh" - - -using namespace std; - -namespace mu2e { - - ConditionsService::ConditionsService(fhicl::ParameterSet const& pset, - art::ActivityRegistry&iRegistry) : - _pset(pset), - _conditionsFile( pset.get("conditionsfile","conditions.txt")), - _allowReplacement( pset.get ("allowReplacement", true)), - _messageOnReplacement( pset.get ("messageOnReplacement", false)), - _messageOnDefault( pset.get ("messageOnDefault", false)), - _configStatsVerbosity( pset.get ("configStatsVerbosity", 0)), - _printConfig( pset.get ("printConfig", false)), - - // FIXME: should be initialized in beginRun, not c'tor. - _config(_conditionsFile, _allowReplacement, _messageOnReplacement, _messageOnDefault), - _entities(), - _run_count() - { - - // by creating this handle here, we make sure that geometry service is - // created before any conditions service access, and its callbacks are called first - art::ServiceHandle g; - - _config.printOpen(std::cout, "Conditions"); - iRegistry.sPreBeginRun.watch(this, &ConditionsService::preBeginRun); - iRegistry.sPostEndJob.watch (this, &ConditionsService::postEndJob ); - } - - ConditionsService::~ConditionsService(){ - } - - // This template can be defined here because this is a private method which is only - // used by the code below in the same file. - template - void ConditionsService::addEntity(std::unique_ptr d) - { - if(_entities.find(typeid(ENTITY).name())!=_entities.end()) - throw cet::exception("GEOM") << "failed to install conditions entity with type name " - << typeid(ENTITY).name() << "\n"; - - ConditionsEntityPtr ptr(d.release()); - _entities[typeid(ENTITY).name()] = ptr; - } - - void - ConditionsService::preBeginRun(art::Run const &) { - - if(++_run_count > 1) { - mf::LogPrint("CONDITIONS") << "This test version does not change geometry on run boundaries."; - return; - } - - if ( _printConfig ){ _config.print(cout, "Conditions: "); } - - checkConsistency(); - } - - // Check that the configuration is self consistent. - void ConditionsService::checkConsistency(){ - } - - // Called after all modules have completed their end of job. - void ConditionsService::postEndJob(){ - _config.printAllSummaries ( cout, _configStatsVerbosity, "Conditions: " ); - } - -} // end namespace mu2e diff --git a/ConditionsService/src/ConditionsService_service.cc b/ConditionsService/src/ConditionsService_service.cc deleted file mode 100644 index f92b8c4050..0000000000 --- a/ConditionsService/src/ConditionsService_service.cc +++ /dev/null @@ -1,8 +0,0 @@ -// -// ConditionsService pulgin -// - -#include "art/Framework/Services/Registry/ServiceDefinitionMacros.h" -#include "Offline/ConditionsService/inc/ConditionsService.hh" - -DEFINE_ART_SERVICE(mu2e::ConditionsService) diff --git a/ConditionsService/src/SConscript b/ConditionsService/src/SConscript deleted file mode 100644 index bd948985ae..0000000000 --- a/ConditionsService/src/SConscript +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env python -# -# Original author Rob Kutschke. -# - -import os.path -Import('env') - - -Import('mu2e_helper') - -helper=mu2e_helper(env) - -mainlib = helper.make_mainlib ( [ 'mu2e_RecoDataProducts', - 'mu2e_TrackerGeom', - 'mu2e_ConfigTools', - 'mu2e_DataProducts', - 'mu2e_GlobalConstantsService', - 'art_Framework_Core', - 'art_Framework_Services_Registry', - 'art_Utilities', - 'MF_MessageLogger', - 'fhiclcpp', - 'fhiclcpp_types', - 'tbb', - 'canvas', - 'cetlib', - 'cetlib_except', - 'CLHEP', - 'boost_filesystem' - ] ) - -helper.make_plugins( [ mainlib, - 'mu2e_TrackerConditions', - 'mu2e_ConfigTools', - 'art_Framework_Principal', - 'art_Persistency_Provenance', - 'art_Framework_Services_Registry', - 'art_root_io_tfile_support', - 'art_Utilities', - 'canvas', - 'MF_MessageLogger', - 'fhiclcpp', - 'fhiclcpp_types', - 'tbb', - 'canvas', - 'cetlib', - 'cetlib_except', - 'boost_filesystem', - ] ) - - -# This tells emacs to view this file in python mode. -# Local Variables: -# mode:python -# End: diff --git a/Mu2eInterfaces/inc/ConditionsEntity.hh b/Mu2eInterfaces/inc/ConditionsEntity.hh index 759fe4fcd5..281a585374 100644 --- a/Mu2eInterfaces/inc/ConditionsEntity.hh +++ b/Mu2eInterfaces/inc/ConditionsEntity.hh @@ -1,5 +1,5 @@ -#ifndef ConditionsService_ConditionsEntity_hh -#define ConditionsService_ConditionsEntity_hh +#ifndef Mu2eInterfaces_ConditionsEntity_hh +#define Mu2eInterfaces_ConditionsEntity_hh // // A base class for objects held by the conditions data system. // @@ -20,4 +20,4 @@ namespace mu2e }; } -#endif /* ConditionsService_ConditionsEntity_hh */ +#endif /* Mu2eInterfaces_ConditionsEntity_hh */