ATLAS Offline Software
MuonSegment.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // TrkEvent
7 #include "CxxUtils/sincos.h"
15 
16 #include <cfloat>
17 #include <iostream>
18 namespace Muon {
19 
20 const float MuonSegment::kNoValue = FLT_MAX;
21 
23  : Segment()
24  , SpaceTimePointBase(kNoValue, kNoValue, 1.)
25  , Trk::SurfacePtrHolderImplDetEl<Trk::PlaneSurface>(nullptr)
26  , m_globalPosition()
27  , m_globalDirection()
28  , m_localDirection()
29 {}
30 
32  : Segment(seg)
33  , SpaceTimePointBase(seg)
34  , Trk::SurfacePtrHolderImplDetEl<Trk::PlaneSurface>(nullptr)
35  , m_globalPosition(seg.m_globalPosition)
36  , m_globalDirection(seg.m_globalDirection)
37  , m_localDirection(seg.m_localDirection)
38 {
41  : seg.m_associatedSurface->clone();
42 }
43 
46 {
47  if (this != &seg) {
54  }
55  return (*this);
56 }
57 
59  Amg::MatrixX&& locerr,
60  Trk::PlaneSurface* psf,
62  Trk::FitQuality* fqual,
64  : Segment(std::move(locpars), std::move(locerr),
65  std::move(cmeas), fqual, author)
66  , SpaceTimePointBase(kNoValue, kNoValue, 1.)
67  , Trk::SurfacePtrHolderImplDetEl<Trk::PlaneSurface>(psf)
68  , m_globalPosition()
69  , m_globalDirection()
70  , m_localDirection()
71 {
74 }
75 
77  const Trk::LocalDirection& locSegDir,
78  Amg::MatrixX&& locErr,
79  Trk::PlaneSurface* psf,
81  Trk::FitQuality* fqual,
83  : Segment(Trk::LocalParameters(), std::move(locErr),
84  std::move(cmeas), fqual, author)
85  , SpaceTimePointBase(kNoValue, kNoValue, 1.)
86  , Trk::SurfacePtrHolderImplDetEl<Trk::PlaneSurface>(psf)
87  , m_globalPosition()
88  , m_globalDirection()
89  , m_localDirection(locSegDir)
90 {
92 
93  Amg::Vector2D lpos(locSegPos[Trk::locX], locSegPos[Trk::locY]);
95 
96  double phi = m_globalDirection.phi();
97  double theta = m_globalDirection.theta();
98  std::array<Trk::DefinedParameter, 4> pars = {
99  {{locSegPos[Trk::locX], Trk::locX},
100  {locSegPos[Trk::locY], Trk::locY},
101  {phi, Trk::phi},
102  {theta, Trk::theta}}};
104 }
105 
106 MuonSegment::~MuonSegment() = default;
107 
108 void
110 {
111 
114 
115  double sintheta = sctheta.sn;
116  double costheta = sctheta.cs;
117  double sinphi = scphi.sn;
118  double cosphi = scphi.cs;
120  Amg::Vector3D(cosphi * sintheta, sinphi * sintheta, costheta);
123 }
124 
125 MsgStream&
126 MuonSegment::dump(MsgStream& out) const
127 {
128  out << "Muon::MuonSegment " << std::endl;
129  out << " - global position : " << std::endl
130  << Amg::toString(globalPosition()) << std::endl;
131  out << std::endl << localDirection() << std::endl;
132  out << " - local parameters : " << std::endl
133  << localParameters() << std::endl;
134  out << " - local Err Matrix : ";
135  out << std::endl << Amg::toString(localCovariance()) << std::endl;
136  if (nullptr != m_fitQuality)
137  out << " - fit Quality : " << std::endl
138  << (*fitQuality()) << std::endl;
139  else
140  out << " - fit Quality : NO " << std::endl;
141  out << " - associated Surface : " << std::endl
142  << associatedSurface() << std::endl;
143  out << " - t0 (error) : " << time() << "(" << errorTime() << ")"
144  << std::endl;
145  out << " - it contains : " << numberOfContainedROTs()
146  << " RIO_OnTrack object" << std::endl;
147  unsigned int numRoT = 1;
148  for (const Trk::MeasurementBase* m : containedMeasurements()) {
149  const Trk::RIO_OnTrack* rot = dynamic_cast<const Trk::RIO_OnTrack*>(m);
150  if (rot) {
151  out << "RoT " << numRoT++ << std::endl << *rot << std::endl;
152  }
153  }
154  return out;
155 }
156 
157 std::ostream&
158 MuonSegment::dump(std::ostream& out) const
159 {
160  out << "Muon::MuonSegment " << std::endl;
161  out << " - global position : " << std::endl
162  << Amg::toString(globalPosition()) << std::endl;
163  out << std::endl << localDirection() << std::endl;
164  out << " - local parameters : " << std::endl
165  << localParameters() << std::endl;
166  out << " - local Err Matrix : ";
167  out << std::endl << Amg::toString(localCovariance()) << std::endl;
168  if (nullptr != m_fitQuality)
169  out << " - fit Quality : " << std::endl
170  << (*fitQuality()) << std::endl;
171  else
172  out << " - fit Quality : NO " << std::endl;
173  out << " - associated Surface : " << std::endl
174  << associatedSurface() << std::endl;
175  out << " - t0 (error) : " << time() << "(" << errorTime() << ")"
176  << std::endl;
177  out << " - it contains : " << numberOfContainedROTs()
178  << " RIO_OnTrack object" << std::endl;
179  unsigned int numRoT = 1;
180  for (const Trk::MeasurementBase* m : containedMeasurements()) {
181  const Trk::RIO_OnTrack* rot = dynamic_cast<const Trk::RIO_OnTrack*>(m);
182  if (rot) {
183  out << "RoT " << numRoT++ << std::endl << *rot << std::endl;
184  }
185  }
186  return out;
187 }
188 
189 }
190 
Trk::SpaceTimePointBase::errorTime
float errorTime() const
access to the error on the measured time
Definition: SpaceTimePointBase.h:50
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
Trk::LocalParameters
Definition: LocalParameters.h:98
Trk::PlaneSurface::localToGlobalDirection
void localToGlobalDirection(const Trk::LocalDirection &locdir, Amg::Vector3D &globdir) const
This method transforms a local direction wrt the plane to a global direction.
Definition: PlaneSurface.cxx:242
Muon::MuonSegment::~MuonSegment
virtual ~MuonSegment()
Destructor.
Trk::SpaceTimePointBase::operator=
SpaceTimePointBase & operator=(const SpaceTimePointBase &stpb)=default
Assignment operator.
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition: EventPrimitives.h:29
Trk::Surface::associatedDetectorElement
const TrkDetElementBase * associatedDetectorElement() const
return associated Detector Element
Trk::SurfacePtrHolderImplDetEl::operator=
SurfacePtrHolderImplDetEl & operator=(const SurfacePtrHolderImplDetEl &other)
copy assingmemnt if surface is free we clone/copy.
Definition: SurfaceHolderImpl.h:192
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
Muon::MuonSegment::kNoValue
static const float kNoValue
define invalid value, used when the segment has no fitted t0
Definition: MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonSegment/MuonSegment/MuonSegment.h:48
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
Trk::locX
@ locX
Definition: ParamDefs.h:43
Trk::locY
@ locY
local cartesian
Definition: ParamDefs.h:44
Trk::TrackState::Segment
@ Segment
Definition: TrackStateDefs.h:37
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
Muon::MuonSegment::m_localDirection
Trk::LocalDirection m_localDirection
LocalDirection.
Definition: MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonSegment/MuonSegment/MuonSegment.h:142
theta
Scalar theta() const
theta method
Definition: AmgMatrixBasePlugin.h:71
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
sincos.h
Helper to simultaneously calculate sin and cos of the same angle.
Muon::MuonSegment::dump
virtual MsgStream & dump(MsgStream &out) const override final
returns some information about this RIO_OnTrack/TrackSegment.
Definition: MuonSegment.cxx:126
Muon::MuonSegment::m_globalPosition
Amg::Vector3D m_globalPosition
The global position the surface can be associated to.
Definition: MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonSegment/MuonSegment/MuonSegment.h:136
Trk::RIO_OnTrack
Definition: RIO_OnTrack.h:70
Muon
This class provides conversion from CSC RDO data to CSC Digits.
Definition: TrackSystemController.h:49
Trk::SurfacePtrHolderImplDetEl< Trk::PlaneSurface >::m_associatedSurface
const Trk::PlaneSurface * m_associatedSurface
Definition: SurfaceHolderImpl.h:244
Muon::MuonSegment::numberOfContainedROTs
unsigned int numberOfContainedROTs() const
number of RIO_OnTracks
Definition: MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonSegment/MuonSegment/MuonSegment.h:199
ParamDefs.h
Muon::MuonSegment::m_globalDirection
Amg::Vector3D m_globalDirection
cache global direction, not persistified
Definition: MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonSegment/MuonSegment/MuonSegment.h:139
Amg::toString
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Definition: GeoPrimitivesToStringConverter.h:40
DefinedParameter.h
CxxUtils::sincos::cs
double cs
Definition: sincos.h:95
EventPrimitivesToStringConverter.h
Trk::theta
@ theta
Definition: ParamDefs.h:72
Muon::MuonSegment::localDirection
const Trk::LocalDirection & localDirection() const
local direction
Definition: MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonSegment/MuonSegment/MuonSegment.h:169
Trk::Segment::containedMeasurements
const std::vector< const Trk::MeasurementBase * > & containedMeasurements() const
returns the vector of Trk::MeasurementBase objects
Definition: TrkEvent/TrkSegment/TrkSegment/Segment.h:166
Trk::Segment::operator=
Segment & operator=(const Segment &seg)
Assignment operator.
Definition: TrkEvent/TrkSegment/src/Segment.cxx:67
Trk::PlaneSurface::globalToLocalDirection
void globalToLocalDirection(const Amg::Vector3D &glodir, Trk::LocalDirection &locdir) const
This method transforms the global direction to a local direction wrt the plane.
Definition: PlaneSurface.cxx:260
Trk::FitQuality
Class to represent and store fit qualities from track reconstruction in terms of and number of degre...
Definition: FitQuality.h:97
DataVector< const Trk::MeasurementBase >
Trk::LocalDirection
represents the three-dimensional global direction with respect to a planar surface frame.
Definition: LocalDirection.h:81
Trk::MeasurementBase::m_localParams
LocalParameters m_localParams
Definition: MeasurementBase.h:111
Trk::MeasurementBase::localCovariance
const Amg::MatrixX & localCovariance() const
Interface method to get the localError.
Definition: MeasurementBase.h:138
Trk::MeasurementBase
Definition: MeasurementBase.h:58
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Trk::Segment::m_fitQuality
std::unique_ptr< FitQuality > m_fitQuality
The fit quality of the Segment.
Definition: TrkEvent/TrkSegment/TrkSegment/Segment.h:150
Muon::MuonSegment::recalculateCache
void recalculateCache()
recalculate the cache
Definition: MuonSegment.cxx:109
RIO_OnTrack.h
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
LocalParameters.h
CxxUtils::sincos::sn
double sn
Definition: sincos.h:92
Trk::MeasurementBase::localParameters
const LocalParameters & localParameters() const
Interface method to get the LocalParameters.
Definition: MeasurementBase.h:132
Muon::MuonSegment::operator=
MuonSegment & operator=(const MuonSegment &seg)
Assignment operator.
Definition: MuonSegment.cxx:45
Trk::PlaneSurface
Definition: PlaneSurface.h:64
CaloCondBlobAlgs_fillNoiseFromASCII.author
string author
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:26
GeoPrimitivesToStringConverter.h
CxxUtils::sincos
Helper to simultaneously calculate sin and cos of the same angle.
Definition: sincos.h:76
MuonSegment.h
Muon::MuonSegment::MuonSegment
MuonSegment()
Default Constructor for POOL.
Definition: MuonSegment.cxx:22
Trk::phi
@ phi
Definition: ParamDefs.h:81
Muon::MuonSegment::globalPosition
virtual const Amg::Vector3D & globalPosition() const override final
global position
Definition: MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonSegment/MuonSegment/MuonSegment.h:157
Trk::SpaceTimePointBase::time
float time() const
access to the measured time
Definition: SpaceTimePointBase.h:47
Muon::MuonSegment
Definition: MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonSegment/MuonSegment/MuonSegment.h:45
Trk::PlaneSurface::localToGlobal
virtual void localToGlobal(const Amg::Vector2D &locp, const Amg::Vector3D &mom, Amg::Vector3D &glob) const override final
Specified for PlaneSurface: LocalToGlobal method without dynamic memory allocation.
Definition: PlaneSurface.cxx:204
Trk::Segment::fitQuality
const FitQuality * fitQuality() const
return the FitQuality object, returns NULL if no FitQuality is defined
Definition: TrkEvent/TrkSegment/TrkSegment/Segment.h:160
FitQuality.h
ParticleJetParams::Author
Author
Definition: ParticleJetParamDefs.h:33
Trk::PlaneSurface::clone
virtual PlaneSurface * clone() const override
Virtual constructor.
Muon::MuonSegment::associatedSurface
virtual const Trk::PlaneSurface & associatedSurface() const override final
returns the surface for the local to global transformation
Definition: MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonSegment/MuonSegment/MuonSegment.h:175