66 return StatusCode::FAILURE;
71 std::vector<MuonPassDecor> mu_passFlags;
75 KeepMap thin_decisions;
76 std::vector<std::unique_ptr<TrkThinning>> TrkContainers;
79 auto make_handle = [&,
this](
const TrkThinKey& key) {
82 return StatusCode::SUCCESS;
84 ATH_MSG_DEBUG(
"Create new thinning handle " << key.fullKey());
85 TrkContainers.emplace_back(std::make_unique<TrkThinning>(key, ctx));
87 std::unique_ptr<TrkThinning>& last = TrkContainers.back();
88 if (!last->isValid()) {
89 ATH_MSG_FATAL(
"Failed to create a track thinning handle " << key.fullKey());
90 return StatusCode::FAILURE;
93 thin_decisions[cont].resize(cont->
size(),
false);
94 return StatusCode::SUCCESS;
105 std::unique_ptr<SegmentThinning> segmentContainer =
107 std::vector<bool> keep_seg(segmentContainer ? segmentContainer->cptr()->size() : 0,
false);
113 ATH_MSG_DEBUG(
"Check muon with pt " << muon->pt() * MeVtoGeV <<
" [GeV], eta: " << muon->eta() <<
", phi: " << muon->phi() <<
" q: " << muon->charge()
114 <<
" quality: " << muon->quality() <<
", author: " << muon->author());
117 std::find_if(mu_passFlags.begin(), mu_passFlags.end(),
118 [
this, muon](
const MuonPassDecor& decor) ->bool {
119 ATH_MSG_VERBOSE(
"Check decorator "<<decor.decorKey()<<
" "
120 <<SG::AuxTypeRegistry::instance().getName(decor.auxid())
121 <<
" "<< decor(*muon));
123 }) == mu_passFlags.end())
125 keep_muo[muon->index()] =
true;
130 {xAOD::Muon::InnerDetectorTrackParticle, xAOD::Muon::MuonSpectrometerTrackParticle, xAOD::Muon::CombinedTrackParticle,
131 xAOD::Muon::ExtrapolatedMuonSpectrometerTrackParticle, xAOD::Muon::MSOnlyExtrapolatedMuonSpectrometerTrackParticle}) {
137 KeepMap::iterator itr = std::find_if(thin_decisions.begin(), thin_decisions.end(),
138 [track](
const KeepPair&
pair) { return pair.first == track->container(); });
139 if (itr == thin_decisions.end()) {
140 ATH_MSG_WARNING(
"Could not find for track pT " << track->pt() <<
" eta: " << track->eta() <<
", phi: " << track->phi()
141 <<
" a valid associated container");
144 itr->second[track->index()] =
true;
147 if (segmentContainer) {
148 for (
size_t s = 0; s < muon->nMuonSegments(); ++s) {
150 if (seg) keep_seg[seg->
index()] =
true;
157 TrackPassDecor handle{key, ctx};
160 std::vector<bool>& trk_thin = thin_decisions[trks];
163 if (!trks->
empty() && trk_thin.empty()) {
164 ATH_MSG_WARNING(
"The container " << key.fullKey() <<
" is not part of the current thinning scheme. Please check");
169 if (handle(*trk)) trk_thin[trk->index()] =
true;
175 for (std::unique_ptr<TrkThinning>& thin : TrkContainers) {
176 std::vector<bool>& dec = thin_decisions[thin->cptr()];
179 if (segmentContainer) { segmentContainer->keep(keep_seg); }
181 return StatusCode::SUCCESS;