69{
70 const EventContext& ctx = Gaudi::Hive::currentContext();
71
72
73 SG::ThinningHandle<xAOD::TrackParticleContainer> importedTrackParticles
75 SG::ReadHandle<xAOD::TrackParticleContainer> tracks(
m_inDetSGKey,ctx);
76
77
78 unsigned int nTracks = importedTrackParticles->size();
79 if (nTracks==0) return StatusCode::SUCCESS;
80
81
82 std::vector<bool>
mask;
83 mask.assign(nTracks,
false);
85
86
87
88 SG::ReadHandle<xAOD::JetContainer> importedJets(
m_jetKey,ctx);
89 if (!importedJets.isValid()) {
91 return StatusCode::FAILURE;
92 }
93 unsigned int nJets(importedJets->size());
94 std::vector<const xAOD::Jet*> jetToCheck; jetToCheck.clear();
95
96
100
101 if (nJets != nEntries ) {
102 ATH_MSG_ERROR(
"Sizes incompatible! Are you sure your selection string used jets??");
103 return StatusCode::FAILURE;
104 } else {
105
106 for (
unsigned int i=0;
i<nJets; ++
i)
if (
entries[i]==1) jetToCheck.push_back((*importedJets)[i]);
107 }
108 }
109
110
111
113
116 const std::vector< ElementLink<DataVector<xAOD::IParticle> > > &jetTrackLinks = ghostTrackLRT( **jetIt );
117 for (const auto &jetTrkIt : jetTrackLinks) {
121 }
122 }
123 } else {
124 for (std::vector<const xAOD::Jet*>::const_iterator jetIt=jetToCheck.begin(); jetIt!=jetToCheck.end(); ++jetIt) {
125 const std::vector< ElementLink<DataVector<xAOD::IParticle> > > &jetTrackLinks = ghostTrackLRT( **jetIt );
126 for (const auto &jetTrkIt : jetTrackLinks) {
130 }
131 }
132 }
133
134
138
139 if (nTracks != nEntries ) {
140 ATH_MSG_ERROR(
"Sizes incompatible! Are you sure your track selection string used tracks??");
141 return StatusCode::FAILURE;
142 } else {
143
146 }
147 }
148 }
149
150
151 unsigned int n_pass=0;
152 for (
unsigned int i=0;
i<nTracks; ++
i) {
153 if (mask[i]) ++n_pass;
154 }
156
157
158 importedTrackParticles.keep (mask);
159
160 return StatusCode::SUCCESS;
161}
DataModel_detail::const_iterator< DataVector > const_iterator
std::atomic< unsigned int > m_npass
std::atomic< unsigned int > m_ntot
StringProperty m_selectionString
SG::ThinningHandleKey< xAOD::TrackParticleContainer > m_inDetSGKey
SG::ReadHandleKey< xAOD::JetContainer > m_jetKey
StringProperty m_trackSelectionString
SG::ConstAccessor< T, ALLOC > ConstAccessor
size_t index() const
Return the index of this element within its container.
TrackParticle_v1 TrackParticle
Reference the current persistent version: