DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
Alignments.cpp
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 
14 // Framework include files
15 #include <DD4hep/AlignmentData.h>
18 
19 // C/C++ include files
20 #include <sstream>
21 
22 using namespace dd4hep;
23 
24 const std::string dd4hep::align::Keys::deltaName("alignment_delta");
26  dd4hep::ConditionKey::itemCode("alignment_delta");
27 
28 const std::string dd4hep::align::Keys::alignmentName("alignment");
30  dd4hep::ConditionKey::itemCode("alignment");
31 
34 }
35 
37 Alignment::Alignment(const std::string& nam) {
38  char* p = (char*)::operator new(sizeof(Object)+sizeof(AlignmentData));
39  Object* o = new(p) Object(nam, "alignment", p+sizeof(Object), sizeof(AlignmentData));
40  assign(o, nam, "alignment");
41  o->hash = 0;
42 }
43 
45 AlignmentCondition::AlignmentCondition(const std::string& nam) {
46  char* p = (char*)::operator new(sizeof(Object)+sizeof(AlignmentData));
47  Object* o = new(p) Object(nam, "alignment", p+sizeof(Object), sizeof(AlignmentData));
48  assign(o, nam, "alignment");
49  o->hash = 0;
50 }
51 
54  return access()->values();
55 }
56 
59  return access()->values();
60 }
61 
63 const Delta& Alignment::delta() const {
64  return access()->values().delta;
65 }
66 
68 const TGeoHMatrix& Alignment::worldTransformation() const {
69  return access()->values().worldTransformation();
70 }
71 
73 const TGeoHMatrix& Alignment::detectorTransformation() const {
74  return access()->values().detectorTransformation();
75 }
76 
78 const std::vector<PlacedVolume>& Alignment::nodes() const {
79  return access()->values().nodes;
80 }
81 
83 void Alignment::localToWorld(const Position& local, Position& global) const {
84  return access()->values().localToWorld(local,global);
85 }
86 
88 void Alignment::localToWorld(const Double_t local[3], Double_t global[3]) const {
89  return access()->values().localToWorld(local,global);
90 }
93  return access()->values().localToWorld(local);
94 }
95 
97 void Alignment::worldToLocal(const Position& global, Position& local) const {
98  return access()->values().worldToLocal(global,local);
99 }
100 
102 void Alignment::worldToLocal(const Double_t global[3], Double_t local[3]) const {
103  return access()->values().worldToLocal(global,local);
104 }
105 
108  return access()->values().worldToLocal(global);
109 }
110 
112 void Alignment::localToDetector(const Position& local, Position& detector) const {
113  return access()->values().localToDetector(local,detector);
114 }
115 
117 void Alignment::localToDetector(const Double_t local[3], Double_t detector[3]) const {
118  return access()->values().localToDetector(local,detector);
119 }
120 
123  return access()->values().localToDetector(local);
124 }
125 
127 void Alignment::detectorToLocal(const Position& detector, Position& local) const {
128  return access()->values().detectorToLocal(detector,local);
129 }
130 
132 void Alignment::detectorToLocal(const Double_t detector[3], Double_t local[3]) const {
133  return access()->values().detectorToLocal(detector,local);
134 }
135 
138  return access()->values().detectorToLocal(detector);
139 }
140 
143  return *(access()->iovType());
144 }
145 
148  return *(access()->iovData());
149 }
150 
153  return access()->hash;
154 }
155 
158  return *(access()->alignment_data);
159 }
160 
163  return *(access()->alignment_data);
164 }
165 
168  return access()->alignment_data->delta;
169 }
170 
173  return isValid() ? ptr()->data.is_bound() : false;
174 }
175 
177 const TGeoHMatrix& AlignmentCondition::worldTransformation() const {
178  return data().worldTransformation();
179 }
180 
182 const TGeoHMatrix& AlignmentCondition::detectorTransformation() const {
183  return data().detectorTransformation();
184 }
dd4hep::AlignmentData::nodes
std::vector< PlacedVolume > nodes
The list of TGeoNodes (physical placements)
Definition: AlignmentData.h:122
dd4hep::Alignment::detectorTransformation
const TGeoHMatrix & detectorTransformation() const
Access the alignment/placement matrix with respect to the world.
Definition: Alignments.cpp:73
dd4hep::detail::ConditionObject::hash
Condition::key_type hash
Hash value of the name.
Definition: ConditionsInterna.h:85
dd4hep::Handle< detail::AlignmentObject >::Object
detail::AlignmentObject Object
Extern accessible definition of the contained element type.
Definition: Handle.h:88
ConditionsInterna.h
dd4hep::Alignment::data
AlignmentData & data()
Data accessor for the use of decorators.
Definition: Alignments.cpp:53
dd4hep::AlignmentData::localToDetector
void localToDetector(const Position &local, Position &detector) const
Transformation from local coordinates of the placed volume to the detector system.
Definition: AlignmentData.cpp:194
dd4hep::Alignment::nodes
const std::vector< PlacedVolume > & nodes() const
Access to the node list.
Definition: Alignments.cpp:78
dd4hep::Handle< detail::AlignmentObject >::isValid
bool isValid() const
Check the validity of the object held by the handle.
Definition: Handle.h:128
dd4hep::Alignment::Processor::Processor
Processor()
Default constructor.
Definition: Alignments.cpp:33
dd4hep::AlignmentCondition::is_bound
bool is_bound() const
Check if object is already bound....
Definition: Alignments.cpp:172
dd4hep::OpaqueData::is_bound
bool is_bound() const
Check if object is already bound....
Definition: OpaqueData.h:71
dd4hep::Alignment::delta
const Delta & delta() const
Access the delta value of the object.
Definition: Alignments.cpp:63
dd4hep::detail::AlignmentObject::values
AlignmentData & values()
Accessor to the alignment data. Cannot be NULL. Initialized in the constructor(s)
Definition: AlignmentsInterna.h:75
dd4hep::IOVType
Class describing the interval of validty type.
Definition: IOV.h:37
dd4hep::Alignment::localToWorld
void localToWorld(const Position &local, Position &global) const
Transformation from local coordinates of the placed volume to the world system.
Definition: Alignments.cpp:83
dd4hep::Delta
Class describing an condition to re-adjust an alignment.
Definition: AlignmentData.h:38
dd4hep::Alignment::worldToLocal
void worldToLocal(const Position &global, Position &local) const
Transformation from world coordinates of the local placed volume coordinates.
Definition: Alignments.cpp:97
dd4hep::IOV
Class describing the interval of validty.
Definition: IOV.h:67
dd4hep::Handle< detail::AlignmentObject >::assign
void assign(Object *n, const std::string &nam, const std::string &title)
Assign a new named object. Note: object references must be managed by the user.
dd4hep::align::Keys::alignmentKey
static const Condition::itemkey_type alignmentKey
Key value of an alignment condition object "alignment".
Definition: Alignments.h:56
dd4hep::AlignmentCondition::data
AlignmentData & data()
Data accessor for the use of decorators.
Definition: Alignments.cpp:157
dd4hep::align::Keys::deltaKey
static const Condition::itemkey_type deltaKey
Key value of a delta condition "alignment_delta".
Definition: Alignments.h:52
dd4hep::AlignmentCondition::detectorTransformation
const TGeoHMatrix & detectorTransformation() const
Access the alignment/placement matrix with respect to the world.
Definition: Alignments.cpp:182
dd4hep::align::Keys::deltaName
static const std::string deltaName
Key name of a delta condition "alignment_delta".
Definition: Alignments.h:50
dd4hep::Alignment::worldTransformation
const TGeoHMatrix & worldTransformation() const
Create cached matrix to transform to world coordinates.
Definition: Alignments.cpp:68
dd4hep::detail::ConditionObject::iovType
const IOVType * iovType() const
Access safely the IOV-type.
Definition: ConditionsInterna.cpp:92
dd4hep::ConditionKey::itemCode
static Condition::itemkey_type itemCode(const char *value)
32 bit hashcode of the item
Definition: Conditions.cpp:287
dd4hep::AlignmentData::delta
Delta delta
Alignment changes.
Definition: AlignmentData.h:116
dd4hep::align::Keys::alignmentName
static const std::string alignmentName
Key name of an alignment condition object "alignment".
Definition: Alignments.h:54
dd4hep::AlignmentData
Derived condition data-object definition.
Definition: AlignmentData.h:98
dd4hep::Alignment::detectorToLocal
void detectorToLocal(const Position &detector, Position &local) const
Transformation from detector element coordinates to the local placed volume coordinates.
Definition: Alignments.cpp:127
dd4hep::AlignmentData::localToWorld
const Transform3D & localToWorld() const
Access the currently applied alignment/placement matrix.
Definition: AlignmentData.h:152
dd4hep::Alignment::localToDetector
void localToDetector(const Position &local, Position &detector) const
Transformation from local coordinates of the placed volume to the detector system.
Definition: Alignments.cpp:112
dd4hep::AlignmentCondition::key_type
unsigned long long int key_type
Forward definition of the key type.
Definition: Alignments.h:71
dd4hep::Alignment::Alignment
Alignment()=default
Default constructor.
dd4hep::Condition::itemkey_type
unsigned int itemkey_type
Low part of the key identifies the item identifier.
Definition: Conditions.h:58
dd4hep::detail::AlignmentObject::alignment_data
AlignmentData * alignment_data
Cached pointer to the bound conditions data, since these may be accessed very frequently.
Definition: AlignmentsInterna.h:59
dd4hep::AlignmentCondition::delta
const Delta & delta() const
Access the delta value of the object.
Definition: Alignments.cpp:167
dd4hep::AlignmentCondition::worldTransformation
const TGeoHMatrix & worldTransformation() const
Create cached matrix to transform to world coordinates.
Definition: Alignments.cpp:177
dd4hep::detail::ConditionObject::iovData
const IOV * iovData() const
Access safely the IOV.
Definition: ConditionsInterna.cpp:85
dd4hep::Position
ROOT::Math::XYZVector Position
Definition: Objects.h:81
dd4hep::AlignmentData::detectorToLocal
void detectorToLocal(const Position &detector, Position &local) const
Transformation from detector element coordinates to the local placed volume coordinates.
Definition: AlignmentData.cpp:216
dd4hep::Handle< detail::AlignmentObject >::access
detail::AlignmentObject * access() const
Checked object access. Throws invalid handle runtime exception if invalid handle.
dd4hep::Handle< detail::AlignmentObject >::ptr
detail::AlignmentObject * ptr() const
Access to the held object.
Definition: Handle.h:153
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::detail::ConditionObject::data
OpaqueDataBlock data
Data block.
Definition: ConditionsInterna.h:81
dd4hep::AlignmentData::worldTransformation
const TGeoHMatrix & worldTransformation() const
Create cached matrix to transform to world coordinates.
Definition: AlignmentData.h:148
dd4hep::AlignmentData::worldToLocal
void worldToLocal(const Position &global, Position &local) const
Transformation from world coordinates of the local placed volume coordinates.
Definition: AlignmentData.cpp:173
AlignmentsInterna.h
dd4hep::AlignmentCondition::iov
const IOV & iov() const
Access the IOV block.
Definition: Alignments.cpp:147
dd4hep::AlignmentCondition::iovType
const IOVType & iovType() const
Access the IOV type.
Definition: Alignments.cpp:142
dd4hep::AlignmentCondition::AlignmentCondition
AlignmentCondition()
Default constructor.
Definition: Alignments.h:75
dd4hep::AlignmentData::detectorTransformation
const TGeoHMatrix & detectorTransformation() const
Access the alignment/placement matrix with respect to the world.
Definition: AlignmentData.h:150
AlignmentData.h
dd4hep::detail::AlignmentObject
The data class behind an alignments handle.
Definition: AlignmentsInterna.h:56
dd4hep::AlignmentCondition::key
key_type key() const
Access the hash identifier.
Definition: Alignments.cpp:152