ATLAS Offline Software
MuonClusterOnTrack.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // MuonClusterOnTrack.cxx
7 // Implementation file for class MuonClusterOnTrack
9 // (c) ATLAS Detector software
11 // Version 1.0 06/07/2004 Ketevi A. Assamagan
12 // adapted from Veronique Boisvert
14 
15 #include <new>
17 #include <iostream>
18 
19 namespace Muon {
20 
21 // Default constructor:
23  Trk::RIO_OnTrack(),
24  m_globalPosition(),
25  m_positionAlongStrip(0)
26 { }
27 
28 // copy constructor:
30  Trk::RIO_OnTrack(rot),
31  m_globalPosition()
32 {
34  if (rot.m_globalPosition) m_globalPosition.store(std::make_unique<const Amg::Vector3D>(*rot.m_globalPosition));
35 }
36 
37 
38 // Constructor with parameters
40  Trk::LocalParameters&& locpos,
41  Amg::MatrixX&& locerr,
42  const Identifier& id,
43  const double positionAlongStrip)
44  : RIO_OnTrack(std::move(locpos), std::move(locerr), id), // call base class constructor
45  m_globalPosition(),
46  m_positionAlongStrip(positionAlongStrip) {}
47 
48 // Destructor:
50 
51 // assignment operator:
53  if ( &rot != this) {
54  Trk::RIO_OnTrack::operator=(rot);//base class ass. op.
56  if (rot.m_globalPosition) m_globalPosition.store(std::make_unique<const Amg::Vector3D>(*rot.m_globalPosition));
57  else if (m_globalPosition) m_globalPosition.release().reset();
58  }
59  return *this;
60 }
61 
62 MsgStream& MuonClusterOnTrack::dump( MsgStream& stream) const
63 {
64  stream << MSG::INFO<<"MuonClusterOnTrack {"<<std::endl;
65 
67 
68  stream << "Global position (x,y,z) = (";
69  stream <<this->globalPosition().x()<<", "
70  <<this->globalPosition().y()<<", "
71  <<this->globalPosition().z()<<")"<<std::endl;
72  stream << "Position along strip: "<<m_positionAlongStrip<<std::endl;
73  stream<<"}"<<endmsg;
74  return stream;
75 }
76 
77 std::ostream& MuonClusterOnTrack::dump( std::ostream& stream) const
78 {
79  stream << "MuonClusterOnTrack {"<<std::endl;
80  std::ios_base::fmtflags originalFormat = stream.flags();
81 
83 
84  stream << std::setiosflags(std::ios::fixed)<< std::setprecision(3);
85 
86  stream << "Position along strip: "<<m_positionAlongStrip<<std::endl;
87  stream<<"}"<<std::endl;
88  stream.flags( originalFormat );
89 
90  return stream;
91 }
92 
94  if (detectorElement()==nullptr){
95  // Not much we can do here - no detelement, so just return 0,0,0
96  m_globalPosition.set(std::make_unique<const Amg::Vector3D>(0.0,0.0,0.0));
97  }
98 
99  if (not m_globalPosition) {
100  // calculate global position from the position of the strip and the position along the strip
104  else
106 
108  detectorElement()->surface( identify() ).localToGlobal(lpos, gpos, gpos);
109 
110  m_globalPosition.set(std::make_unique<const Amg::Vector3D>(gpos));
111  }
112 
113  return *m_globalPosition;
114 }
115 
116 }
117 
118 
Muon::MuonClusterOnTrack::~MuonClusterOnTrack
virtual ~MuonClusterOnTrack()
Destructor.
Trk::LocalParameters
Definition: LocalParameters.h:98
Trk::RIO_OnTrack::dump
virtual MsgStream & dump(MsgStream &out) const override
returns the some information about this RIO_OnTrack.
Definition: RIO_OnTrack.cxx:32
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition: EventPrimitives.h:29
Muon::MuonClusterOnTrack::globalPosition
virtual const Amg::Vector3D & globalPosition() const override
Returns global position.
Definition: MuonClusterOnTrack.cxx:93
Trk::locX
@ locX
Definition: ParamDefs.h:43
Trk::locY
@ locY
local cartesian
Definition: ParamDefs.h:44
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
Muon::MuonClusterOnTrack::m_globalPosition
CxxUtils::CachedUniquePtr< const Amg::Vector3D > m_globalPosition
cache global position, the global position has to be calculated in the inheriting classes
Definition: MuonClusterOnTrack.h:94
Muon::MuonClusterOnTrack::dump
virtual MsgStream & dump(MsgStream &stream) const override
Dumps information about the PRD.
Definition: MuonClusterOnTrack.cxx:62
Muon
This class provides conversion from CSC RDO data to CSC Digits.
Definition: TrackSystemController.h:49
MuonGM::MuonClusterReadoutElement::surface
virtual const Trk::PlaneSurface & surface() const override
access to chamber surface (phi orientation), uses the first gas gap
Definition: MuonClusterReadoutElement.h:123
AthenaPoolTestWrite.stream
string stream
Definition: AthenaPoolTestWrite.py:12
Muon::MuonClusterOnTrack::MuonClusterOnTrack
MuonClusterOnTrack()
Pool constructor.
Definition: MuonClusterOnTrack.cxx:22
Muon::MuonClusterOnTrack::detectorElement
virtual const MuonGM::MuonClusterReadoutElement * detectorElement() const override=0
Returns the detector element, associated with the PRD of this class.
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
contains
bool contains(const std::string &s, const std::string &regx)
does a string contain the substring
Definition: hcg.cxx:111
Trk::RIO_OnTrack::operator=
RIO_OnTrack & operator=(const RIO_OnTrack &rot)=default
Assignment operator.
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:191
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Trk::MeasurementBaseType::RIO_OnTrack
@ RIO_OnTrack
Definition: MeasurementBase.h:49
Trk::MeasurementBase::localParameters
const LocalParameters & localParameters() const
Interface method to get the LocalParameters.
Definition: MeasurementBase.h:132
Trk::RIO_OnTrack::identify
virtual Identifier identify() const final
return the identifier -extends MeasurementBase
Definition: RIO_OnTrack.h:155
get
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition: hcg.cxx:127
MuonClusterOnTrack.h
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
Muon::MuonClusterOnTrack
Base class for Muon cluster RIO_OnTracks.
Definition: MuonClusterOnTrack.h:34
Muon::MuonClusterOnTrack::m_positionAlongStrip
double m_positionAlongStrip
The position along the strip - used to calculate the GlobalPosition.
Definition: MuonClusterOnTrack.h:97
generate::Zero
void Zero(TH1D *hin)
Definition: generate.cxx:32
Muon::MuonClusterOnTrack::operator=
MuonClusterOnTrack & operator=(const MuonClusterOnTrack &)
Definition: MuonClusterOnTrack.cxx:52