ATLAS Offline Software
CompetingPixelClustersOnTrack.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 // CompetingPixelClustersOnTrack.cxx, (c) ATLAS Detector software
8 
10 #include "GaudiKernel/MsgStream.h"
11 #include "TrkSurfaces/Surface.h"
12 #include <cmath>
13 #include <ostream>
14 
15 // default constructor
18  , m_globalPosition{}
19  , m_containedChildRots()
20 {
21 }
22 
23 // copy constructor
26  : Trk::CompetingRIOsOnTrack(compROT)
27  , m_globalPosition{}
28  , m_containedChildRots()
29 {
30  std::vector<const InDet::PixelClusterOnTrack*>::const_iterator rotIter =
31  compROT.m_containedChildRots.begin();
32  for (; rotIter != compROT.m_containedChildRots.end(); ++rotIter) {
33  m_containedChildRots.push_back((*rotIter)->clone());
34  }
35  if (compROT.m_globalPosition) {
36  m_globalPosition.store(std::make_unique<const Amg::Vector3D>(*compROT.m_globalPosition));
37  }
38 }
39 
40 // explicit constructor
42  std::vector<const InDet::PixelClusterOnTrack*>&& childrots,
43  std::vector<AssignmentProb>&& assgnProb)
44  : Trk::CompetingRIOsOnTrack(std::move(assgnProb))
45  , m_globalPosition{}
46  , m_containedChildRots(std::move(childrots))
47 {
48  // initialize local position and error matrix
49  setLocalParametersAndErrorMatrix();
50 }
51 
55 {
56  if (this != &compROT) {
57  // assignment operator of base class
59  // clear rots
61  m_containedChildRots.clear();
62  if (compROT.m_globalPosition) {
63  m_globalPosition.store(std::make_unique<const Amg::Vector3D>(*compROT.m_globalPosition));
64  } else if (m_globalPosition) {
65  m_globalPosition.release().reset();
66  }
67  std::vector<const InDet::PixelClusterOnTrack*>::const_iterator rotIter =
68  compROT.m_containedChildRots.begin();
69  for (; rotIter != compROT.m_containedChildRots.end(); ++rotIter)
70  m_containedChildRots.push_back((*rotIter)->clone());
71  }
72  return (*this);
73 }
74 
77  InDet::CompetingPixelClustersOnTrack&& compROT) noexcept
78 {
79  if (this != &compROT) {
80  // move operator of base class
82  // clear rots
83  clearChildRotVector();
84  m_containedChildRots = std::move(compROT.m_containedChildRots);
85  m_globalPosition = std::move(compROT.m_globalPosition);
86  }
87  return (*this);
88 }
89 
91 {
93 }
94 
95 void
97 {
98  std::vector<const InDet::PixelClusterOnTrack*>::const_iterator rotIter =
99  m_containedChildRots.begin();
100  for (; rotIter != m_containedChildRots.end(); ++rotIter)
101  delete (*rotIter);
102 }
103 
104 MsgStream&
106 {
107  using std::ios;
108  out << "Trk::CompetingPixelClustersOnTrack with [" << numberOfContainedROTs()
109  << "] competing Pixel RIO_OnTrack objects" << std::endl;
111  out << " - GlobalPosition : ";
112  if (not m_globalPosition)
113  out << "null pointer" << std::endl;
114  else
115  out << *m_globalPosition << endmsg;
116  return out;
117 }
118 
119 std::ostream&
121 {
122  using std::ios;
123  out << "Trk::CompetingPixelClustersOnTrack with [" << numberOfContainedROTs()
124  << "] competing Pixel RIO_OnTrack objects" << std::endl;
126  out << " - GlobalPosition : ";
127  if (not m_globalPosition)
128  out << "null pointer" << std::endl;
129  else
130  out << *m_globalPosition << std::endl;
131  return out;
132 }
133 
134 // Have all the contained ROTs a common associated surface?
135 bool
137 {
138  return true;
139 }
140 
141 const Amg::Vector3D&
143 {
144  if (not m_globalPosition) {
145  m_globalPosition.set(std::make_unique<const Amg::Vector3D>(
146  associatedSurface().localToGlobal(localParameters())));
147  }
148  return *m_globalPosition;
149 }
Trk::CompetingRIOsOnTrack::dump
virtual MsgStream & dump(MsgStream &out) const override
returns the some information about the base class members (avoid code duplication)
Definition: CompetingRIOsOnTrack.cxx:115
Surface.h
InDet::CompetingPixelClustersOnTrack::operator=
CompetingPixelClustersOnTrack & operator=(const CompetingPixelClustersOnTrack &compROT)
Assignment operator.
Definition: CompetingPixelClustersOnTrack.cxx:53
InDet::CompetingPixelClustersOnTrack::dump
MsgStream & dump(MsgStream &out) const
returns some information about this MeasurementBase/CompetingPixelClustersOnTrack.
Definition: CompetingPixelClustersOnTrack.cxx:105
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
InDet::CompetingPixelClustersOnTrack::clearChildRotVector
void clearChildRotVector()
private method to clear the Trk::RIO_OnTrack vector
Definition: CompetingPixelClustersOnTrack.cxx:96
InDet::CompetingPixelClustersOnTrack::associatedSurface
const Trk::Surface & associatedSurface() const
returns the surface for the local to global transformation .
Definition: CompetingPixelClustersOnTrack.h:129
InDet::CompetingPixelClustersOnTrack::ROTsHaveCommonSurface
bool ROTsHaveCommonSurface(const bool withNonVanishingAssignProb=true) const
Have all the contained ROTs a common associated surface? If withNonVanishingAssignProb==true just the...
Definition: CompetingPixelClustersOnTrack.cxx:136
InDet::CompetingPixelClustersOnTrack::m_containedChildRots
std::vector< const InDet::PixelClusterOnTrack * > m_containedChildRots
The vector of contained InDet::PixelClusterOnTrack objects.
Definition: CompetingPixelClustersOnTrack.h:111
Trk::CompetingRIOsOnTrack::operator=
CompetingRIOsOnTrack & operator=(const CompetingRIOsOnTrack &compROT)=default
Assignment operator.
Trk::MeasurementBaseType::CompetingRIOsOnTrack
@ CompetingRIOsOnTrack
Definition: MeasurementBase.h:50
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
InDet::CompetingPixelClustersOnTrack::CompetingPixelClustersOnTrack
CompetingPixelClustersOnTrack()
Default Constructor for POOL.
Definition: CompetingPixelClustersOnTrack.cxx:16
InDet::CompetingPixelClustersOnTrack::numberOfContainedROTs
unsigned int numberOfContainedROTs() const
Number of RIO_OnTracks to be contained by this CompetingRIOsOnTrack.
Definition: CompetingPixelClustersOnTrack.h:147
InDet::CompetingPixelClustersOnTrack::globalPosition
const Amg::Vector3D & globalPosition() const
Interface method to get the global Position.
Definition: CompetingPixelClustersOnTrack.cxx:142
InDet::CompetingPixelClustersOnTrack
Definition: CompetingPixelClustersOnTrack.h:47
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Trk::MeasurementBase::localParameters
const LocalParameters & localParameters() const
Interface method to get the LocalParameters.
Definition: MeasurementBase.h:132
InDet::CompetingPixelClustersOnTrack::~CompetingPixelClustersOnTrack
virtual ~CompetingPixelClustersOnTrack()
Destructor.
Definition: CompetingPixelClustersOnTrack.cxx:90
InDet::CompetingPixelClustersOnTrack::m_globalPosition
CxxUtils::CachedUniquePtr< const Amg::Vector3D > m_globalPosition
The global Position.
Definition: CompetingPixelClustersOnTrack.h:108
CompetingPixelClustersOnTrack.h