DD4hep - The AIDA detector description toolkit for high energy physics experiments
DD4hep  Rev:Unversioneddirectory
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ConditionsManager.cpp
Go to the documentation of this file.
1 // $Id$
2 //==========================================================================
3 // AIDA Detector description implementation for LCD
4 //--------------------------------------------------------------------------
5 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
6 // All rights reserved.
7 //
8 // For the licensing terms see $DD4hepINSTALL/LICENSE.
9 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
10 //
11 // Author : M.Frank
12 //
13 //==========================================================================
14 
15 // Framework include files
16 #include "DD4hep/LCDD.h"
17 #include "DD4hep/Printout.h"
20 
21 using namespace std;
22 using namespace DD4hep;
23 using namespace DD4hep::Conditions;
24 
25 
27 namespace DD4hep {
29  namespace Conditions {
30 
32  template <> ConditionsManager ConditionsManager::from<LCDD>(LCDD& host) {
33  Object* obj = host.extension<Object>();
34  if ( obj ) return ConditionsManager(obj);
35  except("ConditionsManager","+++ Failed to access manager from LCDD.");
36  return ConditionsManager();
37  }
38  }
39 }
40 
42 ConditionsManager::ConditionsManager(LCDD& lcdd) {
43  assign(new Object(lcdd), "ConditionsManager","");
44 }
45 
46 ConditionsManager& ConditionsManager::initialize() {
47  access()->initialize();
48  return *this;
49 }
50 
52 PropertyManager& ConditionsManager::properties() const {
53  return access()->properties();
54 }
55 
57 Property& ConditionsManager::operator[](const std::string& property_name) const {
58  return access()->properties().property(property_name);
59 }
60 
62 Handle<ConditionsManager::Loader> ConditionsManager::loader() const {
63  return access()->loader();
64 }
65 
67 pair<bool, const IOVType*>
68 ConditionsManager::registerIOVType(size_t iov_type, const string& iov_name) {
69  return access()->registerIOVType(iov_type, iov_name);
70 }
71 
73 const IOVType* ConditionsManager::iovType (const string& iov_name) const {
74  return access()->iovType(iov_name);
75 }
76 
78 ConditionsIOVPool* ConditionsManager::iovPool(const IOVType& iov_type) const {
79  return access()->m_rawPool[iov_type.type];
80 }
81 
83 const vector<const IOVType*> ConditionsManager::iovTypesUsed() const {
84  Object* obj = access();
85  vector<const IOVType*> result;
86  const IOVTypes& types = obj->iovTypes();
87  for(IOVTypes::const_iterator i=types.begin(); i!=types.end(); ++i)
88  if ( int((*i).type) != IOVType::UNKNOWN_IOV ) result.push_back(&(*i));
89  return result;
90 }
91 
93 ConditionsPool* ConditionsManager::registerIOV(const IOVType& typ, IOV::Key key) {
94  return access()->registerIOV(typ, key);
95 }
96 
98 void ConditionsManager::fromString(const string& iov_str, IOV& iov) {
99  access()->fromString(iov_str, iov);
100 }
101 
103 bool ConditionsManager::registerUnlocked(ConditionsPool* pool, Condition cond) {
104  return access()->registerUnlocked(pool, cond);
105 }
106 
108 void ConditionsManager::clean(const IOVType* typ, int max_age) {
109  access()->clean(typ, max_age);
110 }
111 
113 void ConditionsManager::clear() {
114  access()->clear();
115 }
116 
118 long ConditionsManager::prepare(const IOV& required_validity,
119  const ConditionKeys& keys,
120  dd4hep_ptr<UserPool>& user_pool) {
121  return access()->prepare(required_validity, keys, user_pool);
122 }
123 
124 
126 long ConditionsManager::prepare(const IOV& required_validity,
127  const ConditionKeys& keys,
128  dd4hep_ptr<UserPool>& user_pool,
129  const Dependencies& dependencies,
130  bool verify_dependencies) {
131  return access()->prepare(required_validity, keys, user_pool, dependencies, verify_dependencies);
132 }
133 
135 long ConditionsManager::prepare(const IOV& required_validity, dd4hep_ptr<UserPool>& user_pool) {
136  return access()->prepare(required_validity, user_pool);
137 }
138 
140 long ConditionsManager::prepare(const IOV& required_validity,
141  dd4hep_ptr<UserPool>& user_pool,
142  const Dependencies& dependencies,
143  bool verify_dependencies) {
144  return access()->prepare(required_validity, user_pool, dependencies, verify_dependencies);
145 }
const IOVTypes & iovTypes() const
Access IOV by its type.
The property class to assign options to actions.
Main condition object handle.
Definition: Conditions.h:70
Out version of the std auto_ptr implementation base either on auto_ptr or unique_ptr.
Definition: Memory.h:43
ConditionsManager & initialize()
Initialize the object after having set the properties.
int except(const std::string &src, const std::string &fmt,...)
Calls the display action with ERROR and throws an std::runtime_error exception.
Definition: Printout.cpp:217
Class describing the interval of validty.
Definition: IOV.h:59
Manager class for condition handles.
Class describing the interval of validty type.
Definition: IOV.h:33
virtual void clear()=0
Full cleanup of all managed conditions.
Conditions internal namespace declaration.
unsigned int type
integer identifier ised internally
Definition: IOV.h:37
Class implementing the conditions collection for a given IOV type.
std::set< ConditionKey > ConditionKeys
Pool of conditions satisfying one IOV type (epoch, run, fill, etc)
Handle: a templated class like a shared pointer, which allows specialized access to tgeometry objects...
Definition: Handle.h:87
void * extension(const std::type_info &info, bool alert) const
Access an existing extension object from the detector element.
std::pair< Key_first_type, Key_second_type > Key
Definition: IOV.h:67
Manager to ease the handling of groups of properties.