16 const IInterface* p ) :
58 return StatusCode::SUCCESS;
63 return StatusCode::SUCCESS;
80 unsigned int nJets(importedJets->size());
81 std::vector<const xAOD::Jet*> jetToCheck; jetToCheck.clear();
84 unsigned int nTracks = importedTrackParticles->size();
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;
92 std::vector<bool> maskTracks;
93 maskTracks.assign(nTracks,
false);
96 std::vector< bool > pfomaskNeutral( nPFONeutral,
false );
97 std::vector< bool > pfomaskCharged( nPFOCharged,
false );
102 unsigned int nUFOs(importedUFOs->size());
105 std::vector<bool> maskUFOs;
106 maskUFOs.assign(nUFOs,
false);
110 std::vector<int>
entries = m_parser->evaluateAsVector();
111 unsigned int nEntries =
entries.size();
113 if (nJets != nEntries ) {
114 ATH_MSG_ERROR(
"Sizes incompatible! Are you sure your selection string used jets??");
115 return StatusCode::FAILURE;
118 for (
unsigned int i=0; i<nJets; ++i)
if (
entries[i]==1) jetToCheck.push_back((*importedJets)[i]);
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;
135 maskTracks[index_trk] =
true;
142 if(index_pfo<0)
continue;
147 pfomaskCharged.at( index_pfo ) =
true;
150 pfomaskNeutral.at( index_pfo ) =
true;
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;
170 maskTracks[index_trk] =
true;
176 if(index_pfo<0)
continue;
181 pfomaskCharged.at( index_pfo ) =
true;
184 pfomaskNeutral.at( index_pfo ) =
true;
193 importedTrackParticles.
keep (maskTracks);
195 importedPFONeutral.
keep (pfomaskNeutral);
196 importedPFOCharged.
keep (pfomaskCharged);
197 importedUFOs.
keep (maskUFOs);
203 tempPFOCharged.
keep(pfomaskCharged);
204 tempPFONeutral.
keep(pfomaskNeutral);
207 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
size_t size() const
Number of registered mappings.
Handle for requesting thinning for a data object.
SG::ReadHandleKey< xAOD::JetContainer > m_jetSGKey
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
virtual StatusCode doThinning(const EventContext &ctx) const override
std::vector< SG::ThinningHandleKey< xAOD::FlowElementContainer > > m_addPFONeutralSGKey
UFOTrackParticleThinning(const std::string &t, const std::string &n, const IInterface *p)
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".