16 const IInterface* p ) :
58 return StatusCode::SUCCESS;
63 return StatusCode::SUCCESS;
70 const EventContext& ctx = Gaudi::Hive::currentContext();
81 unsigned int nJets(importedJets->size());
82 std::vector<const xAOD::Jet*> jetToCheck; jetToCheck.clear();
85 unsigned int nTracks = importedTrackParticles->size();
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;
93 std::vector<bool> maskTracks;
94 maskTracks.assign(nTracks,
false);
97 std::vector< bool > pfomaskNeutral( nPFONeutral,
false );
98 std::vector< bool > pfomaskCharged( nPFOCharged,
false );
103 unsigned int nUFOs(importedUFOs->size());
106 std::vector<bool> maskUFOs;
107 maskUFOs.assign(nUFOs,
false);
111 std::vector<int>
entries = m_parser->evaluateAsVector();
112 unsigned int nEntries =
entries.size();
114 if (nJets != nEntries ) {
115 ATH_MSG_ERROR(
"Sizes incompatible! Are you sure your selection string used jets??");
116 return StatusCode::FAILURE;
119 for (
unsigned int i=0; i<nJets; ++i)
if (
entries[i]==1) jetToCheck.push_back((*importedJets)[i]);
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;
136 maskTracks[index_trk] =
true;
141 for (
size_t n = 0; n < ufoO->
otherObjects().size(); ++n) {
143 if(index_pfo<0)
continue;
148 pfomaskCharged.at( index_pfo ) =
true;
151 pfomaskNeutral.at( index_pfo ) =
true;
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;
171 maskTracks[index_trk] =
true;
175 for (
size_t n = 0; n < ufoO->
otherObjects().size(); ++n) {
177 if(index_pfo<0)
continue;
182 pfomaskCharged.at( index_pfo ) =
true;
185 pfomaskNeutral.at( index_pfo ) =
true;
194 importedTrackParticles.
keep (maskTracks);
196 importedPFONeutral.
keep (pfomaskNeutral);
197 importedPFOCharged.
keep (pfomaskCharged);
198 importedUFOs.
keep (maskUFOs);
204 tempPFOCharged.
keep(pfomaskCharged);
205 tempPFONeutral.
keep(pfomaskNeutral);
208 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
Handle for requesting thinning for a data object.
SG::ReadHandleKey< xAOD::JetContainer > m_jetSGKey
virtual StatusCode doThinning() const override
SG::ThinningHandleKey< xAOD::TrackParticleContainer > m_inDetSGKey
virtual StatusCode finalize() override
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_tmpAddPFOChargedSGKey
StringProperty m_streamName
Gaudi::Property< std::vector< std::string > > m_addPFOSGKey
SG::ThinningHandleKey< xAOD::FlowElementContainer > m_PFONeutralSGKey
virtual ~UFOTrackParticleThinning()
SG::ThinningHandleKey< xAOD::FlowElementContainer > m_tmpAddPFONeutralSGKey
Gaudi::Property< std::string > m_PFOSGKey
virtual StatusCode initialize() override
std::vector< SG::ThinningHandleKey< xAOD::FlowElementContainer > > m_addPFONeutralSGKey
UFOTrackParticleThinning(const std::string &t, const std::string &n, const IInterface *p)
size_t index() const
Return the index of this element within its container.
void keep(size_t ndx)
Mark that index ndx in the container should be kept (not thinned away).
Handle for requesting thinning for a data object.
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".