19 #include <boost/ptr_container/ptr_vector.hpp>
20 #include <boost/foreach.hpp>
95 typedef std::vector<edm::ParameterSet> VPSet;
97 const VPSet& builders = pset.
getParameter<VPSet>(
"builders");
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 !=
"" ) {
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);
162 output->reserve(jets.
size());
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();
216 output->push_back(tau);
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();
233 tau != output->end(); ++
tau ) {
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
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
std::auto_ptr< StringCutObjectSelector< reco::PFTau > > outputSelector_
void setjetRef(const PFJetRef &)
bool isNull() const
Checks for null.
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_
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
ProductID id() const
Accessor for product ID.
edm::InputTag jetRegionSrc_
boost::ptr_vector< Builder > BuilderList
T get(const Candidate &c)