Loading [MathJax]/jax/output/SVG/config.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 
7 
8 namespace MuonR4 {
9 
10  std::ostream& operator<<(std::ostream& ostr, const MuonR4::MsTrackSeed& seed) {
11  ostr<<"Seed @"<<Amg::toString(seed.position())<<std::endl;
12  for (const xAOD::MuonSegment* seg : seed.segments()) {
13  ostr<<" **** "<<detailedSegment(*seg)->msSector()->identString()<<" "
14  <<Amg::toString(seg->position())<<" + "<<Amg::toString(seg->direction())
15  <<", chi2: "<<(seg->chiSquared() / seg->numberDoF())
16  <<", nPrec: "<<seg->nPrecisionHits()<<", nPhi: "<<seg->nPhiLayers()
17  <<", nTrigEta: "<<seg->nTrigEtaLayers()<<std::endl;
18  }
19  return ostr;
20  }
22  if (!compatibleSectors(msSector(), other.msSector())) {
23  return false;
24  }
25  if (other.segments().size() != m_segments.size()){
26  return false;
27  }
28  for (size_t s = 0; s < m_segments.size(); ++s) {
29  if (m_segments[s] != other.segments()[s]) {
30  return false;
31  }
32  }
33  return true;
34  }
36  if (!compatibleSectors(msSector(), other.msSector()) ||
37  other.segments().size() < segments().size()) {
38  return false;
39  }
40  auto searched_itr = other.segments().begin();
41  for (const xAOD::MuonSegment* seg : m_segments) {
42  searched_itr = std::find(searched_itr, other.segments().end(), seg);
43  if (searched_itr == other.segments().end()) {
44  return false;
45  }
46  }
47  return true;
48  }
49  MsTrackSeed::MsTrackSeed(const Location loc): m_loc{loc}{}
51  const std::unordered_set<const SpacePointBucket*>& MsTrackSeed::buckets() const { return m_buckets; }
52  const std::vector<const xAOD::MuonSegment*>& MsTrackSeed::segments() const { return m_segments; }
53  const std::vector<const Segment*>& MsTrackSeed::detailedSegments() const { return m_detSegments; }
54 
56  const Segment* recoSeg = detailedSegment(*seg);
57  auto insert_itr = std::ranges::find_if(m_detSegments, [recoSeg](const Segment* added){
58  return recoSeg->position().mag2() < added->position().mag2();
59  });
60  m_segments.insert(m_segments.begin() + std::distance(m_detSegments.begin(), insert_itr), seg);
61  m_buckets.insert(recoSeg->parent()->parentBucket());
62  m_detSegments.insert(insert_itr, recoSeg);
63  }
64  const Amg::Vector3D& MsTrackSeed::position() const { return m_pos; }
67  return m_detSegments.size() ? m_detSegments.front()->msSector() : nullptr;
68  }
70  const MuonGMR4::SpectrometerSector* secB) {
71  const unsigned int secMax = Muon::MuonStationIndex::numberOfSectors();
72  return secA->side() == secB->side() &&
73  std::abs(secA->sector() - secB->sector()) % secMax <= 1;
74  }
75 }
76 
MuonR4::SegmentSeed::parentBucket
const SpacePointBucket * parentBucket() const
Returns the bucket out of which the seed was formed.
Definition: SegmentSeed.cxx:38
MuonGMR4::SpectrometerSector::sector
int sector() const
Returns the sector of the MS-sector.
Definition: SpectrometerSector.cxx:43
MuonGMR4::SpectrometerSector::side
int8_t side() const
Returns the side of the MS-sector 1 -> A side ; -1 -> C side.
Definition: SpectrometerSector.cxx:36
MuonGMR4::SpectrometerSector
A spectrometer sector forms the envelope of all chambers that are placed in the same MS sector & laye...
Definition: SpectrometerSector.h:41
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
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::m_buckets
std::unordered_set< const SpacePointBucket * > m_buckets
Definition: MsTrackSeed.h:59
MuonGMR4::SpectrometerSector::identString
std::string identString() const
Returns a string encoding the chamber index & the sector of the MS sector.
Definition: SpectrometerSector.cxx:45
MuonR4::MsTrackSeed::operator<
bool operator<(const MsTrackSeed &other) const
Returns if all segments of this seed are also in the seed as well.
Definition: MsTrackSeed.cxx:35
Muon::MuonStationIndex::numberOfSectors
constexpr unsigned numberOfSectors()
return total number of sectors
Definition: MuonStationIndex.h:116
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:50
MuonR4::Segment::position
const Amg::Vector3D & position() const
Returns the global segment position.
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonPatternEvent/MuonPatternEvent/Segment.h:41
MuonR4::detailedSegment
const Segment * detailedSegment(const xAOD::MuonSegment &seg)
Helper function to navigate from the xAOD::MuonSegment to the MuonR4::Segment.
Definition: TrackingHelpers.cxx:7
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
MuonR4::Segment::parent
const SegmentSeed * parent() const
Returns the seed out of which the segment was built.
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonPatternEvent/MuonPatternEvent/Segment.h:51
MuonR4::MsTrackSeed::operator==
bool operator==(const MsTrackSeed &other) const
Equality operator.
Definition: MsTrackSeed.cxx:21
MsTrackSeed.h
MuonR4::Segment::msSector
const MuonGMR4::SpectrometerSector * msSector() const
Returns the associated MS sector.
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonPatternEvent/MuonPatternEvent/Segment.h:39
TrackingHelpers.h
MuonR4::MsTrackSeed::m_loc
Location m_loc
Definition: MsTrackSeed.h:55
MuonR4::MsTrackSeed::setPosition
void setPosition(Amg::Vector3D &&pos)
set the seed's position
Definition: MsTrackSeed.cxx:65
MuonR4::MsTrackSeed::MsTrackSeed
MsTrackSeed(const Location loc)
Constructor with location defintion.
Definition: MsTrackSeed.cxx:49
MuonR4::MsTrackSeed::detailedSegments
const std::vector< const Segment * > & detailedSegments() const
Returns the list of detailed segments.
Definition: MsTrackSeed.cxx:53
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
MuonR4
This header ties the generic definitions in this package.
Definition: HoughEventData.h:16
MuonR4::MsTrackSeed::msSector
const MuonGMR4::SpectrometerSector * msSector() const
Returns the associated MS sector.
Definition: MsTrackSeed.cxx:66
MuonR4::MsTrackSeed::buckets
const std::unordered_set< const SpacePointBucket * > & buckets() const
Returns the list of associated buckets.
Definition: MsTrackSeed.cxx:51
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
MuonR4::MsTrackSeed::position
const Amg::Vector3D & position() const
Returns the seed's position.
Definition: MsTrackSeed.cxx:64
MuonR4::operator<<
std::ostream & operator<<(std::ostream &ostr, const MuonR4::MsTrackSeed &seed)
Definition: MsTrackSeed.cxx:10
python.SystemOfUnits.s
float s
Definition: SystemOfUnits.py:146
MuonR4::MsTrackSeed::addSegment
void addSegment(const xAOD::MuonSegment *seg)
Append a segment to the seed.
Definition: MsTrackSeed.cxx:55
mag2
Scalar mag2() const
mag2 method - forward to squaredNorm()
Definition: AmgMatrixBasePlugin.h:31
MuonR4::MsTrackSeed::m_pos
Amg::Vector3D m_pos
Definition: MsTrackSeed.h:56
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54
MuonR4::MsTrackSeed::compatibleSectors
static bool compatibleSectors(const MuonGMR4::SpectrometerSector *secA, const MuonGMR4::SpectrometerSector *secB)
Returns whether two spectrometer sectors may be compatbile.
Definition: MsTrackSeed.cxx:69
MuonR4::MsTrackSeed::m_detSegments
std::vector< const Segment * > m_detSegments
Definition: MsTrackSeed.h:58
MuonR4::MsTrackSeed::m_segments
std::vector< const xAOD::MuonSegment * > m_segments
Definition: MsTrackSeed.h:57
MuonR4::MsTrackSeed::segments
const std::vector< const xAOD::MuonSegment * > & segments() const
Returns the vector of associated segments.
Definition: MsTrackSeed.cxx:52