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 std::size_t
index = ufo.index();
127 maskUFOs.at(index) = true;
129 if(!ufoO) continue;
130
131
134 maskTracks.at(index_trk) = true;
135 }
136
137
139 std::size_t index_pfo = ufoO->
otherObject(n)->index();
140
142
144 pfomaskCharged.at( index_pfo ) = true;
145 }
147 pfomaskNeutral.at( index_pfo ) = true;
148 }
149 }
150 }
151 }
152
153 } else {
154
155 for (auto & jetIt : jetToCheck) {
156 for(
size_t j = 0;
j < jetIt->numConstituents(); ++
j ) {
157 auto ufo = jetIt->constituentLinks().at(j);
158 std::size_t
index = ufo.index();
159 maskUFOs.at(index) = true;
160
162 if(!ufoO) continue;
163
166 maskTracks.at(index_trk) = true;
167
168 }
169
171 std::size_t index_pfo = ufoO->
otherObject(n)->index();
172
174
176 pfomaskCharged.at( index_pfo ) = true;
177 }
179 pfomaskNeutral.at( index_pfo ) = true;
180 }
181 }
182 }
183 }
184 }
185
186
188 importedTrackParticles.keep (maskTracks);
189 }
190 importedPFONeutral.keep (pfomaskNeutral);
191 importedPFOCharged.keep (pfomaskCharged);
192 importedUFOs.keep (maskUFOs);
193
197
198 tempPFOCharged.keep(pfomaskCharged);
199 tempPFONeutral.keep(pfomaskNeutral);
200 }
201
202 return StatusCode::SUCCESS;
203}
#define ATH_MSG_ERROR(x,...)
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".