68{
69
70
71
72 SG::ThinningHandle<xAOD::TrackParticleContainer> importedTrackParticles(
m_inDetSGKey, ctx);
73
74
75 SG::ThinningHandle<xAOD::FlowElementContainer> importedPFONeutral(
m_PFONeutralSGKey, ctx);
76 SG::ThinningHandle<xAOD::FlowElementContainer> importedPFOCharged(
m_PFOChargedSGKey, ctx);
77
78
79 SG::ReadHandle<xAOD::JetContainer> importedJets(
m_jetSGKey, ctx);
80 unsigned int nJets(importedJets->size());
81 std::vector<const xAOD::Jet*> jetToCheck; jetToCheck.clear();
82
83
84 unsigned int nTracks = importedTrackParticles->size();
85
86 const size_t nPFONeutral = importedPFONeutral->size();
87 const size_t nPFOCharged = importedPFOCharged->size() ;
88 unsigned int nPFOs = nPFOCharged + nPFONeutral;
89 if (nPFOs==0 && nTracks==0) return StatusCode::SUCCESS;
90
91
92 std::vector<bool> maskTracks;
93 maskTracks.assign(nTracks,false);
94
95
96 std::vector< bool > pfomaskNeutral( nPFONeutral, false );
97 std::vector< bool > pfomaskCharged( nPFOCharged, false );
98
99
100
101 SG::ThinningHandle<xAOD::FlowElementContainer> importedUFOs(
m_ufoSGKey, ctx);
102 unsigned int nUFOs(importedUFOs->size());
103
104
105 std::vector<bool> maskUFOs;
106 maskUFOs.assign(nUFOs,false);
107
108
110 std::vector<int>
entries = m_parser->evaluateAsVector();
112
113 if (nJets != nEntries ) {
114 ATH_MSG_ERROR(
"Sizes incompatible! Are you sure your selection string used jets??");
115 return StatusCode::FAILURE;
116 } else {
117
118 for (
unsigned int i=0;
i<nJets; ++
i)
if (
entries[i]==1) jetToCheck.push_back((*importedJets)[i]);
119 }
120 }
121
123 for(const auto *jet : *importedJets){
124 for(
size_t j = 0;
j < jet->numConstituents(); ++
j ) {
125 auto ufo = jet->constituentLinks().at(j);
126 int index = ufo.index();
127 maskUFOs[
index] =
true;
129 if(!ufoO) continue;
130
131
134 if(index_trk>=0) {
135 maskTracks[index_trk] = true;
136 }
137 }
138
139
142 if(index_pfo<0) continue;
143
145
147 pfomaskCharged.at( index_pfo ) = true;
148 }
150 pfomaskNeutral.at( index_pfo ) = true;
151 }
152 }
153 }
154 }
155
156 } else {
157
158 for (auto & jetIt : jetToCheck) {
159 for(
size_t j = 0;
j < jetIt->numConstituents(); ++
j ) {
160 auto ufo = jetIt->constituentLinks().at(j);
161 int index = ufo.index();
162 maskUFOs[
index] =
true;
163
165 if(!ufoO) continue;
166
169 if(index_trk>=0) {
170 maskTracks[index_trk] = true;
171 }
172 }
173
176 if(index_pfo<0) continue;
177
179
181 pfomaskCharged.at( index_pfo ) = true;
182 }
184 pfomaskNeutral.at( index_pfo ) = true;
185 }
186 }
187 }
188 }
189 }
190
191
193 importedTrackParticles.keep (maskTracks);
194 }
195 importedPFONeutral.keep (pfomaskNeutral);
196 importedPFOCharged.keep (pfomaskCharged);
197 importedUFOs.keep (maskUFOs);
198
202
203 tempPFOCharged.keep(pfomaskCharged);
204 tempPFONeutral.keep(pfomaskNeutral);
205 }
206
207 return StatusCode::SUCCESS;
208}
size_t size() const
Number of registered mappings.
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
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
float j(const xAOD::IParticle &, const xAOD::TrackMeasurementValidation &hit, const Eigen::Matrix3d &jab_inv)
FlowElement_v1 FlowElement
Definition of the current "pfo version".