ATLAS Offline Software
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 
11 #include "StoreGate/StoreGateSvc.h"
12 
13 #include "GeoModelKernel/GeoXF.h"
14 #include "GeoGenericFunctions/Variable.h"
15 #include "GeoModelKernel/GeoAlignableTransform.h"
21 
22 #include <iostream>
23 
24 namespace InDetDD
25 {
26 
29  {
30  }
31 
33 
34  const std::string& SiDetectorManager::tag() const
35  {
36  return m_tag;
37  }
38 
40  {
41  for (SiDetectorElementCollection::const_iterator element_iter = getDetectorElementBegin();
42  element_iter != getDetectorElementEnd();
43  ++element_iter) {
44 
45  if (*element_iter) {
46  (*element_iter)->invalidate();
47  }
48  }
49  }
50 
52  {
53  for (SiDetectorElementCollection::const_iterator element_iter = getDetectorElementBegin();
54  element_iter != getDetectorElementEnd();
55  ++element_iter) {
56  if (*element_iter) {
57  (*element_iter)->setCache();
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
InDetDD::ExtendedAlignableTransform::alignableTransform
GeoAlignableTransform * alignableTransform()
Definition: ExtendedAlignableTransform.h:43
InDetDD::SiDetectorManager::m_tag
std::string m_tag
Definition: SiDetectorManager.h:146
InDetDD::SiDetectorManager::SiDetectorManager
SiDetectorManager(StoreGateSvc *detStore, const std::string &name)
Definition: SiDetectorManager.cxx:27
InDetDD::SiDetectorManager::m_designs
std::vector< std::unique_ptr< const SiDetectorDesign > > m_designs
Definition: SiDetectorManager.h:148
InDetDD::SiDetectorManager::numDesigns
int numDesigns() const
Definition: SiDetectorManager.cxx:140
InDetDD::SiDetectorManager::setAlignableTransformLocalDelta
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.
Definition: SiDetectorManager.cxx:62
ExtendedAlignableTransform.h
InDetDD::SiDetectorManager::addDesign
const SiDetectorDesign * addDesign(std::unique_ptr< const SiDetectorDesign > &&)
Access to module design; returns an observer pointer.
Definition: SiDetectorManager.cxx:134
IdDictManager.h
InDetDD::SiDetectorManager::setCommonItems
void setCommonItems(std::unique_ptr< const SiCommonItems > &&commonItems)
Set SiCommonItems.
Definition: SiDetectorManager.cxx:151
InDetDD::SiDetectorManager::setAlignableTransformGlobalDelta
static bool setAlignableTransformGlobalDelta(ExtendedAlignableTransform *extXF, const Amg::Transform3D &delta, GeoVAlignmentStore *alignStore=nullptr)
Helper method to set delta transform from a global delta - Amg interface.
Definition: SiDetectorManager.cxx:101
InDetDD::SiDetectorManager::~SiDetectorManager
virtual ~SiDetectorManager()
AtlasDetectorID.h
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
InDetDD::SiDetectorManager::invalidateAll
virtual void invalidateAll() const
Invalidate cache for all detector elements.
Definition: SiDetectorManager.cxx:39
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:125
lumiFormat.i
int i
Definition: lumiFormat.py:85
InDetDD::ExtendedAlignableTransform::child
const GeoVFullPhysVol * child()
Definition: ExtendedAlignableTransform.h:44
SiCommonItems.h
AlignableTransformContainer.h
InDetDD::SiDetectorManager::getDesign
const SiDetectorDesign * getDesign(int i) const
Definition: SiDetectorManager.cxx:146
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
Amg::transform
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Definition: GeoPrimitivesHelpers.h:156
InDetDD::InDetDetectorManager
Definition: InDetDetectorManager.h:60
CLHEPtoEigenConverter.h
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
InDetDD::SiDetectorManager::tag
const std::string & tag() const
Get tag used in dictionary.
Definition: SiDetectorManager.cxx:34
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
SiDetectorElementCollection.h
InDetDD::ExtendedAlignableTransform
Definition: ExtendedAlignableTransform.h:31
SiDetectorElement.h
InDetDD
Message Stream Member.
Definition: FakeTrackBuilder.h:8
InDetDD::SiDetectorManager::getDetectorElementEnd
virtual SiDetectorElementCollection::const_iterator getDetectorElementEnd() const =0
InDetDD::SiDetectorManager::updateAll
virtual void updateAll() const
Update all caches.
Definition: SiDetectorManager.cxx:51
SiDetectorManager.h
InDetDD::SiDetectorDesign
Definition: SiDetectorDesign.h:50
InDetDD::SiDetectorManager::getDetectorElementBegin
virtual SiDetectorElementCollection::const_iterator getDetectorElementBegin() const =0
InDetDD::SiDetectorManager::m_commonItems
std::unique_ptr< const SiCommonItems > m_commonItems
Definition: SiDetectorManager.h:149
StoreGateSvc.h