19 #include "boost/bind.hpp"
20 #include <boost/ptr_container/ptr_vector.hpp>
21 #include <boost/foreach.hpp>
96 typedef std::vector<edm::ParameterSet> VPSet;
99 for ( VPSet::const_iterator builderPSet = builders.begin();
100 builderPSet != builders.end(); ++builderPSet ) {
107 const VPSet& modfiers = pset.
getParameter<VPSet>(
"modifiers");
108 for ( VPSet::const_iterator modfierPSet = modfiers.begin();
109 modfierPSet != modfiers.end(); ++modfierPSet) {
119 if ( pset.
exists(
"outputSelection") ) {
121 if ( selection !=
"" ) {
127 produces<reco::PFTauCollection>();
152 for (BuilderList::iterator builder =
builders_.begin();
154 builder->setup(evt, es);
156 for (ModifierList::iterator modifier =
modifiers_.begin();
158 modifier->setup(evt, es);
163 output->reserve(jets.
size());
171 if ( jetRegionRef.
isNull() ) {
173 <<
"No jet region can be found for the current jet: " << jetRef.
id();
176 std::vector<reco::PFCandidatePtr> jetCands = jetRef->getPFConstituents();
177 std::vector<reco::PFCandidatePtr> allRegionalCands = jetRegionRef->getPFConstituents();
179 std::sort(jetCands.begin(), jetCands.end());
180 std::sort(allRegionalCands.begin(), allRegionalCands.end());
182 std::vector<reco::PFCandidatePtr> uniqueRegionalCands;
186 if ( allRegionalCands.size() > jetCands.size() ) {
187 uniqueRegionalCands.reserve(allRegionalCands.size() - jetCands.size());
191 std::set_difference(allRegionalCands.begin(), allRegionalCands.end(),
192 jetCands.begin(), jetCands.end(),
193 std::back_inserter(uniqueRegionalCands));
196 const std::vector<reco::PFRecoTauChargedHadron>& chargedHadrons = (*chargedHadronAssoc)[jetRef];
199 const std::vector<reco::RecoTauPiZero>& piZeros = (*piZeroAssoc)[jetRef];
201 unsigned int nTausBuilt = 0;
202 for ( BuilderList::const_iterator builder =
builders_.begin();
210 output->insert(output->end(), taus.begin(), taus.end());
211 nTausBuilt += taus.size();
217 output->push_back(tau);
226 reco::PFTau nullTau(std::numeric_limits<int>::quiet_NaN(), jetRef->p4());
228 output->push_back(nullTau);
233 for ( reco::PFTauCollection::iterator
tau = output->begin();
234 tau != output->end(); ++
tau ) {
235 for ( ModifierList::const_iterator modifier =
modifiers_.begin();
241 for ( ModifierList::iterator modifier =
modifiers_.begin();
243 modifier->endEvent();
T getParameter(std::string const &) const
boost::ptr_vector< Modifier > ModifierList
edm::EDGetTokenT< reco::CandidateView > jet_token
std::vector< PFTau > PFTauCollection
collection of PFTau objects
auto_ptr< JetDefinition::Plugin > plugin
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
ProductID id() const
Accessor for product ID.
std::auto_ptr< StringCutObjectSelector< reco::PFTau > > outputSelector_
void setjetRef(const PFJetRef &)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
RecoTauProducer(const edm::ParameterSet &pset)
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)