17 #include "GaudiKernel/ThreadLocalContext.h"
24 const IInterface*
p ) :
37 ATH_CHECK( m_inDetSGKey.initialize (m_streamName) );
38 ATH_MSG_INFO(
"Using " << m_inDetSGKey.key() <<
"as the source collection for inner detector track particles");
39 if (m_muonKey.key().empty()) {
41 return StatusCode::FAILURE;
42 }
else {
ATH_MSG_INFO(
"Inner detector track particles associated with objects in " << m_muonKey.key() <<
" will be retained in this format with the rest being thinned away");}
45 if (!m_selectionString.empty()) {
46 ATH_CHECK(initializeParser(m_selectionString) );
48 return StatusCode::SUCCESS;
54 ATH_MSG_INFO(
"Processed "<< m_ntot <<
" tracks, "<< m_npass<<
" were retained ");
56 return StatusCode::SUCCESS;
62 const EventContext& ctx = Gaudi::Hive::currentContext();
69 unsigned int nTracks = importedTrackParticles->size();
70 if (nTracks==0)
return StatusCode::SUCCESS;
73 std::vector<bool>
mask;
74 mask.assign(nTracks,
false);
81 ATH_MSG_ERROR(
"No muon collection with name " << m_muonKey.key() <<
" found in StoreGate!");
82 return StatusCode::FAILURE;
84 unsigned int nMuons(importedMuons->
size());
85 std::vector<const xAOD::Muon*> muToCheck; muToCheck.clear();
87 if (m_selectionString!=
"") {
88 std::vector<int>
entries = m_parser->evaluateAsVector();
92 ATH_MSG_ERROR(
"Sizes incompatible! Are you sure your selection string used muons??");
93 return StatusCode::FAILURE;
96 for (
unsigned int i=0;
i<nMuons; ++
i)
if (
entries[
i]==1) muToCheck.push_back((*importedMuons)[
i]);
101 if (m_selectionString==
"") {
102 for (
const auto *muIt : *importedMuons) {
103 if (muIt->inDetTrackParticleLink().isValid()) {
106 if (muIt->muonType()==xAOD::Muon::SiliconAssociatedForwardMuon && m_inDetSGKey.key() !=
"InDetForwardTrackParticles")
108 ATH_MSG_DEBUG(
"Skipping Forward Muon since we are not skimming InDetForwardParticles");
111 ATH_MSG_DEBUG(
"Simming Muon tracks in " << m_inDetSGKey <<
" "<< muIt->muonType());
112 int index = muIt->inDetTrackParticleLink().index();
116 if (m_coneSize>0.0) tInC.
select(muIt,m_coneSize,importedTrackParticles.cptr(),
mask);
119 for (
auto & muIt : muToCheck) {
120 if (muIt->inDetTrackParticleLink().isValid()) {
122 if (muIt->muonType()==xAOD::Muon::SiliconAssociatedForwardMuon && m_inDetSGKey.key() !=
"InDetForwardTrackParticles")
124 ATH_MSG_DEBUG(
"Skipping Forward Muon since we are not skimming InDetForwardParticles");
127 ATH_MSG_DEBUG(
"Simming Muon tracks in " << m_inDetSGKey <<
" "<< muIt->muonType());
128 int index = muIt->inDetTrackParticleLink().index();
132 if (m_coneSize>0.0) tInC.
select(muIt,m_coneSize,importedTrackParticles.cptr(),
mask);
137 unsigned int n_pass=0;
138 for (
unsigned int i=0;
i<nTracks; ++
i) {
139 if (
mask[
i]) ++n_pass;
145 return StatusCode::SUCCESS;