ATLAS Offline Software
Loading...
Searching...
No Matches
TRT_DriftCircleOnTrack.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
6// TRT_DriftCircleOnTrack.cxx, (c) ATLAS Detector software
8
14#include "TrkSurfaces/Surface.h"
16
17#include "GaudiKernel/MsgStream.h"
18
19#include <cassert>
20#include <limits>
21#include <memory>
22#include <ostream>
23#include <utility>
24
26 const InDet::TRT_DriftCircle* RIO,
27 Trk::LocalParameters&& driftRadius,
28 Amg::MatrixX&& errDriftRadius,
29 const IdentifierHash& idDE,
30 double predictedLocZ,
31 const Amg::Vector3D& predictedTrackDirection,
33 // call base class constructor
34 : Trk::RIO_OnTrack(std::move(driftRadius), std::move(errDriftRadius), RIO->identify())
36 , m_positionAlongWire(predictedLocZ)
37 , m_idDE(idDE)
39 , m_highLevel(RIO->highLevel())
41 , m_detEl(RIO->detectorElement())
42{
43
44 m_rio.setElement(RIO);
45 const Trk::Surface& detElSurf = m_detEl->surface(RIO->identify());
46 if (detElSurf.type() == Trk::SurfaceType::Line) {
47 const Trk::StraightLineSurface& slsf =
48 static_cast<const Trk::StraightLineSurface&>(detElSurf);
49 m_globalPosition =
50 slsf.localToGlobal(m_localParams, predictedTrackDirection, predictedLocZ);
51 }
52 Amg::Vector3D loc_gDirection = predictedTrackDirection;
53 const double dr = m_localParams[Trk::driftRadius];
54
55 // scaling the direction with drift radius
56 if (dr != 0.) {
57 m_localAngle = std::atan2(loc_gDirection.y(), loc_gDirection.x());
58 } else {
59 m_localAngle = 0.;
60 }
61}
62
63//Constructor used by the converter
66 const Trk::LocalParameters& driftRadius,
67 const Amg::MatrixX& errDriftRadius,
69 const Identifier& id,
70 double predictedLocZ,
71 float localAngle,
73 bool highLevel,
74 double timeOverThreshold)
75 : Trk::RIO_OnTrack(Trk::LocalParameters(driftRadius), Amg::MatrixX(errDriftRadius), id)
78 , m_positionAlongWire(predictedLocZ)
79 , m_rio(RIO)
80 , m_idDE(idDE)
84 , m_detEl(nullptr)
85{}
86
87// Destructor:
89= default;
90
91// default constructor:
93 :
96 m_localAngle(std::numeric_limits<float>::quiet_NaN()),
97 m_positionAlongWire(std::numeric_limits<float>::quiet_NaN()),
98 m_rio(),
99 m_idDE(),
100 m_status(Trk::UNDECIDED),
101 m_highLevel(false),
103 m_detEl(nullptr)
104{}
105
106//copy constructor:
108
109= default;
110
111//assignment operator:
128
129//move assignment operator:
131 noexcept {
132 if ( &rot != this) {
134 m_globalPosition = std::move(rot.m_globalPosition);
135 m_rio = rot.m_rio;
136 m_localAngle = rot.m_localAngle;
137 m_positionAlongWire = rot.m_positionAlongWire;
138 m_idDE = rot.m_idDE;
139 m_status = rot.m_status;
140 m_highLevel = rot.m_highLevel;
141 m_timeOverThreshold = rot.m_timeOverThreshold;
142 m_detEl = rot.m_detEl;
143 }
144 return *this;
145}
146
152
153
155{
156 assert(0!=m_detEl);
157 return (m_detEl->surface(identify()));
158}
159
164
165
166//Global Position Helper for the converter
167void
169{
170
171 //default
172 Amg::Vector3D loc3Dframe(0., 0., m_positionAlongWire);
173 if (side() != Trk::NONE) {
174 // get global position where track and drift radius intersect.
175 double Sf, Cf;
176 sincos(m_localAngle, &Sf, &Cf);
177 double x = localParameters()[Trk::driftRadius] * Sf;
178 double y = localParameters()[Trk::driftRadius] * Cf;
179 /*
180 double x = localParameters()[Trk::driftRadius]*std::sin(m_localAngle);
181 double y = localParameters()[Trk::driftRadius]*std::cos(m_localAngle);
182 */
183 // get local position
184 loc3Dframe = Amg::Vector3D(x, y, m_positionAlongWire);
185 }
186
187 //We need a surface for the global position
188 const Trk::StraightLineSurface* slsf =
189 dynamic_cast<const Trk::StraightLineSurface*>(&(associatedSurface()));
190 if (slsf) {
191 m_globalPosition = Amg::Vector3D(slsf->transform() * loc3Dframe);
192 } else {
193 throw GaudiException("Dynamic_cast to StraightLineSurface failed!",
194 "TRT_DriftCircleOnTrack::setGlobalPosition()",
195 StatusCode::FAILURE);
196 }
197}
198
199//set Values to be used by the converter
200void
202 const Trk::PrepRawData*)
203{
204 m_detEl = dynamic_cast<const InDetDD::TRT_BaseElement* >(detEl);
205 // If we have a m_detEL we can set the global position
206 if (m_detEl) {
208 }
209}
210
211MsgStream& InDet::TRT_DriftCircleOnTrack::dump( MsgStream& sl ) const
212{
214 std::string name("TRT_DriftCircleOnTrack: ");
215 sl <<name<< "\t identifier = "<< identify()<<endmsg;
216 sl <<name<< "\t time-over-threshold = " << timeOverThreshold()
217 << (highLevel() ? " with TR flag ON":" with TR flag OFF") << endmsg;
218 sl <<name<< "\t driftradius = ("
219 << (localParameters())[Trk::loc1] << ") " <<endmsg;
220 sl <<name<< "\t has Error Matrix: "<<endmsg;
221 sl<<localCovariance()<<endmsg;
222 return sl;
223}
224
225std::ostream& InDet::TRT_DriftCircleOnTrack::dump( std::ostream& sl ) const
226{
227 sl << "TRT_DriftCircleOnTrack {"<<std::endl;
228
230
231 sl << "Global position (x,y,z) = (";
232 this->globalPosition();
233 sl <<this->globalPosition().x()<<", "
234 <<this->globalPosition().y()<<", "
235 <<this->globalPosition().z()<<")"<<std::endl;
236
237 sl << "\t time-over-threshold = " << timeOverThreshold()
238 << (highLevel() ? " with TR flag ON":" with TR flag OFF")<<std::endl;
239 sl<<"}"<<std::endl;
240
241 return sl;
242}
#define endmsg
if(febId1==febId2)
ElementLink< InDet::TRT_DriftCircleContainer > ElementLinkToIDCTRT_DriftCircleContainer
#define y
#define x
This is a "hash" representation of an Identifier.
Virtual base class of TRT readout elements.
Represents 'corrected' measurements from the TRT (for example, corrected for wire sag).
bool highLevel() const
returns true if the high level threshold was passed
TRT_DriftCircleOnTrack & operator=(const TRT_DriftCircleOnTrack &)
Assignment operator.
float m_localAngle
local angle to be written out
virtual const InDetDD::TRT_BaseElement * detectorElement() const override final
returns the detector element, assoicated with the PRD of this class
Trk::DriftCircleStatus m_status
the information how the (possibly signed) drift radius should be understood
float m_positionAlongWire
local position along wire to be written out
Trk::DriftCircleSide side() const
returns the side on which the drift radius is.
TRT_DriftCircleOnTrack()
Default constructor - needed for POOL.
void setGlobalPositionHelper()
@calculate and set the global coord of this hit.
ElementLinkToIDCTRT_DriftCircleContainer m_rio
const InDetDD::TRT_BaseElement * m_detEl
corresponding detector element
virtual MsgStream & dump(MsgStream &out) const override final
returns some information about this RIO_OnTrack.
IdentifierHash m_idDE
the IdentifierHash - probably not used
double timeOverThreshold() const
returns time over threshold in ns for valid digits; zero otherwise
virtual IdentifierHash idDE() const override final
returns the DE hashID
Trk::DriftCircleStatus status() const
returns the status of the drift radius calibration.
virtual const Amg::Vector3D & globalPosition() const override final
return the global position of this RIO_OnTrack
double m_timeOverThreshold
the time over threshold in nsec
virtual const Trk::Surface & associatedSurface() const override final
returns the surface for the local to global transformation
virtual ~TRT_DriftCircleOnTrack()
Destructor.
virtual void setValues(const Trk::TrkDetElementBase *detEl, const Trk::PrepRawData *prd) override final
ONLY for use in custom convertor Allows the custom convertor to reset values when persistying/reading...
Amg::Vector3D m_globalPosition
global position to be cached
const LocalParameters & localParameters() const
Interface method to get the LocalParameters.
const Amg::MatrixX & localCovariance() const
Interface method to get the localError.
LocalParameters m_localParams
Identifier identify() const
return the identifier
virtual MsgStream & dump(MsgStream &out) const override
returns the some information about this RIO_OnTrack.
RIO_OnTrack & operator=(const RIO_OnTrack &rot)=default
Assignment operator.
RIO_OnTrack(LocalParameters &&locpars, Amg::MatrixX &&loccov, const Identifier &id)
Constructor with parameters and without externalPrediction.
Identifier identify() const
return the identifier -extends MeasurementBase
Class for a StraightLineSurface in the ATLAS detector to describe dirft tube and straw like detectors...
Abstract Base Class for tracking surfaces.
const Amg::Transform3D & transform() const
Returns HepGeom::Transform3D by reference.
virtual constexpr SurfaceType type() const =0
Returns the Surface type to avoid dynamic casts.
This is the base class for all tracking detector elements with read-out relevant information.
Definition of ATLAS Math & Geometry primitives (Amg)
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Eigen::Matrix< double, 3, 1 > Vector3D
Ensure that the ATLAS eigen extensions are properly loaded.
DriftCircleSide
Enumerates the 'side' of the wire on which the tracks passed (i.e.
@ RIGHT
the drift radius is positive (see Trk::AtaStraightLine)
@ LEFT
the drift radius is negative (see Trk::AtaStraightLine)
@ NONE
it was not possible to determine the which side of the straw the track passed;
DriftCircleStatus
Enumerates the 'status' of the wire on which the tracks passed (based on the TRT_Side enum,...
@ UNDECIDED
sign of drift radius has not been determined
@ driftRadius
trt, straws
Definition ParamDefs.h:53
@ loc1
Definition ParamDefs.h:34
STL namespace.