Retrieves the segment container from StoreGate and constructs TrackSeeds from them.
37 {
40
41
42 SG::ReadDecorHandle<xAOD::MuonSegmentContainer, std::vector<unsigned int>>
46 return StatusCode::SUCCESS;
47 }
48
49 std::map<unsigned int, MlComponent> components;
50
52 if (!segment) continue;
53 const std::vector<unsigned int>&
payload = componentAcc(*segment);
54 if (
payload.size() != 2 || payload[0] == 0)
continue;
55 MlComponent& component = components[
payload[0]];
56 component.segments.push_back(segment);
57 if (payload[1] != 0) component.anchors.push_back(segment);
58 }
59
60 std::size_t acceptedComponents = 0;
61 std::size_t constructedSeeds = 0;
62 for (const auto& [componentId, component] : components) {
66 component.anchors.empty()) {
67 continue;
68 }
69 ++acceptedComponents;
70
76 MsTrackSeed
seed{location, ExpandedSector{anchor->
position().phi()}};
77
78
79
82 std::map<Muon::MuonStationIndex::LayerIndex, std::pair<double, const xAOD::MuonSegment*>> bestPerLayer;
84 if (segment == anchor) continue;
87 if (layer == anchorLayer) continue;
91 if (!
best.second || cosAngle >
best.first)
best = {cosAngle, segment};
92 }
93 if (bestPerLayer.size() + 1 <
m_minLayers.value())
continue;
94
95 seed.addSegment(anchor);
96 for (
const auto& [layer, choice] : bestPerLayer)
seed.addSegment(
choice.second);
98 outSeeds.push_back(std::move(seed));
99 ++constructedSeeds;
100 }
102 << " seed(s) from ML component " << componentId
103 << " with " << component.segments.size()
104 << " segments");
105 }
106
107 ATH_MSG_DEBUG(
"Constructed " << constructedSeeds <<
" seed(s) from "
108 << acceptedComponents << "/" << components.size()
109 << " decorated ML component(s)");
110 return StatusCode::SUCCESS;
111}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_VERBOSE(x,...)
Gaudi::Property< unsigned int > m_minSegmentsPerCandidate
Gaudi::Property< double > m_minCosConsistency
SG::ReadDecorHandleKey< xAOD::MuonSegmentContainer > m_candidateDecorKey
SG::ReadHandleKey< xAOD::MuonSegmentContainer > m_segmentKey
Gaudi::Property< unsigned int > m_minLayers
Gaudi::Property< unsigned int > m_maxSegmentsPerCandidate
Location
Enum defining whether the seed is made in the endcap / barrel.
bool isAvailable()
Test to see if this variable exists in the store, for the referenced object.
Amg::Vector3D direction() const
Returns the direction as Amg::Vector.
::Muon::MuonStationIndex::ChIndex chamberIndex() const
Returns the chamber index.
Amg::Vector3D position() const
Returns the position as Amg::Vector.
bool isBarrel(const ChIndex index)
Returns true if the chamber index points to a barrel chamber.
LayerIndex
enum to classify the different layers in the muon spectrometer
LayerIndex toLayerIndex(ChIndex index)
convert ChIndex into LayerIndex
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
best(iterable, priorities=[3, 2, 1, -1, 0])
MuonSegmentContainer_v1 MuonSegmentContainer
Definition of the current "MuonSegment container version".
MuonSegment_v1 MuonSegment
Reference the current persistent version: