ATLAS Offline Software
TrkEvent/TrkSegment/src/Segment.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 // Segment.cxx, (c) ATLAS Detector software
8 
9 #include <memory>
10 
12 #include "TrkSegment/Segment.h"
13 
14 // default constructor
16  : Trk::MeasurementBase()
18  , m_fitQuality(nullptr)
19  , m_containedMeasBases()
20  , m_author(AuthorUnknown)
21 {
22 }
23 
25  Amg::MatrixX&& locerr,
26  DataVector<const MeasurementBase>&& measurements,
27  FitQuality* fitqual,
28  Author author)
29  : Trk::MeasurementBase(std::move(locpars), std::move(locerr))
31  , m_fitQuality(fitqual)
32  , m_containedMeasBases(std::move(measurements))
33  , m_author(author)
34 {
35 }
36 
37 // copy constructor
39  : Trk::MeasurementBase(seg)
40  , Trk::ObjectCounter<Trk::Segment>(seg)
41  , m_fitQuality(seg.m_fitQuality ? seg.m_fitQuality->clone() : nullptr)
42  , m_containedMeasBases()
43  , m_author(seg.m_author)
44 {
45  // DV deep copy
46  m_containedMeasBases.reserve(seg.m_containedMeasBases.size());
47  for (const Trk::MeasurementBase* const measurement :
50  }
51 }
52 
53 // move constructor
56  , m_fitQuality(std::move(seg.m_fitQuality))
57  , m_containedMeasBases(std::move(seg.m_containedMeasBases))
58  , m_author(seg.m_author)
59 {
60 }
61 
62 // destructor - child save
63 Trk::Segment::~Segment() = default;
64 
65 // assignment operator
68 {
69  if (this != &seg) {
71  m_fitQuality.reset(seg.m_fitQuality ? seg.m_fitQuality->clone() : nullptr);
72  // Deep copy
73  m_containedMeasBases.clear();
74  m_containedMeasBases.reserve(seg.m_containedMeasBases.size());
75  for (const Trk::MeasurementBase* const measurement :
77  m_containedMeasBases.push_back(measurement->clone());
78  }
79  m_author = seg.m_author;
80  }
81  return (*this);
82 }
83 
84 // move assignment operator
87 {
88  if (this != &seg) {
90  m_fitQuality = std::move(seg.m_fitQuality);
91  m_containedMeasBases = std::move(seg.m_containedMeasBases);
92  m_author = seg.m_author;
93  }
94  return (*this);
95 }
96 
97 std::string Trk::Segment::dumpAuthor() const {
98  std::string author;
99  switch (m_author) {
100  case AuthorUnknown:
101  author = "AuthorUnknown";
102  break;
103  case MooMdtSegmentMakerTool:
104  author = "MooMdtSegmentMakerTool";
105  break;
106  case MooCscSegmentMakerTool:
107  author = "MooCscSegmentMakerTool";
108  break;
109  case Muonboy:
110  author = "Muonboy";
111  break;
112  case DCMathSegmentMaker:
113  author = "DCMathSegmentMaker";
114  break;
115  case MDT_DHoughSegmentMakerTool:
116  author = "MDT_DHoughSegmentMakerTool";
117  break;
118  case CSC_DHoughSegmentMakerTool:
119  author = "CSC_DHoughSegmentMakerTool";
120  break;
121  case Csc2dSegmentMaker:
122  author = "Csc2dSegmentMaker";
123  break;
124  case Csc4dSegmentMaker:
125  author = "Csc4dSegmentMaker";
126  break;
127  case TRT_SegmentMaker:
128  author = "TRT_SegmentMaker";
129  break;
130  case NswStereoSeeded:
131  author = "Nsw MM stereo seeded";
132  break;
133  case NswStgcSeeded:
134  author = "Nsw sTgc seeded";
135  break;
136  case NswQuadAlign:
137  author = "Nsw single quad";
138  break;
139  case NswPadSeeded:
140  author = "Nsw single quad";
141  break;
142  default:
143  author = "Unrecognised author, enum = " + std::to_string(m_author);
144  break;
145  }
146  return author;
147 }
149  m_author = a;
150 }
Trk::Segment::Author
Author
enum to identify who created the segment.
Definition: Tracking/TrkEvent/TrkSegment/TrkSegment/Segment.h:63
Trk::Segment::setAuthor
void setAuthor(Author a)
sets the segment author
Definition: TrkEvent/TrkSegment/src/Segment.cxx:148
Trk::LocalParameters
Definition: LocalParameters.h:98
Trk::MeasurementBase::operator=
MeasurementBase & operator=(const MeasurementBase &)=default
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition: EventPrimitives.h:27
Trk::MeasurementBase::clone
virtual MeasurementBase * clone() const =0
Pseudo-Constructor.
Csc4dSegmentMaker
Definition: Csc4dSegmentMaker.h:37
Trk::Segment::m_containedMeasBases
DataVector< const MeasurementBase > m_containedMeasBases
The vector of contained (generic) Trk::MeasurementBase objects.
Definition: Tracking/TrkEvent/TrkSegment/TrkSegment/Segment.h:153
xAOD::Muonboy
@ Muonboy
Tracks from MuonBoy.
Definition: TrackingPrimitives.h:95
python.Utilities.clone
clone
Definition: Utilities.py:134
Trk::ObjectCounter
Helper to enable counting number of instantiations in debug builds.
Definition: TrkObjectCounter.h:18
Trk::Segment
Definition: Tracking/TrkEvent/TrkSegment/TrkSegment/Segment.h:56
Trk::Segment::operator=
Segment & operator=(const Segment &seg)
Assignment operator.
Definition: TrkEvent/TrkSegment/src/Segment.cxx:67
Trk::Segment::measurement
const MeasurementBase * measurement(unsigned int) const
returns the Trk::MeasurementBase objects depending on the integer
Definition: Tracking/TrkEvent/TrkSegment/TrkSegment/Segment.h:184
Trk::FitQuality
Class to represent and store fit qualities from track reconstruction in terms of and number of degre...
Definition: FitQuality.h:97
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
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: Tracking/TrkEvent/TrkSegment/TrkSegment/Segment.h:150
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
Trk::Segment::m_author
Author m_author
segment author
Definition: Tracking/TrkEvent/TrkSegment/TrkSegment/Segment.h:156
a
TList * a
Definition: liststreamerinfos.cxx:10
Trk::Segment::Segment
Segment()
Default Constructor for POOL.
Definition: TrkEvent/TrkSegment/src/Segment.cxx:15
CaloCondBlobAlgs_fillNoiseFromASCII.author
string author
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:26
Trk::Segment::dumpAuthor
std::string dumpAuthor() const
returns human readble string version of author
Definition: TrkEvent/TrkSegment/src/Segment.cxx:97
xAOD::EgammaParameters::AuthorUnknown
const uint16_t AuthorUnknown
for the Authors of the egamma objects
Definition: EgammaDefs.h:22
FitQuality.h
Csc2dSegmentMaker
Definition: Csc2dSegmentMaker.h:24
Segment.h
Trk::Segment::~Segment
virtual ~Segment()
Destructor.