19 declareInterface<IMuonCombinedInDetExtensionTool>(
this);
20 declareInterface<MuonInsideOutRecoTool>(
this);
38 return StatusCode::SUCCESS;
43 const EventContext& ctx)
const {
44 ATH_MSG_WARNING(
"This version is deprecated, please use extendWithPRDs for MuGirl");
46 extendWithPRDs(inDetCandidates, tagMap, prdData, combTracks, meTracks, segments, ctx);
54 std::vector<std::shared_ptr<const Muon::MuonSegment>> msegments;
59 for(
auto trkSeg : *segInColl){
61 std::shared_ptr<const Muon::MuonSegment> mseg2 = std::make_shared<const Muon::MuonSegment>(*muonSeg);
62 msegments.push_back(mseg2);
74 ATH_MSG_DEBUG(
" skip silicon associated track for extension ");
83 if (!muonSystemExtension) {
91 std::vector<Muon::MuonLayerRecoData> allLayers;
93 const std::vector<Muon::MuonSystemExtension::Intersection>& layerIntersections = muonSystemExtension->
layerIntersections();
94 ATH_MSG_DEBUG(
" ID track: pt " << indetTrackParticle.
pt() <<
" eta " << indetTrackParticle.
eta() <<
" phi "
95 << indetTrackParticle.
phi() <<
" layers " << layerIntersections.size());
104 if (!
getLayerData(layer_intersect.layerSurface, layerPrepRawData, prdData)) {
111 m_segmentFinder->find(ctx, layer_intersect, layerPrepRawData, segments);
113 if (segments.empty())
continue;
117 for (
const std::shared_ptr<const Muon::MuonSegment>& seg : segments)
m_recoValidationTool->add(layer_intersect, *seg, 0);
121 std::vector<std::shared_ptr<const Muon::MuonSegment>> selectedSegments;
123 if (selectedSegments.empty())
continue;
131 allLayers.emplace_back(layer_intersect, std::move(selectedSegments));
135 msg(MSG::DEBUG) <<
" Layers with segments " << allLayers.size();
136 for (
auto& layer : allLayers) {
137 for (
auto& seg : layer.segments) {
msg(MSG::DEBUG) << std::endl <<
m_printer->print(*seg); }
143 std::pair<std::unique_ptr<const Muon::MuonCandidate>, std::unique_ptr<Trk::Track>> bestCandidate =
145 if (!bestCandidate.first) {
return; }
148 addTag(ctx, indetCandidate, tagMap, *bestCandidate.first, bestCandidate.second, combTracks, meTracks, segColl);
153 const std::vector<Muon::MuonLayerRecoData>& allLayers)
const {
155 std::vector<Muon::MuonCandidate> resolvedCandidates;
160 typedef std::pair<std::unique_ptr<Trk::Track>, std::unique_ptr<const Muon::MuonCandidate>> candidatePair;
161 std::vector<candidatePair> trackCandidateLookup;
165 if (!track || !track->isValid() || !track->fitQuality()->numberDoF())
continue;
168 trackCandidateLookup.emplace_back(std::move(track), std::make_unique<Muon::MuonCandidate>(std::move(candidate)));
174 if (tracks.
empty())
return {
nullptr,
nullptr};
177 if (tracks.
size() == 1) {
178 selectedTrack = tracks.
front();
182 if (!resolvedTracks || resolvedTracks->empty()) {
183 ATH_MSG_WARNING(
"Ambiguity resolver returned no tracks. Arbitrarily using the first track of initial collection.");
184 selectedTrack = tracks.
front();
187 if (it != tracks.
end()) {
190 ATH_MSG_ERROR(
"Ambiguity resolver returned an unknown track. Arbitrarily using the first track of initial collection.");
191 selectedTrack = tracks.
front();
196 std::vector<candidatePair>::iterator look_itr =
197 std::find_if(trackCandidateLookup.begin(), trackCandidateLookup.end(),
198 [selectedTrack](candidatePair& ele) { return ele.first.get() == selectedTrack; });
200 if (look_itr == trackCandidateLookup.end() || !look_itr->second) {
202 return {
nullptr,
nullptr};
207 return std::make_pair(std::move(look_itr->second), std::move(look_itr->first));
222 for (
const auto*
const vx : *vertices) {
223 for (
const auto& tpLink : vx->trackParticleLinks()) {
224 if (*tpLink == &idTrackParticle) {
228 if (matchedVertex)
break;
234 origin =
Amg::Vector3D{matchedVertex->
x(), matchedVertex->
y(), matchedVertex->
z()};
237 origin =
Amg::Vector3D{-idTrackParticle.
d0() * std::sin(idTrackParticle.
phi()) + idTrackParticle.
vx(),
238 idTrackParticle.
d0() * std::cos(idTrackParticle.
phi()) + idTrackParticle.
vy(),
239 idTrackParticle.
z0() + idTrackParticle.
vz()};
240 ATH_MSG_DEBUG(
" NO matched vertex take track perigee " << origin);
244 if (msgLevel(MSG::VERBOSE)) {
248 if (it->trackParameters()) {
249 ATH_MSG_VERBOSE(
"check tsos " << tsos <<
" r " << it->trackParameters()->position().perp() <<
" z "
250 << it->trackParameters()->position().z() <<
" p "
251 << it->trackParameters()->momentum().mag());
256 std::vector<const Muon::MuonSegment*> segLinks;
258 std::unique_ptr<Muon::MuonSegment> copy = std::make_unique<Muon::MuonSegment>(*layer.segment);
259 segLinks.push_back(copy.get());
265 ChIndex ch_a = m_idHelperSvc->chamberIndex(m_edmHelperSvc->chamberId(*seg_a));
266 ChIndex ch_b = m_idHelperSvc->chamberIndex(m_edmHelperSvc->chamberId(*seg_b));
267 StIndex st_a = toStationIndex(ch_a);
268 StIndex st_b = toStationIndex(ch_b);
269 if (st_a != st_b) return st_a < st_b;
271 if (ch_a == ChIndex::CSL || ch_a == ChIndex::CSS || ch_b == ChIndex::CSS || ch_b == ChIndex::CSL)
272 return (ch_a == ChIndex::CSL) + 2 * (ch_a == ChIndex::CSS) > (ch_b == ChIndex::CSL) + 2 * (ch_b == ChIndex::CSS);
276 if (msgLevel(MSG::DEBUG)) {
277 std::stringstream sstr;
283 ATH_MSG_DEBUG(
"Selected segments " << segLinks.size() <<
" " << sstr.str());
287 std::unique_ptr<Trk::Track> standaloneRefit{
m_trackFitter->standaloneRefit(ctx, *selectedTrack, origin)};
289 combTracks->
push_back(std::move(selectedTrack));
294 if (standaloneRefit) {
295 meTracks->
push_back(std::move(standaloneRefit));
297 tag->setUpdatedExtrapolatedTrack(melink);
301 tagMap->
addEntry(&indetCandidate, tag);
308 const std::set<TechnologyIndex>& technologiesInStation =
m_idHelperSvc->technologiesInStation(stIndex);
309 if (msgLevel(MSG::DEBUG)) {
310 std::string techString;
350 if (!layerPrepRawData.
mdts.empty())
msg(MSG::DEBUG) <<
" MDTs " << layerPrepRawData.
mdts.size();
351 if (!layerPrepRawData.
rpcs.empty())
msg(MSG::DEBUG) <<
" RPCs " << layerPrepRawData.
rpcs.size();
352 if (!layerPrepRawData.
tgcs.empty())
msg(MSG::DEBUG) <<
" TGCs " << layerPrepRawData.
tgcs.size();
353 if (!layerPrepRawData.
cscs.empty())
msg(MSG::DEBUG) <<
" CSCs " << layerPrepRawData.
cscs.size();
354 if (!layerPrepRawData.
stgcs.empty())
msg(MSG::DEBUG) <<
" STGCs " << layerPrepRawData.
stgcs.size();
355 if (!layerPrepRawData.
mms.empty())
msg(MSG::DEBUG) <<
" MMs " << layerPrepRawData.
mms.size();
365 if (!input || input->size() == 0)
return false;
373 if (hashes.empty())
return false;
376 for (Muon::MuonLayerHashProviderTool::HashVec::const_iterator it = hashes.begin(); it != hashes.end(); ++it) {
378 const auto* colIt = input->indexFindPtr(*it);
379 if (!colIt) {
continue; }
382 output.push_back(colIt);
384 return output.size();
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
DataVector< MuonCombined::InDetCandidate > InDetCandidateCollection
This typedef represents a collection of InDetCandidate objects.
DataVector< Trk::Track > TrackCollection
This typedef represents a collection of Trk::Track objects.
bool msgLvl(const MSG::Level lvl) const
value_type push_back(value_type pElem)
Add an element to the end of the collection.
DataModel_detail::iterator< DataVector > iterator
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
const T * front() const
Access the first element in the collection as an rvalue.
size_type size() const noexcept
Returns the number of elements in the collection.
bool empty() const noexcept
Returns true if the collection is empty.
ElementLink implementation for ROOT usage.
void addEntry(const InDetCandidate *idcand, TagBase *tag)
bool isSiliconAssociated() const
Returns true if this candidate was formed from a special far forward InDet track.
const xAOD::TrackParticle & indetTrackParticle() const
access TrackParticle
const Muon::MuonSystemExtension * getExtension() const
TagBase implementation for a combined fit.
Template to hold collections of MuonPrepRawData objects.
This is the common class for 3D segments used in the muon spectrometer.
Tracking class to hold the extrapolation from a particle from the calo entry to the end of muon syste...
const std::vector< Intersection > & layerIntersections() const
access to the intersections with the layers.
const_pointer_type ptr()
Dereference the pointer.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
represents the track state (measurement, material, fit parameters and quality) at a surface.
float z0() const
Returns the parameter.
float vx() const
The x origin for the parameters.
const Trk::Track * track() const
Returns a pointer (which can be NULL) to the Trk::Track which was used to make this TrackParticle.
virtual double phi() const override final
The azimuthal angle ( ) of the particle (has range to .)
float vz() const
The z origin for the parameters.
float vy() const
The y origin for the parameters.
float d0() const
Returns the parameter.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
float z() const
Returns the z position.
float y() const
Returns the y position.
float x() const
Returns the x position.
Eigen::Matrix< double, 3, 1 > Vector3D
The MuonTagToSegMap is an auxillary construct that links the MuonSegments associated with a combined ...
StIndex
enum to classify the different station layers in the muon spectrometer
const std::string & layerName(LayerIndex index)
convert LayerIndex into a string
TechnologyIndex
enum to classify the different layers in the muon spectrometer
StIndex toStationIndex(ChIndex index)
convert ChIndex into StIndex
unsigned int sectorLayerHash(DetectorRegionIndex detectorRegionIndex, LayerIndex layerIndex)
create a hash out of region and layer
const std::string & technologyName(TechnologyIndex index)
convert LayerIndex into a string
const std::string & chName(ChIndex index)
convert ChIndex into a string
const std::string & regionName(DetectorRegionIndex index)
convert DetectorRegionIndex into a string
MuonPrepDataContainer< MuonPrepDataCollection< PrdType > > MuonPrepDataContainerT
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
DataVector< Trk::Segment > SegmentCollection
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Vertex_v1 Vertex
Define the latest version of the vertex class.
const Muon::TgcPrepDataContainer * tgcPrds
const Muon::sTgcPrepDataContainer * stgcPrds
const Muon::RpcPrepDataContainer * rpcPrds
const Muon::CscPrepDataContainer * cscPrds
const Muon::MMPrepDataContainer * mmPrds
const Muon::MdtPrepDataContainer * mdtPrds
std::vector< MuonLayerIntersection > layerIntersections
MuonLayerIntersections.
Struct to hold all PrepRawData collections in a given layer.
std::vector< const CscPrepDataCollection * > cscs
std::vector< const MMPrepDataCollection * > mms
std::vector< const TgcPrepDataCollection * > tgcs
std::vector< const MdtPrepDataCollection * > mdts
std::vector< const RpcPrepDataCollection * > rpcs
std::vector< const sTgcPrepDataCollection * > stgcs