ATLAS Offline Software
Loading...
Searching...
No Matches
SiDetectorManager.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
5
7
12
13#include "GeoModelKernel/GeoXF.h"
14#include "GeoGenericFunctions/Variable.h"
15#include "GeoModelKernel/GeoAlignableTransform.h"
21
22#include <iostream>
23
24namespace InDetDD
25{
26
27 SiDetectorManager::SiDetectorManager(StoreGateSvc * detStore, const std::string & name)
28 : InDetDetectorManager(detStore, name)
29 {
30 }
31
33
34 const std::string& SiDetectorManager::tag() const
35 {
36 return m_tag;
37 }
38
40 {
42 element_iter != getDetectorElementEnd();
43 ++element_iter) {
44
45 if (*element_iter) {
46 (*element_iter)->invalidate();
47 }
48 }
49 }
50
52 {
54 element_iter != getDetectorElementEnd();
55 ++element_iter) {
56 if (*element_iter) {
57 (*element_iter)->updateCache();
58 }
59 }
60 }
61
63 const Amg::Transform3D & localToGlobalXF,
64 const Amg::Transform3D & delta,
65 GeoVAlignmentStore* alignStore)
66 {
67 // ATTENTION -------------------------------------------------------- (A.S.)
68 // CLHEP < -- > AMG interface method
69
70 // Sets the alignable transform delta when the supplied delta is in the local
71 // reconstruction frame
72
73 // If the default transform to the local recostruction frame is
74 // T = A*B*C*D*E
75 // and the alignable transform is C with delta c and the delat in the local frame is l, then
76 // A*B*C*c*D*E = A*B*C*D*E*l
77 // c = (D*E) * l * (D*E).inverse()
78 // c = (A*B*C).inverse * T * l * T.inverse() * (A*B*C)
79
80 // To get default transform up and including the alignable transform,
81 // we assume the next volume down is a fullphys volume and so its
82 // transform is the transform we want (ie A*B*C in the above example).
83
84 if (!extXF) return false;
85
86 const GeoVFullPhysVol* child = extXF->child();
87 if (child && extXF->alignableTransform()) {
88 // the definitiv absolut transform is in CLHEP -> do the calculation in CLHEP
89 const GeoTrf::Transform3D& transform = child->getDefAbsoluteTransform(alignStore);
90 // calucluate the corrected delta according to the formula above
91 GeoTrf::Transform3D correctedDelta = transform.inverse()*localToGlobalXF // (A*B*C).inverse() * T
92 * delta // l
93 * localToGlobalXF.inverse() * transform; // T.inverse() * (A*B*C)
94 extXF->alignableTransform()->setDelta(correctedDelta, alignStore);
95 return true;
96 } else {
97 return false;
98 }
99 }
100
102 const Amg::Transform3D& delta,
103 GeoVAlignmentStore* alignStore) {
104 // ATTENTION -------------------------------------------------------- (A.S.)
105 // CLHEP < -- > AMG interface method
106
107 // Sets the alignable transform delta when the supplied delta is in the global frame.
108
109 // If the default transform down to the alignable transform is
110 // T = A*B*C
111 // and the alignable transform is C with delta c and the delta in the global frame is g, then
112 // A*B*C*c = g*A*B*C
113 // T*c = g*T
114 // c = T.inverse() * g * T
115
116 // To get default transform up and including the alignable transform,
117 // we assume the next volume down is a fullphys volume and so its
118 // transform is the transform we want (ie T=A*B*C in the above example).
119
120
121 if (!extXF) return false;
122
123 const GeoVFullPhysVol * child = extXF->child();
124 if (child && extXF->alignableTransform()) {
125 // do the calculation in CLHEP
126 const GeoTrf::Transform3D& transform = child->getDefAbsoluteTransform(alignStore);
127 extXF->alignableTransform()->setDelta(transform.inverse() * delta * transform, alignStore);
128 return true;
129 } else {
130 return false;
131 }
132 }
133
134 const SiDetectorDesign * SiDetectorManager::addDesign(std::unique_ptr<const SiDetectorDesign>&& design)
135 {
136 m_designs.push_back(std::move(design));
137 return m_designs.back().get();
138 }
139
141 {
142 return m_designs.size();
143 }
144
145
147 {
148 return m_designs[i].get();
149 }
150
151 void SiDetectorManager::setCommonItems(std::unique_ptr<const SiCommonItems>&& commonItems)
152 {
153 m_commonItems = std::move(commonItems);
154 }
155
156}// namespace InDetDD
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
DataModel_detail::iterator< DataVector > iterator
Definition DataVector.h:842
Class to hold alignable transform plus a pointer to the child volume and optionally a frame volume.
InDetDetectorManager(StoreGateSvc *detStore, const std::string &name)
Base class for the detector design classes for Pixel and SCT.
virtual void updateAll() const
Update all caches.
virtual void invalidateAll()
Invalidate cache for all detector elements.
const std::string & tag() const
Get tag used in dictionary.
SiDetectorManager(StoreGateSvc *detStore, const std::string &name)
void setCommonItems(std::unique_ptr< const SiCommonItems > &&commonItems)
Set SiCommonItems.
const SiDetectorDesign * getDesign(int i) const
std::vector< std::unique_ptr< const SiDetectorDesign > > m_designs
const SiDetectorDesign * addDesign(std::unique_ptr< const SiDetectorDesign > &&)
Access to module design; returns an observer pointer.
virtual SiDetectorElementCollection::const_iterator getDetectorElementEnd() const =0
virtual SiDetectorElementCollection::const_iterator getDetectorElementBegin() const =0
std::unique_ptr< const SiCommonItems > m_commonItems
static bool setAlignableTransformGlobalDelta(ExtendedAlignableTransform *extXF, const Amg::Transform3D &delta, GeoVAlignmentStore *alignStore=nullptr)
Helper method to set delta transform from a global delta - Amg interface.
static bool setAlignableTransformLocalDelta(ExtendedAlignableTransform *extXF, const Amg::Transform3D &localToGlobalXF, const Amg::Transform3D &delta, GeoVAlignmentStore *alignStore=nullptr)
Helper method to set delta transform from a local delta - Amg interface.
The Athena Transient Store API.
Eigen::Affine3d Transform3D
Message Stream Member.