109{
110 const EventContext& ctx = Gaudi::Hive::currentContext();
111 SG::ThinningHandle<xAOD::TrackParticleContainer> importedGSFTrackParticles(
113
114
115 std::unique_ptr<SG::ThinningHandle<xAOD::TrackParticleContainer>>
116 importedTrackParticles = nullptr;
118 importedTrackParticles =
119 std::make_unique<SG::ThinningHandle<xAOD::TrackParticleContainer>>(
121 }
122
123
125 ? importedTrackParticles->cptr()
126 : nullptr;
128 unsigned int nTracks = tps ? tps->
size() : 0;
129 unsigned int nGSF = gsfs->
size();
130
131 ATH_MSG_DEBUG(
"nTracks : " << nTracks <<
" , nGSF : " << nGSF);
132 if (nTracks == 0 && nGSF == 0) {
134 return StatusCode::SUCCESS;
135 }
136
137
138 std::vector<bool>
mask, gsfMask;
139 mask.assign(nTracks,
false);
140 gsfMask.assign(nGSF, false);
143
144
145 SG::ReadHandle<xAOD::EgammaContainer> importedEgamma(
m_egammaKey, ctx);
146 if (!importedEgamma.isValid()) {
148 << " found in StoreGate!");
149 return StatusCode::FAILURE;
150 }
151
152 size_t nEgammas(importedEgamma->size());
156 if (nEgammas != 0) {
158
159 if (doSelect) {
160 std::vector<int>
entries = m_parser->evaluateAsVector();
162
163 if (nEgammas != nEntries) {
164 ATH_MSG_ERROR(
"Sizes incompatible! Are you sure your selection string "
165 "used e-gamma objects??");
166 return StatusCode::FAILURE;
167 } else {
168
169 for (
unsigned int i = 0;
i < nEgammas; ++
i)
171 tofill.push_back(importedEgamma->at(i));
172 }
173 }
175 ? tofill.asDataVector() : importedEgamma.cptr();
178
183 else
185 "nor for Photons ??");
186 }
189 }
190
191
192 unsigned int n_pass = 0;
193 for (
unsigned int i = 0;
i < nTracks; ++
i) {
194 if (mask[i]) {
195 ++n_pass;
196 }
197 }
199 unsigned int n_gsf_pass = 0;
200 for (
unsigned int i = 0;
i < nGSF; ++
i) {
201 if (gsfMask[i]) {
202 ++n_gsf_pass;
203 }
204 }
206
207
208 importedGSFTrackParticles.keep(gsfMask);
209 if (tps) {
210 importedTrackParticles->keep(mask);
211 }
212
213 return StatusCode::SUCCESS;
214}
#define ATH_MSG_WARNING(x)
SG::ThinningHandleKey< xAOD::TrackParticleContainer > m_inDetSGKey
SG::ThinningHandleKey< xAOD::TrackParticleContainer > m_gsfSGKey
std::atomic< unsigned long int > m_nGSFPass
std::atomic< unsigned long int > m_ntot
std::atomic< unsigned long int > m_nEgammas
std::atomic< unsigned long int > m_ntotGSF
void clearGSFVtx(const EventContext &ctx) const
void setPhotonMasks(std::vector< bool > &, std::vector< bool > &, const xAOD::EgammaContainer *, const xAOD::TrackParticleContainer *, const xAOD::TrackParticleContainer *) const
StringProperty m_selectionString
void setElectronMasks(std::vector< bool > &, std::vector< bool > &, const xAOD::EgammaContainer *, const xAOD::TrackParticleContainer *, const xAOD::TrackParticleContainer *) const
std::atomic< unsigned long int > m_nSelEgammas
std::atomic< unsigned long int > m_npass
SG::ReadHandleKey< xAOD::EgammaContainer > m_egammaKey
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
PhotonContainer_v1 PhotonContainer
Definition of the current "photon container version".
ElectronContainer_v1 ElectronContainer
Definition of the current "electron container version".
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
EgammaContainer_v1 EgammaContainer
Definition of the current "egamma container version".