ATLAS Offline Software
Loading...
Searching...
No Matches
MdtDriftCircleOnTrack.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
9#include "GaudiKernel/GaudiException.h"
10#include "GaudiKernel/StatusCode.h"
11#include <cmath>
12
13
14// Full Constructor :
15namespace Muon{
17 Trk::LocalParameters&& locPos,
18 Amg::MatrixX&& errDriftRadius,
19 const double driftTime,
21 const Amg::Vector3D& predictedTrackDirection,
22 const double positionAlongWire,
24 Trk::RIO_OnTrack{std::move(locPos), std::move(errDriftRadius), RIO->identify()},
29
30 assert(m_status!=Trk::UNDECIDED); // use of this constructor implies that the side is decided
31
32 m_rio.setElement(RIO);
33 m_globalPosition.store(std::make_unique<Amg::Vector3D>(associatedSurface().localToGlobal(m_localParams, predictedTrackDirection, positionAlongWire)));
34
35 Amg::Vector3D loc_gDirection = predictedTrackDirection;
36
38 if(driftRadius() > std::numeric_limits<float>::epsilon()) {
39 // Set loc_gDirection's perpendicular distance equal to driftRadius
40 Amg::setPerp(loc_gDirection, std::abs(driftRadius()));
41 const double ratio = loc_gDirection.x() / std::abs(driftRadius());
42 const double calc_angle = std::abs(ratio) >= 1. ? M_PI * (ratio < 0.) : std::acos(ratio);
43 m_localAngle = (loc_gDirection.y()<0.) ? 2*M_PI - calc_angle : calc_angle;
44 }
45}
46
47// Partial Constructor :
49 Trk::LocalParameters&& locPos,
50 Amg::MatrixX&& errDriftRadius,
51 const double driftTime,
53 const double positionAlongWire,
55 Trk::RIO_OnTrack{std::move(locPos), std::move(errDriftRadius), RIO->identify()},
60 assert(m_status!=Trk::DECIDED); // use of this constructor implies that the side is not decided
61 m_rio.setElement(RIO);
62}
63
75 Trk::LocalParameters&& locPos,
76 Amg::MatrixX&& errDriftRadius,
77 const Identifier& id,
78 const MuonGM::MdtReadoutElement* detEl,
79 const double driftTime,
81 const double positionAlongWire,
82 const double localAngle,
84 Trk::RIO_OnTrack{std::move(locPos), std::move(errDriftRadius), id},
86 m_rio{RIO},
91 m_detEl{detEl} {}
92
93
95 if (&other != this){
96 static_cast<Trk::RIO_OnTrack&>(*this) = other;
97 m_status = other.m_status;
98 m_rio = other.m_rio;
99 m_localAngle = other.m_localAngle;
100 m_driftTime = other.m_driftTime;
101 m_errorStrategy = other.m_errorStrategy;
102 m_positionAlongWire = other.m_positionAlongWire;
103 m_detEl = other.m_detEl;
104 m_globalPosition.release();
105 }
106 return *this;
107}
109 if (!m_globalPosition) {
110 if (side()==Trk::NONE) {
111 // side not defined, so we cannot determine the global position better than the position along the wire
112 Amg::Vector3D loc3Dframe = m_positionAlongWire * Amg::Vector3D::UnitZ();
113 setGlobalPosition(std::move(loc3Dframe));
114 } else {
115 // get global position where track and drift radius intersect.
116 double x = driftRadius()*std::sin(m_localAngle);
117 double y = driftRadius()*std::cos(m_localAngle);
118 Amg::Vector3D loc3Dframe(x, y, m_positionAlongWire);
119 setGlobalPosition(std::move(loc3Dframe));
120 }
121 }
122 return *m_globalPosition;
123}
124
126 Amg::Vector3D globPos = associatedSurface().transform() * loc3Dframe;
127 m_globalPosition.set(std::make_unique<Amg::Vector3D>(std::move(globPos)));
128}
129
130MsgStream& MdtDriftCircleOnTrack::dump( MsgStream& stream) const
131{
132 stream << MSG::INFO<<"MdtDriftCircleOnTrack {"<<std::endl;
134 stream << "DriftTime: "<<m_driftTime<<std::endl;
135 stream << "Status: "<<m_status<<std::endl;
136 stream << "Global position (x,y,z) = ";
137 stream << Amg::toString(globalPosition(),2)<<std::endl;
138
139 stream << "Position along wire: "<<positionAlongWire()<<", \tlocal angle="<<localAngle()<<std::endl;
140 stream << "Creation strategy: "<<m_errorStrategy;
141 stream<<"}"<<endmsg;
142 return stream;
143}
144
145std::ostream& MdtDriftCircleOnTrack::dump( std::ostream& stream) const
146{
147 stream << "MdtDriftCircleOnTrack {"<<std::endl;
149 stream << "DriftTime: "<<m_driftTime<<std::endl;
150 stream << "Status: "<<m_status<<std::endl;
151
152 stream << "Position along wire: "<<positionAlongWire()<<", \tlocal angle="<<localAngle()<<std::endl;
153 // stream << "Creation strategy: "<<m_errorStrategy; //FIXME!
154 stream<<"}"<<std::endl;
155 return stream;
156}
157
158}
159
#define M_PI
#define endmsg
ElementLink< Muon::MdtPrepDataContainer > ElementLinkToIDC_MDT_Container
#define y
#define x
const MuonDriftCircleErrorStrategy & errorStrategy() const
Get information about the creation strategy used by Muon::MdtDriftCircleOnTrackCreator when making th...
Trk::DriftCircleStatus status() const
Returns the status of the drift radius calibration.
double localAngle() const
Returns the local angle, as determined by the extrapolation used when creating this Trk::RIO_OnTrack.
virtual MsgStream & dump(MsgStream &stream) const override final
Dumps information about the PRD.
double m_positionAlongWire
This is the position of the point of closest approach, in the local z coord (i.e.
virtual const Amg::Vector3D & globalPosition() const override final
Returns the global Position.
double driftRadius() const
Returns the value of the drift radius.
void setGlobalPosition(Amg::Vector3D &&loc3Dframe) const
Uses the passed loc3Dframe to calculate and set the global coord of this hit.
MdtDriftCircleOnTrack()=default
Default ctor - for use by POOL only.
double driftTime() const
Returns the value of the drift time used to obtain the drift radius.
CxxUtils::CachedUniquePtr< Amg::Vector3D > m_globalPosition
global position of the measurement.
double m_driftTime
This is the drift time used to obtain the drift radius.
double m_localAngle
This angle is the position of the point of closest approach in cylindrical coordinates,...
Trk::DriftCircleStatus m_status
information on the status of the Mdt measurement - see Trk::DriftCircleStatus for definitions
const MuonGM::MdtReadoutElement * m_detEl
ElementLinkToIDC_MDT_Container m_rio
the pointer to the MdtPrepData object (mutable because it might need to be recreated when reading tra...
Trk::DriftCircleSide side() const
Returns the side on which the drift radius is wrt to the track.
MdtDriftCircleOnTrack & operator=(const MdtDriftCircleOnTrack &)
double positionAlongWire() const
Returns the position along the wire, as determined by the extrapolation used when creating this Trk::...
virtual const Trk::StraightLineSurface & associatedSurface() const override final
Returns the surface on which this measurement was taken.
MuonDriftCircleErrorStrategy m_errorStrategy
Records information about the 'strategy' used by Muon::MdtDriftCircleOnTrackCreator to make this obje...
Class to represent measurements from the Monitored Drift Tubes.
Definition MdtPrepData.h:33
LocalParameters m_localParams
Class to handle RIO On Tracks ROT) for InDet and Muons, it inherits from the common MeasurementBase.
Definition RIO_OnTrack.h:70
virtual MsgStream & dump(MsgStream &out) const override
returns the some information about this RIO_OnTrack.
RIO_OnTrack(LocalParameters &&locpars, Amg::MatrixX &&loccov, const Identifier &id)
Constructor with parameters and without externalPrediction.
Identifier identify() const
return the identifier -extends MeasurementBase
const Amg::Transform3D & transform() const
Returns HepGeom::Transform3D by reference.
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
void setPerp(Amg::Vector3D &v, double perp)
scales the vector in the xy plane without changing the z coordinate nor the angles
Eigen::Matrix< double, 3, 1 > Vector3D
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
Ensure that the ATLAS eigen extensions are properly loaded.
@ 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,...
@ DECIDED
sign of drift radius has been determined
@ UNDECIDED
sign of drift radius has not been determined
STL namespace.