ATLAS Offline Software
MsTrackSeed.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
8 
9 #include "Acts/Utilities/MathHelpers.hpp"
10 
11 #include <format>
12 
13 namespace MuonR4 {
14 
15  std::ostream& operator<<(std::ostream& ostr, const MuonR4::MsTrackSeed& seed) {
16  ostr<<"MS Track seed @"<<Amg::toString(seed.position())<<", sector: "<<seed.sector()<<std::endl;
17  using namespace Muon::MuonStationIndex;
18  for (const xAOD::MuonSegment* seg : seed.segments()) {
19  ostr<<" **** "<< printID(*seg)
20  <<", theta: "<<(seg->direction().theta() /Gaudi::Units::degree)
21  <<", phi: "<<(seg->direction().phi() /Gaudi::Units::degree)
22  <<", R: "<<Acts::fastHypot(seg->x(), seg->y())
23  <<", Z: "<<seg->z()<<" "<<(seg->position().theta() / Gaudi::Units::degree)
24  // <<", "<<SegmentFit::toString(SegmentFit::localSegmentPars(*seg))
25  <<", chi2: "<<(seg->chiSquared() / std::max(seg->numberDoF(), 1.f))
26  <<", nPrec: "<<seg->nPrecisionHits()
27  <<", nPhi: "<<seg->nPhiLayers()
28  <<", nTrigEta: "<<seg->nTrigEtaLayers()<<std::endl;
29  }
30  return ostr;
31  }
32  MsTrackSeed::MsTrackSeed(const Location loc, const int sector):
33  m_loc{loc}, m_sector{sector}{}
35  std::vector<const SpacePointBucket*> MsTrackSeed::buckets() const {
36  std::vector<const SpacePointBucket*> returnMe{};
37  for (const Segment* seg : detailedSegments()){
38  returnMe.push_back(seg->parent()->parentBucket());
39  }
40  return returnMe;
41  }
42 
43  const std::vector<const xAOD::MuonSegment*>& MsTrackSeed::segments() const { return m_segments; }
44  std::vector<const Segment*> MsTrackSeed::detailedSegments() const {
45  std::vector<const Segment*> segs{};
46  segs.reserve(segments().size());
47  for (const xAOD::MuonSegment* trfMe : segments()) {
48  if(const Segment* seg = detailedSegment(*trfMe); seg != nullptr){
49  segs.push_back(seg);
50  }
51  }
52  return segs;
53  }
55  const xAOD::MuonSegment* updated) {
58  if (itr == m_segments.end()){
59  THROW_EXCEPTION("The exisiting segment could not be found");
60  }
61  (*itr) = updated;
62  }
64  const float r2 = Acts::hypotSquare(seg->x(), seg->y(), seg->z());
65  auto insert_itr = std::ranges::find_if(m_segments,
66  [&r2](const xAOD::MuonSegment* added){
67  return r2 < Acts::hypotSquare(added->x(), added->y(), added->z());
68  });
69  m_segments.insert(insert_itr, seg);
70  }
71  const Amg::Vector3D& MsTrackSeed::position() const { return m_pos; }
73 
74 }
75 
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
MuonR4::printID
std::string printID(const xAOD::MuonSegment &seg)
Print the chamber ID of a segment, e.g.
Definition: TrackingHelpers.cxx:15
xAOD::MuonSegment_v1::x
float x() const
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
Muon::MuonStationIndex
Definition: MuonStationIndex.h:13
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
MuonR4::MsTrackSeed
Definition: MsTrackSeed.h:18
MuonR4::Segment
Placeholder for what will later be the muon segment EDM representation.
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonPatternEvent/MuonPatternEvent/Segment.h:19
xAOD::MuonSegment_v1
Class describing a MuonSegment.
Definition: MuonSegment_v1.h:33
MuonR4::MsTrackSeed::MsTrackSeed
MsTrackSeed(const Location loc, const int sector)
Constructor with location defintion.
Definition: MsTrackSeed.cxx:32
MuonR4::MsTrackSeed::Location
Location
Enum defining whether the seed is made in the endcap / barrel.
Definition: MsTrackSeed.h:21
MuonR4::MsTrackSeed::location
Location location() const
Returns the location of the seed.
Definition: MsTrackSeed.cxx:34
MuonR4::detailedSegment
const Segment * detailedSegment(const xAOD::MuonSegment &seg)
Helper function to navigate from the xAOD::MuonSegment to the MuonR4::Segment.
Definition: TrackingHelpers.cxx:22
MuonR4::MsTrackSeed::buckets
std::vector< const SpacePointBucket * > buckets() const
Returns the list of associated buckets.
Definition: MsTrackSeed.cxx:35
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
Amg::toString
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Definition: GeoPrimitivesToStringConverter.h:40
WriteCellNoiseToCool.exist
exist
Definition: WriteCellNoiseToCool.py:543
MuonR4::MsTrackSeed::detailedSegments
std::vector< const Segment * > detailedSegments() const
Returns the list of detailed segments.
Definition: MsTrackSeed.cxx:44
MsTrackSeed.h
MuonR4::MsTrackSeed::replaceSegment
void replaceSegment(const xAOD::MuonSegment *exist, const xAOD::MuonSegment *updated)
Replaces an already added segment in the seed with a better suited one.
Definition: MsTrackSeed.cxx:54
TrackingHelpers.h
MuonR4::MsTrackSeed::m_loc
Location m_loc
Location variable.
Definition: MsTrackSeed.h:58
MuonR4::MsTrackSeed::setPosition
void setPosition(Amg::Vector3D &&pos)
set the seed's position
Definition: MsTrackSeed.cxx:72
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
THROW_EXCEPTION
#define THROW_EXCEPTION(MESSAGE)
Definition: throwExcept.h:10
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:16
xAOD::MuonSegment_v1::z
float z() const
Returns the y position.
MuonR4
This header ties the generic definitions in this package.
Definition: HoughEventData.h:16
MuonR4::MsTrackSeed::position
const Amg::Vector3D & position() const
Returns the seed's position.
Definition: MsTrackSeed.cxx:71
xAOD::MuonSegment_v1::y
float y() const
Returns the x position.
SegmentFitterEventData.h
MuonR4::operator<<
std::ostream & operator<<(std::ostream &ostr, const MuonR4::MsTrackSeed &seed)
Definition: MsTrackSeed.cxx:15
MuonR4::MsTrackSeed::addSegment
void addSegment(const xAOD::MuonSegment *seg)
Append a segment to the seed.
Definition: MsTrackSeed.cxx:63
MuonR4::MsTrackSeed::m_pos
Amg::Vector3D m_pos
Definition: MsTrackSeed.h:60
python.SystemOfUnits.degree
tuple degree
Definition: SystemOfUnits.py:121
MuonR4::MsTrackSeed::m_segments
std::vector< const xAOD::MuonSegment * > m_segments
Definition: MsTrackSeed.h:61
MuonR4::MsTrackSeed::segments
const std::vector< const xAOD::MuonSegment * > & segments() const
Returns the vector of associated segments.
Definition: MsTrackSeed.cxx:43