ATLAS Offline Software
Loading...
Searching...
No Matches
TRT_EndcapElement.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
8
9#include "Identifier/Identifier.h"
11
14
15#include "CLHEP/Geometry/Transform3D.h"
16#include "GeoModelKernel/GeoDefinitions.h"
18
21
24
25namespace InDetDD {
26
27TRT_EndcapElement::TRT_EndcapElement(const GeoVFullPhysVol* volume,
28 const TRT_EndcapDescriptor* descriptor,
29 bool isPositive,
30 unsigned int wheelIndex,
31 unsigned int strawLayIndex,
32 unsigned int phiIndex,
33 const TRT_ID* idHelper,
35 :
36
37 TRT_BaseElement(volume,
38 idHelper->layer_id((isPositive ? 2 : -2),
39 phiIndex,
40 wheelIndex,
41 strawLayIndex),
42 idHelper,
44 , m_code(isPositive, wheelIndex, strawLayIndex, phiIndex)
45 , m_descriptor(descriptor)
46 , m_nextInZ(nullptr)
47 , m_previousInZ(nullptr)
48{
49 m_nstraws = m_descriptor->nStraws();
52}
53
65
67
68
69const double&
71{
72 return m_descriptor->strawLength();
73}
74
75const TRT_EndcapConditions*
77{
78 return nullptr;
79}
80
86
87void
89{
90 m_nextInZ = element;
91}
92
93void
98
99HepGeom::Transform3D
101{
102 // NB The tranformation to a straw is reconstructed here precisely as
103 // it was ... hopefully... in the factory. One could eliminate this
104 // requirement and make the code a little more robust in this regard but
105 // at the cost of doubling the descriptors. (One descriptor now suffices
106 // for both positive and negative endcaps).
107 const GeoXF::Function* f = m_descriptor->getStrawTransform();
108
109 if (f) {
110 int istraw = m_code.isPosZ() ? straw : m_descriptor->nStraws() - 1 - straw;
111
112 size_t offsetInto = m_descriptor->getStrawTransformOffset();
113
115 getMaterialGeom()->getAbsoluteTransform(alignStore) *
116 ((*f)(istraw + offsetInto))) *
120
121 } else {
122
123 // Will not work properly with alignments.
124 std::cout << "ALTERNATIVE METHOD" << std::endl;
125
126 double phi = m_descriptor->startPhi() + m_descriptor->strawPitch() * straw;
127 double r = m_descriptor->innerRadius() + 0.5 * m_descriptor->strawLength();
128 CLHEP::Hep3Vector pos(
129 r * cos(phi),
130 r * sin(phi),
131 (Amg::EigenTransformToCLHEP(getMaterialGeom()->getAbsoluteTransform(alignStore)) *
132 HepGeom::Point3D<double>())
133 .z());
134 CLHEP::HepRotation rot;
135 // Axis (in local (0,0,1)) points towards beam axis.
136 rot.rotateY(-0.5 * M_PI); // Make it point along -ve X.
137 rot.rotateZ(phi);
138 return HepGeom::Transform3D(rot, pos);
139 }
140}
141
142// The L3 Alignment
143HepGeom::Transform3D
145{
147 HepGeom::Transform3D rc;
148 if (container) {
149
150 // important note: dx1 moves the 'negative' wire endpoint end dx2
151 // the 'positive' wire endpoint in the local straw frame.
152 // In the global frame, 'dx1' corresponds to the readout side and 'dx2'
153 // to the side closest the beampipe.
154
155 int bec = getCode().isPosZ() ? +2 : -2;
156 int wheel = getCode().getWheelIndex();
157 int phimodule = getCode().getPhiIndex();
158 int strawlayer = getCode().getStrawLayerIndex();
161 wheel,
162 phimodule,
163 strawlayer,
164 straw,
166
167 double dx1 = container->getDx1(id);
168 double dx2 = container->getDx2(id);
169 double ang = (dx2 - dx1) / strawLength();
170 double dy = -1 * (dx2 + dx1) / 2.;
171
172 // In the local straw frame:
173 // - the z-axis is along the straw and points toward the beampipe
174 // - the x-axis is along global-z and away from the interaction point
175 // (locX = globZ A-side / locX = -1 *gobZ C-side)
176 // - the y-axis is along global phi_hat direction determined by the
177 // other 2.
178 // (clockwise C-side, counter clockwise A-Side)
179 rc = HepGeom::TranslateY3D(dy) * HepGeom::RotateX3D(ang);
180 }
181 return rc;
182}
183
186{
187 return m_descriptor->strawBounds();
188}
189
190const Trk::Surface&
192{
193 if (not m_surface)
194 m_surface.set(std::make_unique<Trk::DiscSurface>(*this));
195 return *m_surface;
196}
197
198void
200{
201 if (!m_surfaceCache.isValid()) {
203 }
204 // create the surface if needed
205 if (!m_surface) {
207 }
208}
209
212{
213 // Calculate the surface
214 double phiCenter = m_descriptor->startPhi() +
215 m_descriptor->strawPitch() * 0.5 * (nStraws() - 1);
216 double phiHalfWidth = 0.5 * m_descriptor->strawPitch() * nStraws();
217 double rMin = m_descriptor->innerRadius();
218 double rMax = rMin + m_descriptor->strawLength();
219
220 // The transform of the endcap is a translation in z for no
221 // misalignement. For the -ve endcap there is also a 180deg rotation
222 // around the y axis. getAbsoluteTransform() will also include the
223 // misalignment.
224 //
225 // To get the transform of the element we have to first rotate
226 // around z to the phi center of the element. We want the local z
227 // to point in the same direction for both endcaps (approximately
228 // global z axis). For the negative endcap we therefore have to
229 // rotate 180 CLHEP::deg around the Y axis.
230
231 // We need to rotate to phi center before we apply the
232 // misalignment. However, in the negative endcap the the phi
233 // location is inverted (due to 180 rotation around y axis). This is
234 // taken care of by the extra 180 CLHEP::deg rotation around Y that we do
235 // to get the z axis pointing in the correct direction.
236 auto transform =
237 m_code.isPosZ()
238 ? Amg::Transform3D((getMaterialGeom()->getAbsoluteTransform(alignStore) *
239 GeoTrf::RotateZ3D(phiCenter)))
240 : Amg::Transform3D((getMaterialGeom()->getAbsoluteTransform(alignStore) *
241 GeoTrf::RotateY3D(180 * CLHEP::deg) *
242 GeoTrf::RotateZ3D(phiCenter)));
243
244 // create the igredients and the cache
245 auto center = Amg::Vector3D(transform.translation());
246 auto bounds = std::make_unique<Trk::DiscBounds>(rMin, rMax, phiHalfWidth);
247 auto normal = Amg::Vector3D(transform.rotation().col(2));
248
249 return {transform, center, normal, std::move(bounds)};
250}
251
252int
254{
255 // Return +1 if the straw local axis is in the same direction as increasing
256 // eta direction,
257 // -1 otherwise.
258 // The straw axis by convention goes in the direction away from the readout.
259 // This is towards the beam pipe. For +ve endcap it is what we want. For -ve
260 // endcap it is oppposite.
261 //
262 //
263 return (m_code.isPosZ()) ? +1 : -1;
264}
265
266} // end namespace
267
#define M_PI
Scalar phi() const
phi method
static Double_t rc
Class for storing/accessing trt endpoint corrections data.
This is an Identifier helper class for the TRT subdetector.
#define z
Ensure that the extensions for the Vector3D are properly loaded.
const HepGeom::Transform3D getAbsoluteTransform(int straw) const
This is an alias to strawTransform(int straw)
unsigned int nStraws() const
Number of straws in the element.
virtual const Trk::SurfaceBounds & bounds() const override final
Straw layer bounds.
TRT_BaseElement(const GeoVFullPhysVol *volume, const Identifier &id, const TRT_ID *idHelper, const TRT_Conditions *conditions)
Constructor:
const TRT_Conditions * conditions() const
Return the TRT_Conditions object associated to this Detector element.
virtual const Amg::Vector3D & normal() const override final
Element Surface: normal of a straw layer.
virtual const Amg::Transform3D & transform() const override final
Element Surface: Get Transform of element in Tracking frame: Amg.
virtual const Amg::Vector3D & center() const override final
Element Surface: center of a straw layer.
CxxUtils::CachedValue< SurfaceCache > m_surfaceCache
std::vector< CxxUtils::CachedUniquePtr< SurfaceCacheBase > > m_strawSurfacesCache
helper element surface for the cache
CxxUtils::CachedUniquePtr< Trk::Surface > m_surface
std::vector< CxxUtils::CachedUniquePtr< Trk::StraightLineSurface > > m_strawSurfaces
This class is an interface to conditions objects.
const TRTCond::StrawDxContainer * dxContainer() const
unsigned int isPosZ() const
unsigned int getPhiIndex() const
unsigned int getStrawLayerIndex() const
unsigned int getWheelIndex() const
class TRT_EndcapDescriptor
virtual const double & strawLength() const override
Active straw length.
TRT_EndcapElement(const GeoVFullPhysVol *volume, const TRT_EndcapDescriptor *descriptor, bool isPositive, unsigned int wheelIndex, unsigned int strawLayIndex, unsigned int phiIndex, const TRT_ID *idHelper, const TRT_Conditions *conditions)
Constructor.
const TRT_EndcapCode & getCode() const
Doomed (?
const TRT_EndcapDescriptor * m_descriptor
void setNextInZ(const TRT_EndcapElement *element)
Set Next in Z.
virtual HepGeom::Transform3D calculateStrawTransform(int straw, GeoAlignmentStore *alignStore) const override
These transforms are effectively to the local coord system of a straw derived from GeoModel -> hence ...
virtual const Trk::Surface & elementSurface() const override
return the surface of the element
virtual ~TRT_EndcapElement()
Destructor:
virtual const Trk::SurfaceBounds & strawBounds() const override final
the straw bounds
const TRT_EndcapElement * m_nextInZ
const TRT_EndcapDescriptor * getDescriptor() const
Returns a pointer to a descriptor, giving common information on module construction.
virtual int strawDirection() const override final
StrawDirection.
SurfaceCache createSurfaceCacheHelper(GeoAlignmentStore *alignStore) const
void setPreviousInZ(const TRT_EndcapElement *element)
Set Previous in Z.
const TRT_EndcapElement * m_previousInZ
HepGeom::Transform3D calculateLocalStrawTransform(int straw) const
static const TRT_EndcapConditions * getConditionsData()
Returns a pointer to conditions data.
virtual void createSurfaceCache(GeoAlignmentStore *alignStore) const override
create the cache for the element
specialise to detector level
This is an Identifier helper class for the TRT subdetector.
Definition TRT_ID.h:82
Abstract base class for surface bounds to be specified.
Abstract Base Class for tracking surfaces.
int r
Definition globals.cxx:22
HepGeom::Transform3D EigenTransformToCLHEP(const Amg::Transform3D &eigenTransf)
Converts an Eigen-based Amg::Transform3D into a CLHEP-based HepGeom::Transform3D.
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 3, 1 > Vector3D
Message Stream Member.