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
Alignments.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 DD4HEP_ALIGMENTS_ALIGNMENTS_H
14 #define DD4HEP_ALIGMENTS_ALIGNMENTS_H
15 
16 // Framework include files
17 #include "DD4hep/IOV.h"
18 #include "DD4hep/Volumes.h"
19 
21 namespace DD4hep {
22 
24  class IOV;
25 
27  namespace Conditions {
28 
29  class UserPool;
31  namespace Interna {
32  class ConditionObject;
33  }
34  }
35 
37  namespace Alignments {
38 
39  using Geometry::LCDD;
43 
45  namespace Interna {
47  class AlignmentContainer;
50  }
52  class AlignmentsLoader;
53  class AlignmentData;
54  class Alignment;
55  class Delta;
56 
58 
65  class Alignment : public Handle<AlignmentData> {
66  public:
68 
73  class Processor {
74  public:
76  Processor();
78  virtual ~Processor() = default;
80  virtual int operator()(Alignment container) = 0;
81  };
82 
90  typedef std::vector<PlacedVolume> NodeList;
94  typedef unsigned int key_type;
96  typedef IOV iov_type;
97 
98  public:
100  Alignment() = default;
104  template <typename Q> Alignment(const Handle<Q>& e) : Handle<Object>(e) {}
106 #if defined(__APPLE__) || defined(__clang__)
107  Alignment(const std::string& name) ;
108 #else
109  template <typename Q=Interna::AlignmentNamedObject> Alignment(const std::string& name);
110 #endif
111  static key_type hashCode(const char* value);
114  static key_type hashCode(const std::string& value);
115 
117  Data& data() { return (*access()); }
119  const Data& data() const { return (*access()); }
121  const TGeoHMatrix& worldTransformation() const;
123  const TGeoHMatrix& detectorTransformation() const;
124  };
125 
127  inline Alignment::key_type Alignment::hashCode(const char* value)
128  { return hash32(value); }
129 
131  inline Alignment::key_type Alignment::hashCode(const std::string& value)
132  { return hash32(value); }
133 
135 
142  class AlignmentCondition : public Handle<Interna::AlignmentConditionObject> {
143  public:
151  typedef std::vector<PlacedVolume> NodeList;
155  typedef unsigned int key_type;
157  typedef IOV iov_type;
158 
159  public:
167  template <typename Q> AlignmentCondition(const Handle<Q>& e) : Handle<Object>(e) {}
169 #if defined(__APPLE__) || defined(__clang__)
170  AlignmentCondition(const std::string& name) ;
171 #else
172  template <typename Q=Object> AlignmentCondition(const std::string& name);
173 #endif
174 
175  const IOVType& iovType() const;
178  const iov_type& iov() const;
180  key_type key() const;
181 
183  Data& data();
186  const Data& data() const;
188  const TGeoHMatrix& worldTransformation() const;
190  const TGeoHMatrix& detectorTransformation() const;
192  bool is_bound() const;
193  };
194 
195 
197 
206  class Container : public Handle<Interna::AlignmentContainer> {
207  public:
209 
214  class Processor {
215  public:
217  Processor();
219  virtual ~Processor() = default;
221  virtual int operator()(Container container) = 0;
222  };
223 
231  typedef std::pair<key_type, std::string> key_value;
233  typedef std::map<key_type, key_value> Keys;
234 
235  public:
237  Container();
238 
240  template <typename Q> Container(const Container& c) : Handle<Object>(c) {}
241 
243  template <typename Q> Container(const Handle<Q>& e) : Handle<Object>(e) {}
244 
246  size_t numKeys() const;
247 
249  const Keys& keys() const;
250 
252  Alignment get(const std::string& alignment_key, const iov_type& iov);
253 
255  Alignment get(key_type alignment_key, const iov_type& iov);
256 
258  Alignment get(const std::string& alignment_key, const UserPool& iov);
259 
261  Alignment get(key_type alignment_key, const UserPool& iov);
262  };
263 
266  }
267 
268  } /* End namespace Aligments */
269 } /* End namespace DD4hep */
270 #endif /* DD4HEP_ALIGMENTS_ALIGNMENTS_H */
size_t numKeys() const
Access the number of conditons keys available for this detector element.
Definition: Alignments.cpp:127
Data & data()
Data accessor for the use of decorators.
Definition: Alignments.cpp:86
The data class behind an alignments container handle.
key_type key() const
Access the hash identifier.
Definition: Alignments.cpp:81
const TGeoHMatrix & detectorTransformation() const
Access the alignment/placement matrix with respect to the world.
Definition: Alignments.cpp:118
Handle class holding a placed volume (also called physical volume)
Definition: Volumes.h:135
The data class behind an alignments handle.
const IOVType & iovType() const
Access the IOV type.
Definition: Alignments.cpp:71
const char * name() const
Access the object name (or "" if not supported by the object)
Alignment::iov_type iov_type
Forward definition of the iov type.
Definition: Alignments.h:229
IOV iov_type
Forward definition of the iov type.
Definition: Alignments.h:157
unsigned int key_type
Forward definition of the key type.
Definition: Alignments.h:155
AlignmentData Object
Forward definition of the base data object containing alignment data.
Definition: Alignments.h:84
The data class behind a alignments container handle.
Interface for conditions pool optimized to host conditions updates.
Interna::AlignmentContainer Object
Standard object type.
Definition: Alignments.h:225
bool is_bound() const
Check if object is already bound....
Definition: Alignments.cpp:108
AlignmentCondition(Conditions::Interna::ConditionObject *p)
Assignment constructor from condition object.
Definition: Alignments.h:165
The data class behind a conditions handle.
Container(const Handle< Q > &e)
Constructor to be used when reading the already parsed object.
Definition: Alignments.h:243
Main handle class to hold an alignment object.
Definition: Alignments.h:65
virtual int operator()(Container container)=0
Container callback for object processing.
std::pair< key_type, std::string > key_value
Forward definition of the mapping type.
Definition: Alignments.h:231
virtual ~Processor()=default
Default destructor.
return e
Definition: Volumes.cpp:297
Abstract base for processing callbacks to container objects.
Definition: Alignments.h:73
Alignment()=default
Default constructor.
Alignment::key_type key_type
Forward definition of the key type.
Definition: Alignments.h:227
DD4hep::Geometry::DetElement DetElement
const Keys & keys() const
Known keys of conditions in this container.
Definition: Alignments.cpp:132
virtual int operator()(Alignment container)=0
Container callback for object processing.
std::vector< PlacedVolume > NodeList
Forward definition of the nodelist leading to the world.
Definition: Alignments.h:151
Class describing the interval of validty.
Definition: IOV.h:59
Class describing the interval of validty type.
Definition: IOV.h:33
Alignment(Object *p)
Default constructor.
Definition: Alignments.h:102
IOV iov_type
Forward definition of the iov type.
Definition: Alignments.h:96
Geometry::PlacedVolume PlacedVolume
Forward definition of the geometry placement.
Definition: Alignments.h:149
AlignmentData * access() const
Checked object access. Throws invalid handle runtime exception.
Alignments::Delta Delta
Forward definition of the alignment delta data.
Definition: Alignments.h:153
AlignmentCondition(const Handle< Q > &e)
Constructor to be used when reading the already parsed object.
Definition: Alignments.h:167
std::map< key_type, key_value > Keys
Definition of the keys.
Definition: Alignments.h:233
Class describing an condition to re-adjust an alignment.
Definition: AlignmentData.h:49
static key_type hashCode(const char *value)
Hash code generation from input string.
Definition: Alignments.h:127
Data & data()
Data accessor for the use of decorators.
Definition: Alignments.h:117
virtual ~Processor()=default
Default destructor.
AlignmentCondition()
Default constructor.
Definition: Alignments.h:161
std::vector< PlacedVolume > NodeList
Forward definition of the nodelist leading to the world.
Definition: Alignments.h:90
Interna::AlignmentConditionObject Object
Forward definition of the base data object containing alignment data.
Definition: Alignments.h:145
Alignment(const Handle< Q > &e)
Constructor to be used when reading the already parsed object.
Definition: Alignments.h:104
const iov_type & iov() const
Access the IOV block.
Definition: Alignments.cpp:76
AlignmentData Data
Forward definition of the base data object containing alignment data.
Definition: Alignments.h:147
const TGeoHMatrix & detectorTransformation() const
Access the alignment/placement matrix with respect to the world.
Definition: Alignments.cpp:66
AlignmentCondition(Object *p)
Default constructor.
Definition: Alignments.h:163
Alignments::Delta Delta
Forward definition of the alignment delta data.
Definition: Alignments.h:92
unsigned int hash32(const char *key)
We need it so often: one-at-time 32 bit hash function.
Definition: Primitives.h:39
const Data & data() const
Data accessor for the use of decorators.
Definition: Alignments.h:119
AlignmentData Data
Forward definition of the base data object containing alignment data.
Definition: Alignments.h:86
Handle: a templated class like a shared pointer, which allows specialized access to tgeometry objects...
Definition: Handle.h:87
Container class for alignment handles aggregated by a detector element.
Definition: Alignments.h:206
Container(const Container &c)
Constructor to be used when reading the already parsed object.
Definition: Alignments.h:240
Main handle class to hold an alignment conditions object.
Definition: Alignments.h:142
unsigned int key_type
Forward definition of the key type.
Definition: Alignments.h:94
The main interface to the DD4hep detector description package.
Definition: LCDD.h:82
Abstract base for processing callbacks to container objects.
Definition: Alignments.h:214
Container()
Default constructor.
Definition: Alignments.h:265
const TGeoHMatrix & worldTransformation() const
Create cached matrix to transform to world coordinates.
Definition: Alignments.cpp:113
const TGeoHMatrix & worldTransformation() const
Create cached matrix to transform to world coordinates.
Definition: Alignments.cpp:61
Derived condition data-object definition.
Geometry::PlacedVolume PlacedVolume
Forward definition of the geometry placement.
Definition: Alignments.h:88