19 #include "boost/bind.hpp" 20 #include <boost/ptr_container/ptr_vector.hpp> 95 typedef std::vector<edm::ParameterSet>
VPSet;
98 for ( VPSet::const_iterator builderPSet = builders.begin();
99 builderPSet != builders.end(); ++builderPSet ) {
106 const VPSet& modfiers = pset.
getParameter<VPSet>(
"modifiers");
107 for ( VPSet::const_iterator modfierPSet = modfiers.begin();
108 modfierPSet != modfiers.end(); ++modfierPSet) {
118 if ( pset.
exists(
"outputSelection") ) {
120 if ( !selection.empty() ) {
126 produces<reco::PFTauCollection>();
151 for (BuilderList::iterator builder =
builders_.begin();
153 builder->setup(evt, es);
155 for (ModifierList::iterator modifier =
modifiers_.begin();
157 modifier->setup(evt, es);
161 auto output = std::make_unique<reco::PFTauCollection>();
165 for(
auto const& jetRef : jets ) {
170 if ( jetRegionRef.
isNull() ) {
172 <<
"No jet region can be found for the current jet: " << jetRef.id();
175 std::vector<reco::PFCandidatePtr> jetCands = jetRef->getPFConstituents();
176 std::vector<reco::PFCandidatePtr> allRegionalCands = jetRegionRef->getPFConstituents();
178 std::sort(jetCands.begin(), jetCands.end());
179 std::sort(allRegionalCands.begin(), allRegionalCands.end());
181 std::vector<reco::PFCandidatePtr> uniqueRegionalCands;
185 if ( allRegionalCands.size() > jetCands.size() ) {
186 uniqueRegionalCands.reserve(allRegionalCands.size() - jetCands.size());
190 std::set_difference(allRegionalCands.begin(), allRegionalCands.end(),
191 jetCands.begin(), jetCands.end(),
192 std::back_inserter(uniqueRegionalCands));
195 const std::vector<reco::PFRecoTauChargedHadron>& chargedHadrons = (*chargedHadronAssoc)[jetRef];
198 const std::vector<reco::RecoTauPiZero>& piZeros = (*piZeroAssoc)[jetRef];
200 unsigned int nTausBuilt = 0;
201 for ( BuilderList::const_iterator builder =
builders_.begin();
209 output->insert(
output->end(), taus.begin(), taus.end());
210 nTausBuilt += taus.size();
213 for(
auto const&
tau : taus ) {
225 reco::PFTau nullTau(std::numeric_limits<int>::quiet_NaN(), jetRef->p4());
227 output->push_back(nullTau);
232 for ( reco::PFTauCollection::iterator
tau =
output->begin();
234 for ( ModifierList::const_iterator modifier =
modifiers_.begin();
240 for ( ModifierList::iterator modifier =
modifiers_.begin();
242 modifier->endEvent();
T getParameter(std::string const &) const
boost::ptr_vector< Modifier > ModifierList
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
edm::EDGetTokenT< reco::CandidateView > jet_token
~RecoTauProducer() override
def create(alignables, pedeDump, additionalData, outputFile, config)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
boost::ptr_vector< reco::PFTau > output_type
void setjetRef(const PFJetRef &)
RecoTauProducer(const edm::ParameterSet &pset)
unique_ptr< JetDefinition::Plugin > plugin
Abs< T >::type abs(const T &t)
edm::InputTag chargedHadronSrc_
bool isNull() const
Checks for null.
void produce(edm::Event &evt, const edm::EventSetup &es) override
edm::EDGetTokenT< reco::JetPiZeroAssociation > piZero_token
reco::tau::RecoTauModifierPlugin Modifier
edm::EDGetTokenT< reco::PFJetChargedHadronAssociation > chargedHadron_token
edm::EDGetTokenT< edm::Association< reco::PFJetCollection > > jetRegion_token
size_type size() const
Size of the RefVector.
reco::tau::RecoTauBuilderPlugin Builder
edm::InputTag jetRegionSrc_
boost::ptr_vector< Builder > BuilderList
T get(const Candidate &c)
std::unique_ptr< StringCutObjectSelector< reco::PFTau > > outputSelector_