DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
ConditionsMap.h
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
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 DD4HEP_CONDITIONSMAP_H
14 #define DD4HEP_CONDITIONSMAP_H
15 
16 // Framework include files
17 #include <DD4hep/Conditions.h>
18 #include <DD4hep/DetElement.h>
19 
20 // C/C++ include files
21 #include <map>
22 #include <unordered_map>
23 
25 namespace dd4hep {
26 
28 
59  class ConditionsMap {
60  public:
61  enum {
64  };
65  enum {
68  };
69 
70  public:
72  virtual ~ConditionsMap() = default;
74  virtual bool insert(DetElement detector,
76  Condition condition) = 0;
78  virtual Condition get(DetElement detector,
79  Condition::itemkey_type key) const = 0;
81  virtual void scan(const Condition::Processor& processor) const = 0;
82 
85 
93  virtual std::vector<Condition> get(DetElement detector,
95  Condition::itemkey_type upper) const;
96 
98 
112  virtual void scan(DetElement detector,
115  const Condition::Processor& processor) const;
116  };
117 
119 
124  template <typename T>
125  class ConditionsMapping : virtual public ConditionsMap {
126  public:
128  T data;
129  public:
131  ConditionsMapping() = default;
133  virtual ~ConditionsMapping() = default;
139  virtual bool insert(DetElement detector, Condition::itemkey_type key, Condition condition) override;
141  virtual Condition get(DetElement detector, Condition::itemkey_type key) const override;
143  virtual std::vector<Condition> get(DetElement detector,
145  Condition::itemkey_type upper) const override {
146  return this->ConditionsMap::get(detector,lower,upper);
147  }
149  virtual void scan(const Condition::Processor& processor) const override;
151  virtual void scan(DetElement detector,
154  const Condition::Processor& processor) const override;
155  };
162 
163 } /* End namespace dd4hep */
164 #endif // DD4HEP_CONDITIONSMAP_H
dd4hep::ConditionsMapping
Concrete ConditionsMap implementation class using externally defined containers.
Definition: ConditionsMap.h:125
dd4hep::Condition::LAST_ITEM_KEY
@ LAST_ITEM_KEY
Definition: Conditions.h:96
dd4hep::ConditionsMapping::~ConditionsMapping
virtual ~ConditionsMapping()=default
Standard destructor.
dd4hep::ConditionsMap::~ConditionsMap
virtual ~ConditionsMap()=default
Standard destructor.
dd4hep::ConditionsMap::scan
virtual void scan(const Condition::Processor &processor) const =0
Interface to scan data content of the conditions mapping.
dd4hep::Condition::FIRST_ITEM_KEY
@ FIRST_ITEM_KEY
Definition: Conditions.h:95
dd4hep::ConditionsMapping::ConditionsMapping
ConditionsMapping()=default
Standard constructor to construct an empty object.
dd4hep::ConditionsMultiMap
ConditionsMapping< std::multimap< Condition::key_type, Condition > > ConditionsMultiMap
Concrete implementation of the conditions map using a multimap.
Definition: ConditionsMap.h:159
dd4hep::ConditionsMap::insert
virtual bool insert(DetElement detector, Condition::itemkey_type key, Condition condition)=0
Insert a new entry to the map. The detector element key and the item key make a unique global conditi...
dd4hep::ConditionsMap::LAST_KEY
@ LAST_KEY
Definition: ConditionsMap.h:67
dd4hep::ConditionsMapping::insert
virtual bool insert(DetElement detector, Condition::itemkey_type key, Condition condition) override
Insert a new entry to the map.
Definition: ConditionsMap.cpp:98
dd4hep::ConditionsMapping::data
T data
The actual data container.
Definition: ConditionsMap.h:128
dd4hep::Condition
Main condition object handle.
Definition: Conditions.h:51
dd4hep::DetElement
Handle class describing a detector element.
Definition: DetElement.h:188
dd4hep::ConditionsMapping::scan
virtual void scan(const Condition::Processor &processor) const override
Interface to scan data content of the conditions mapping.
Definition: ConditionsMap.cpp:112
dd4hep::ConditionsMap::FIRST_KEY
@ FIRST_KEY
Definition: ConditionsMap.h:66
dd4hep::ConditionsMap::get
virtual Condition get(DetElement detector, Condition::itemkey_type key) const =0
Interface to access conditions by hash value. The detector element key and the item key make a unique...
dd4hep::ConditionsTreeMap
ConditionsMapping< std::map< Condition::key_type, Condition > > ConditionsTreeMap
Concrete implementation of the conditions map using a left-right map.
Definition: ConditionsMap.h:157
dd4hep::Condition::FIRST_KEY
static constexpr unsigned long long int FIRST_KEY
Flags to indicate global conditions ranges.
Definition: Conditions.h:104
dd4hep::ConditionsMapping::get
virtual std::vector< Condition > get(DetElement detector, Condition::itemkey_type lower, Condition::itemkey_type upper) const override
No ConditionsMap overload: Access all conditions within a key range in the interval [lower,...
Definition: ConditionsMap.h:143
dd4hep::Condition::itemkey_type
unsigned int itemkey_type
Low part of the key identifies the item identifier.
Definition: Conditions.h:58
Conditions.h
dd4hep::ConditionsMap::FIRST_ITEM
@ FIRST_ITEM
Definition: ConditionsMap.h:62
key
unsigned char key
Definition: AlignmentsCalculator.cpp:69
DetElement.h
dd4hep::ConditionsMap::LAST_ITEM
@ LAST_ITEM
Definition: ConditionsMap.h:63
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::detail::tools::copy
void copy(Alignment from, Alignment to)
Copy alignment object from source object.
Definition: AlignmentTools.cpp:43
dd4hep::Condition::LAST_KEY
static constexpr unsigned long long int LAST_KEY
Definition: Conditions.h:104
dd4hep::Condition::Processor
Abstract base for processing callbacks to conditions objects.
Definition: Conditions.h:112
dd4hep::ConditionsMap
ConditionsMap class.
Definition: ConditionsMap.h:59
dd4hep::ConditionsMapping::ConditionsMapping
ConditionsMapping(const ConditionsMapping &copy)=delete
No copy constructor.
dd4hep::ConditionsHashMap
ConditionsMapping< std::unordered_map< Condition::key_type, Condition > > ConditionsHashMap
Concrete implementation of the conditions map using a hashmap.
Definition: ConditionsMap.h:161
dd4hep::ConditionsMapping::operator=
ConditionsMapping & operator=(const ConditionsMapping &copy)=delete
No assignment.
dd4hep::ConditionsMapping::get
virtual Condition get(DetElement detector, Condition::itemkey_type key) const override
Interface to access conditions by hash value.
Definition: ConditionsMap.cpp:105