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.h
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation for LCD
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : M.Frank
11 //
12 //==========================================================================
13 #ifndef DDCOND_CONDITIONSMANAGER_H
14 #define DDCOND_CONDITIONSMANAGER_H
15 
16 // Framework include files
17 #include "DD4hep/Memory.h"
18 #include "DD4hep/Detector.h"
19 #include "DD4hep/Conditions.h"
22 
24 namespace DD4hep {
25 
27  namespace Conditions {
28 
29  // Forward declarations
30  class Entry;
31  class UserPool;
32  class ConditionsPool;
33  class ConditionsIOVPool;
34  class ConditionDependency;
35  class ConditionsDataLoader;
36  class ConditionUpdateContext;
37  class ConditionsManagerObject;
38 
40 
45  class ConditionsManager : public Handle<ConditionsManagerObject> {
46  public:
47 
51  typedef std::vector<IOVType> IOVTypes;
52  typedef std::map<IOVType*,Container> TypeConditions;
53  typedef std::map<DetElement,Container> DetectorConditions;
54  typedef std::set<ConditionKey> ConditionKeys;
57 
58  public:
59 
61 
68  template <typename T> static ConditionsManager from(T& host);
69 
71  ConditionsManager(LCDD& lcdd);
72 
74  ConditionsManager() = default;
75 
78 
81 
83  template <typename Q> ConditionsManager(const Handle<Q>& e) : Handle<Object>(e) {}
84 
86  ~ConditionsManager() = default;
87 
89  ConditionsManager& operator=(const ConditionsManager& c) = default;
90 
93 
95  Property& operator[](const std::string& property_name) const;
96 
98  PropertyManager& properties() const;
99 
101  Handle<Loader> loader() const;
102 
104  const std::vector<const IOVType*> iovTypesUsed() const;
105 
107  const IOVType* iovType (const std::string& iov_name) const;
108 
110  ConditionsIOVPool* iovPool(const IOVType& type) const;
111 
113  void fromString(const std::string& iov_str, IOV& iov);
114 
116 
119  std::pair<bool, const IOVType*> registerIOVType(size_t iov_type, const std::string& iov_name);
120 
122  ConditionsPool* registerIOV(const IOVType& typ, IOV::Key key);
123 
125  bool registerUnlocked(ConditionsPool* pool, Condition cond);
126 
128  void clean(const IOVType* typ, int max_age);
129 
131  void clear();
132 
134  long prepare(const IOV& required_validity,
135  const ConditionKeys& keys,
136  dd4hep_ptr<UserPool>& user_pool);
137 
139  long prepare(const IOV& required_validity,
140  const ConditionKeys& keys,
141  dd4hep_ptr<UserPool>& user_pool,
142  const Dependencies& dependencies,
143  bool verify_dependencies=true);
144 
146  long prepare(const IOV& required_validity, dd4hep_ptr<UserPool>& user_pool);
147 
149  long prepare(const IOV& required_validity,
150  dd4hep_ptr<UserPool>& user_pool,
151  const Dependencies& dependencies,
152  bool verify_dependencies=true);
153  };
154 
155  } /* End namespace Conditions */
156 } /* End namespace DD4hep */
157 #endif /* DDCOND_CONDITIONSMANAGER_H */
The property class to assign options to actions.
~ConditionsManager()=default
Default destructor.
ConditionsManager(const Handle< Q > &e)
Constructor to be used assigning from different type.
ConditionsManager(const ConditionsManager &c)
Constructor to assing handle of the same type.
ConditionsPool * registerIOV(const IOVType &typ, IOV::Key key)
Register IOV with type and key.
void fromString(const std::string &iov_str, IOV &iov)
Create IOV from string.
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
return e
Definition: Volumes.cpp:297
ConditionsManager & initialize()
Initialize the object after having set the properties.
ConditionsDependencyCollection Dependencies
ConditionsManagerObject Object
Standard object type.
Condition dependency definition.
std::pair< bool, const IOVType * > registerIOVType(size_t iov_type, const std::string &iov_name)
Register new IOV type if it does not (yet) exist.
void clean(const IOVType *typ, int max_age)
Clean conditions, which are above the age limit.
Class describing the interval of validty.
Definition: IOV.h:59
Manager class for condition handles.
Interface for a generic conditions loader.
const IOVType * iovType(const std::string &iov_name) const
Access IOV by its name.
ConditionsManager & operator=(const ConditionsManager &c)=default
Assignment operator.
Class describing the interval of validty type.
Definition: IOV.h:33
Conditions internal namespace declaration.
Handle< Loader > loader() const
Access the conditions loader.
Class implementing the conditions collection for a given IOV type.
ConditionsManager(Object *p)
Constructor to be used with valid pointer to object.
std::set< ConditionKey > ConditionKeys
ConditionsManager()=default
Default constructor.
static ConditionsManager from(T &host)
Static accessor if installed as an extension.
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
PropertyManager & properties() const
Access to the property manager.
ConditionsIOVPool * iovPool(const IOVType &type) const
Access conditions multi IOV pool by iov type.
Stack entry definition.
Property & operator[](const std::string &property_name) const
Access to properties.
long prepare(const IOV &required_validity, const ConditionKeys &keys, dd4hep_ptr< UserPool > &user_pool)
Prepare all updates for the given keys to the clients with the defined IOV.
const std::vector< const IOVType * > iovTypesUsed() const
Access the used/registered IOV types.
std::pair< Key_first_type, Key_second_type > Key
Definition: IOV.h:67
bool registerUnlocked(ConditionsPool *pool, Condition cond)
Register new condition with the conditions store. Unlocked version, not multi-threaded.
std::map< IOVType *, Container > TypeConditions
Manager to ease the handling of groups of properties.
std::map< DetElement, Container > DetectorConditions
void clear()
Full cleanup of all managed conditions.