63 const std::vector<CDCWireHit*>& wireHits)
const
65 assert(std::is_sorted(wireHits.begin(), wireHits.end(), LessOf<Deref>()) &&
66 "Expected wire hits to be sorted");
69 std::vector<const CDCWire*> m_wireNeighbors;
70 m_wireNeighbors.reserve(nWireNeighbors);
72 std::vector<CDCWireHit*> m_wireHitNeighbors;
73 m_wireHitNeighbors.reserve(2 * nWireNeighbors);
76 const CDCWire& wire = from->getWire();
84 const CDCWire* cwSixthSecondWireNeighbor = ccwSixthSecondWireNeighbor;
88 const CDCWire* cwTwelvethSecondWireNeighbor = ccwTwelvethSecondWireNeighbor;
94 m_wireNeighbors.push_back(ccwSixthSecondWireNeighbor);
96 if (cwInWireNeighbor) m_wireNeighbors.push_back(cwInWireNeighbor);
97 if (ccwInWireNeighbor) m_wireNeighbors.push_back(ccwInWireNeighbor);
99 if (cwWireNeighbor) m_wireNeighbors.push_back(cwWireNeighbor);
100 if (ccwWireNeighbor) m_wireNeighbors.push_back(ccwWireNeighbor);
102 if (cwOutWireNeighbor) m_wireNeighbors.push_back(cwOutWireNeighbor);
103 if (ccwOutWireNeighbor) m_wireNeighbors.push_back(ccwOutWireNeighbor);
106 m_wireNeighbors.push_back(ccwTwelvethSecondWireNeighbor);
109 if (cwSixthSecondWireNeighbor) {
110 cwSixthSecondWireNeighbor = cwSixthSecondWireNeighbor->
getNeighborCW();
111 m_wireNeighbors.push_back(cwSixthSecondWireNeighbor);
113 if (ccwSixthSecondWireNeighbor) {
114 ccwSixthSecondWireNeighbor = ccwSixthSecondWireNeighbor->
getNeighborCCW();
115 m_wireNeighbors.push_back(ccwSixthSecondWireNeighbor);
118 if (cwInWireNeighbor) {
120 m_wireNeighbors.push_back(cwInWireNeighbor);
122 if (ccwInWireNeighbor) {
124 m_wireNeighbors.push_back(ccwInWireNeighbor);
127 if (cwWireNeighbor) {
129 m_wireNeighbors.push_back(cwWireNeighbor);
131 if (ccwWireNeighbor) {
133 m_wireNeighbors.push_back(ccwWireNeighbor);
136 if (cwOutWireNeighbor) {
138 m_wireNeighbors.push_back(cwOutWireNeighbor);
140 if (ccwOutWireNeighbor) {
142 m_wireNeighbors.push_back(ccwOutWireNeighbor);
145 if (cwTwelvethSecondWireNeighbor) {
146 cwTwelvethSecondWireNeighbor = cwTwelvethSecondWireNeighbor->
getNeighborCW();
147 m_wireNeighbors.push_back(cwTwelvethSecondWireNeighbor);
149 if (ccwTwelvethSecondWireNeighbor) {
150 ccwTwelvethSecondWireNeighbor = ccwTwelvethSecondWireNeighbor->
getNeighborCCW();
151 m_wireNeighbors.push_back(ccwTwelvethSecondWireNeighbor);
155 std::sort(std::begin(m_wireNeighbors), std::end(m_wireNeighbors));
162 const bool prepared =
165 for (
const CDCWire* neighborWire : m_wireNeighbors) {
166 ConstVectorRange<CDCWireHit*> neighborWireHits = [&]() -> ConstVectorRange<CDCWireHit*> {
175 return ConstVectorRange<CDCWireHit*>{
176 std::equal_range(wireHits.begin(), wireHits.end(), neighborWire, LessOf<Deref>())
180 m_wireHitNeighbors.insert(m_wireHitNeighbors.end(),
181 neighborWireHits.
begin(),
182 neighborWireHits.
end());
185 return m_wireHitNeighbors;