26#include "Gaudi/Property.h"
37 const std::string& name,
38 ISvcLocator* pSvcLocator)
55 ATH_MSG_INFO(
"InDetForwardTrackParticles thinning not required");
57 ATH_MSG_INFO(
"InDetForwardTrackParticles will be thinned");
62 return StatusCode::FAILURE;
66 ATH_MSG_DEBUG(
"==> done with initialize " << name() <<
"...");
68 return StatusCode::SUCCESS;
78 <<
" were SiliconAssociatedForward muons");
80 <<
" of the SiliconAssociatedForward muons were "
81 "associated with InDetForwardTrackParticles");
83 return StatusCode::SUCCESS;
94 return StatusCode::SUCCESS;
101 std::vector<bool> trackMask;
102 unsigned int nTracks = tracks->size();
104 trackMask.assign(nTracks,
false);
106 unsigned int nSiFwdAssoc = 0;
107 unsigned int nSiFwdMuons = 0;
116 m_nMuons.fetch_add(muons->size(), std::memory_order_relaxed);
118 for (
const auto* muon : *muons) {
119 if (muon->muonType() == xAOD::Muon::MuonType::SiliconAssociatedForwardMuon) {
121 const xAOD::TrackParticle* muTrk = muon->trackParticle(xAOD::Muon::TrackParticleType::InnerDetectorTrackParticle);
123 if (muTrk !=
nullptr) {
124 auto search = std::find(tracks->begin(), tracks->end(), muTrk);
125 if (
search != tracks->end()) {
127 trackMask[(*search)->index()] =
true;
134 m_nSiFwdAssoc.fetch_add(nSiFwdAssoc, std::memory_order_relaxed);
135 m_nSiFwdMuons.fetch_add(nSiFwdMuons, std::memory_order_relaxed);
138 unsigned int nTracksThinned = 0;
139 for (
unsigned int i = 0; i < nTracks; ++i) {
145 tracks.
keep(trackMask);
147 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
Handle class for reading from StoreGate.
Handle for requesting thinning for a data object.
An algorithm that can be simultaneously executed in multiple threads.
void keep(size_t ndx)
Mark that index ndx in the container should be kept (not thinned away).
Handle for requesting thinning for a data object.
std::atomic< unsigned long > m_nSiFwdAssoc
std::atomic< unsigned long > m_nEventsProcessed
Counters.
std::atomic< unsigned long > m_nTracksThinned
StringProperty m_streamName
ThinInDetForwardTrackParticlesAlg(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
virtual StatusCode initialize() override
Athena algorithm's initalize hook.
std::atomic< unsigned long > m_nSiFwdMuons
SG::ThinningHandleKey< xAOD::TrackParticleContainer > m_tracksKey
virtual StatusCode execute(const EventContext &ctx) const override
Athena algorithm's execute hook.
virtual StatusCode finalize() override
Athena algorithm's finalize hook.
std::atomic< unsigned long > m_nMuons
SG::ReadHandleKey< xAOD::MuonContainer > m_muonsKey
std::atomic< unsigned long > m_nTracksProcessed
BooleanProperty m_doThinning
Should the thinning run?
void search(TDirectory *td, const std::string &s, std::string cwd, node *n)
recursive directory search for TH1 and TH2 and TProfiles
TrackParticle_v1 TrackParticle
Reference the current persistent version: