68{
69
70 const EventContext& ctx = Gaudi::Hive::currentContext();
71
72
73 SG::ThinningHandle<xAOD::TrackParticleContainer> importedTrackParticles(
m_inDetSGKey, ctx);
74
75
76 SG::ThinningHandle<xAOD::FlowElementContainer> importedPFONeutral(
m_PFONeutralSGKey, ctx);
77 SG::ThinningHandle<xAOD::FlowElementContainer> importedPFOCharged(
m_PFOChargedSGKey, ctx);
78
79
80 SG::ReadHandle<xAOD::JetContainer> importedJets(
m_jetSGKey);
81 unsigned int nJets(importedJets->size());
82 std::vector<const xAOD::Jet*> jetToCheck; jetToCheck.clear();
83
84
85 unsigned int nTracks = importedTrackParticles->size();
86
87 const size_t nPFONeutral = importedPFONeutral->size();
88 const size_t nPFOCharged = importedPFOCharged->size() ;
89 unsigned int nPFOs = nPFOCharged + nPFONeutral;
90 if (nPFOs==0 && nTracks==0) return StatusCode::SUCCESS;
91
92
93 std::vector<bool> maskTracks;
94 maskTracks.assign(nTracks,false);
95
96
97 std::vector< bool > pfomaskNeutral( nPFONeutral, false );
98 std::vector< bool > pfomaskCharged( nPFOCharged, false );
99
100
101
102 SG::ThinningHandle<xAOD::FlowElementContainer> importedUFOs(
m_ufoSGKey, ctx);
103 unsigned int nUFOs(importedUFOs->size());
104
105
106 std::vector<bool> maskUFOs;
107 maskUFOs.assign(nUFOs,false);
108
109
111 std::vector<int>
entries = m_parser->evaluateAsVector();
113
114 if (nJets != nEntries ) {
115 ATH_MSG_ERROR(
"Sizes incompatible! Are you sure your selection string used jets??");
116 return StatusCode::FAILURE;
117 } else {
118
119 for (
unsigned int i=0;
i<nJets; ++
i)
if (
entries[i]==1) jetToCheck.push_back((*importedJets)[i]);
120 }
121 }
122
124 for(const auto *jet : *importedJets){
125 for( size_t j = 0; j < jet->numConstituents(); ++j ) {
126 auto ufo = jet->constituentLinks().at(j);
127 int index = ufo.index();
128 maskUFOs[
index] =
true;
130 if(!ufoO) continue;
131
132
135 if(index_trk>=0) {
136 maskTracks[index_trk] = true;
137 }
138 }
139
140
143 if(index_pfo<0) continue;
144
146
148 pfomaskCharged.at( index_pfo ) = true;
149 }
151 pfomaskNeutral.at( index_pfo ) = true;
152 }
153 }
154 }
155 }
156
157 } else {
158
159 for (auto & jetIt : jetToCheck) {
160 for( size_t j = 0; j < jetIt->numConstituents(); ++j ) {
161 auto ufo = jetIt->constituentLinks().at(j);
162 int index = ufo.index();
163 maskUFOs[
index] =
true;
164
166 if(!ufoO) continue;
167
170 if(index_trk>=0) {
171 maskTracks[index_trk] = true;
172 }
173 }
174
177 if(index_pfo<0) continue;
178
180
182 pfomaskCharged.at( index_pfo ) = true;
183 }
185 pfomaskNeutral.at( index_pfo ) = true;
186 }
187 }
188 }
189 }
190 }
191
192
194 importedTrackParticles.keep (maskTracks);
195 }
196 importedPFONeutral.keep (pfomaskNeutral);
197 importedPFOCharged.keep (pfomaskCharged);
198 importedUFOs.keep (maskUFOs);
199
203
204 tempPFOCharged.keep(pfomaskCharged);
205 tempPFONeutral.keep(pfomaskNeutral);
206 }
207
208 return StatusCode::SUCCESS;
209}
SG::ReadHandleKey< xAOD::JetContainer > m_jetSGKey
SG::ThinningHandleKey< xAOD::TrackParticleContainer > m_inDetSGKey
StringProperty m_selectionString
SG::ThinningHandleKey< xAOD::FlowElementContainer > m_PFOChargedSGKey
std::vector< SG::ThinningHandleKey< xAOD::FlowElementContainer > > m_addPFOChargedSGKey
Gaudi::Property< bool > m_thinTracks
SG::ThinningHandleKey< xAOD::FlowElementContainer > m_ufoSGKey
SG::ThinningHandleKey< xAOD::FlowElementContainer > m_PFONeutralSGKey
std::vector< SG::ThinningHandleKey< xAOD::FlowElementContainer > > m_addPFONeutralSGKey
size_t index() const
Return the index of this element within its container.
std::vector< const xAOD::IParticle * > otherObjects() const
signal_t signalType() const
const xAOD::IParticle * chargedObject(std::size_t i) const
const xAOD::IParticle * otherObject(std::size_t i) const
FlowElement_v1 FlowElement
Definition of the current "pfo version".