ATLAS Offline Software
Loading...
Searching...
No Matches
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
13namespace 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 }
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) {
56 std::vector<const xAOD::MuonSegment*>::iterator itr =
57 std::ranges::find(m_segments, exist);
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; }
72 void MsTrackSeed::setPosition(Amg::Vector3D&& pos) { m_pos = std::move(pos); }
73
74}
75
Scalar phi() const
phi method
Scalar theta() const
theta method
MsTrackSeed(const Location loc, const int sector)
Constructor with location defintion.
const Amg::Vector3D & position() const
Returns the seed's position.
int sector() const
Returns the seed's sector.
Definition MsTrackSeed.h:55
void addSegment(const xAOD::MuonSegment *seg)
Append a segment to the seed.
Location m_loc
Location variable.
Definition MsTrackSeed.h:58
std::vector< const Segment * > detailedSegments() const
Returns the list of detailed segments.
std::vector< const SpacePointBucket * > buckets() const
Returns the list of associated buckets.
Location location() const
Returns the location of the seed.
Location
Enum defining whether the seed is made in the endcap / barrel.
Definition MsTrackSeed.h:21
Amg::Vector3D m_pos
Definition MsTrackSeed.h:60
std::vector< const xAOD::MuonSegment * > m_segments
Definition MsTrackSeed.h:61
const std::vector< const xAOD::MuonSegment * > & segments() const
Returns the vector of associated segments.
void replaceSegment(const xAOD::MuonSegment *exist, const xAOD::MuonSegment *updated)
Replaces an already added segment in the seed with a better suited one.
void setPosition(Amg::Vector3D &&pos)
set the seed's position
Placeholder for what will later be the muon segment EDM representation.
float y() const
Returns the x position.
float z() const
Returns the y position.
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Eigen::Matrix< double, 3, 1 > Vector3D
This header ties the generic definitions in this package.
std::string printID(const xAOD::MuonSegment &seg)
Print the chamber ID of a segment, e.g.
std::ostream & operator<<(std::ostream &ostr, const MuonR4::MsTrackSeed &seed)
const Segment * detailedSegment(const xAOD::MuonSegment &seg)
Helper function to navigate from the xAOD::MuonSegment to the MuonR4::Segment.
MuonSegment_v1 MuonSegment
Reference the current persistent version:
#define THROW_EXCEPTION(MESSAGE)
Definition throwExcept.h:10