9 #include <ext/functional>
23 declareInterface<IAmbiTrackSelectionTool>(
this);
32 return StatusCode::SUCCESS;
39 unsigned int numshared{0}, numhits{0}, numPhiHits{0};
42 return std::make_tuple(
nullptr,
false);
46 ATH_MSG_VERBOSE(
"trackId " << trackId <<
", subtrackId " << subtrackId);
48 std::map<Muon::MuonStationIndex::StIndex, int> sharedPrecisionPerLayer;
49 std::map<Muon::MuonStationIndex::StIndex, int> precisionPerLayer;
50 auto is_shared = [&sharedPrecisionPerLayer, &precisionPerLayer,
this, &numshared, &numhits, &prd_to_track_map,
52 if (!rot || !rot->prepRawData())
return;
53 const Identifier rot_id = rot->prepRawData()->identify();
54 numPhiHits += m_idHelperSvc->isMuon(rot_id) && m_idHelperSvc->measuresPhi(rot_id);
55 if (!m_idHelperSvc->isMdt(rot_id) && !m_idHelperSvc->isMM(rot_id) && !m_idHelperSvc->issTgc(rot_id) &&
56 (!m_idHelperSvc->isCsc(rot_id) || m_idHelperSvc->measuresPhi(rot_id))) {
57 ATH_MSG_VERBOSE(
"Measurement " << m_printer->print(*rot) <<
" is not a precision one");
61 ++precisionPerLayer[stIndex];
63 if (!prd_to_track_map.isUsed(*(rot->prepRawData()))) {
return; }
65 ATH_MSG_VERBOSE(
"Track overlap found! " << m_idHelperSvc->toString(rot_id));
67 ++sharedPrecisionPerLayer[stIndex];
83 for (
unsigned int i = 0;
i < numROTs; ++
i) {
96 << m_printer->printMeasurements(*
track));
97 return std::make_tuple(
nullptr,
false);
99 const double overlapFraction = (
double)numshared / (
double)numhits;
101 ATH_MSG_VERBOSE(
"Track " << m_printer->print(*
track) <<
" has " << numhits <<
" hit, shared " << numshared <<
" overlap fraction "
102 << overlapFraction <<
" layers " << precisionPerLayer.size() <<
" shared " << sharedPrecisionPerLayer.size());
104 if (overlapFraction > m_maxOverlapFraction) {
106 if (sharedPrecisionPerLayer.empty()) {
107 ATH_MSG_DEBUG(
"Track is not sharing precision hits, keeping ");
108 return std::make_tuple(
nullptr,
true);
110 if (overlapFraction < 0.25 && precisionPerLayer.size() > 2 && precisionPerLayer.size() - sharedPrecisionPerLayer.size() == 1) {
111 ATH_MSG_DEBUG(
"Three station track differing by one precision layer, keeping ");
112 return std::make_tuple(
nullptr,
true);
114 if (overlapFraction < 0.35 && precisionPerLayer.size() > 2 && precisionPerLayer.size() - sharedPrecisionPerLayer.size() > 1 &&
116 ATH_MSG_DEBUG(
"Three station track differing by more than one precision layer, keeping ");
117 return std::make_tuple(
nullptr,
true);
120 return std::make_tuple(
nullptr,
false);
123 return std::make_tuple(
nullptr,
true);