109{
110 SG::ThinningHandle<xAOD::TrackParticleContainer> importedGSFTrackParticles(
112
113
114 std::unique_ptr<SG::ThinningHandle<xAOD::TrackParticleContainer>>
115 importedTrackParticles = nullptr;
117 importedTrackParticles =
118 std::make_unique<SG::ThinningHandle<xAOD::TrackParticleContainer>>(
120 }
121
122
124 ? importedTrackParticles->cptr()
125 : nullptr;
127 unsigned int nTracks = tps ? tps->
size() : 0;
128 unsigned int nGSF = gsfs->
size();
129
130 ATH_MSG_DEBUG(
"nTracks : " << nTracks <<
" , nGSF : " << nGSF);
131 if (nTracks == 0 && nGSF == 0) {
133 return StatusCode::SUCCESS;
134 }
135
136
137 std::vector<bool>
mask, gsfMask;
138 mask.assign(nTracks,
false);
139 gsfMask.assign(nGSF, false);
142
143
144 SG::ReadHandle<xAOD::EgammaContainer> importedEgamma(
m_egammaKey, ctx);
145 if (!importedEgamma.isValid()) {
147 << " found in StoreGate!");
148 return StatusCode::FAILURE;
149 }
150
151 size_t nEgammas(importedEgamma->size());
155 if (nEgammas != 0) {
157
158 if (doSelect) {
159 std::vector<int>
entries = m_parser->evaluateAsVector();
161
162 if (nEgammas != nEntries) {
163 ATH_MSG_ERROR(
"Sizes incompatible! Are you sure your selection string "
164 "used e-gamma objects??");
165 return StatusCode::FAILURE;
166 } else {
167
168 for (
unsigned int i = 0;
i < nEgammas; ++
i)
170 tofill.push_back(importedEgamma->at(i));
171 }
172 }
174 ? tofill.asDataVector() : importedEgamma.cptr();
177
182 else
184 "nor for Photons ??");
185 }
188 }
189
190
191 unsigned int n_pass = 0;
192 for (
unsigned int i = 0;
i < nTracks; ++
i) {
193 if (mask[i]) {
194 ++n_pass;
195 }
196 }
198 unsigned int n_gsf_pass = 0;
199 for (
unsigned int i = 0;
i < nGSF; ++
i) {
200 if (gsfMask[i]) {
201 ++n_gsf_pass;
202 }
203 }
205
206
207 importedGSFTrackParticles.keep(gsfMask);
208 if (tps) {
209 importedTrackParticles->keep(mask);
210 }
211
212 return StatusCode::SUCCESS;
213}
#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(const EventContext &ctx, 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".