19 #include <boost/ptr_container/ptr_vector.hpp>
20 #include <boost/foreach.hpp>
90 typedef std::vector<edm::ParameterSet> VPSet;
92 const VPSet& builders = pset.
getParameter<VPSet>(
"builders");
93 for ( VPSet::const_iterator builderPSet = builders.begin();
94 builderPSet != builders.end(); ++builderPSet ) {
101 const VPSet& modfiers = pset.
getParameter<VPSet>(
"modifiers");
102 for ( VPSet::const_iterator modfierPSet = modfiers.begin();
103 modfierPSet != modfiers.end(); ++modfierPSet) {
109 plugin->beginJob(
this);
114 if ( pset.
exists(
"outputSelection") ) {
116 if ( selection !=
"" ) {
122 produces<reco::PFTauCollection>();
147 for (BuilderList::iterator builder =
builders_.begin();
149 builder->setup(evt, es);
151 for (ModifierList::iterator modifier =
modifiers_.begin();
153 modifier->setup(evt, es);
158 output->reserve(jets.
size());
164 if ( jetRegionRef.
isNull() ) {
166 <<
"No jet region can be found for the current jet: " << jetRef.
id();
169 std::vector<reco::PFCandidatePtr> jetCands = jetRef->getPFConstituents();
170 std::vector<reco::PFCandidatePtr> allRegionalCands = jetRegionRef->getPFConstituents();
172 std::sort(jetCands.begin(), jetCands.end());
173 std::sort(allRegionalCands.begin(), allRegionalCands.end());
175 std::vector<reco::PFCandidatePtr> uniqueRegionalCands;
179 if ( allRegionalCands.size() > jetCands.size() ) {
180 uniqueRegionalCands.reserve(allRegionalCands.size() - jetCands.size());
184 std::set_difference(allRegionalCands.begin(), allRegionalCands.end(),
185 jetCands.begin(), jetCands.end(),
186 std::back_inserter(uniqueRegionalCands));
189 const std::vector<reco::PFRecoTauChargedHadron>& chargedHadrons = (*chargedHadronAssoc)[jetRef];
192 const std::vector<reco::RecoTauPiZero>& piZeros = (*piZeroAssoc)[jetRef];
195 unsigned int nTausBuilt = 0;
196 for ( BuilderList::const_iterator builder =
builders_.begin();
204 output->insert(output->end(), taus.begin(), taus.end());
205 nTausBuilt += taus.size();
211 output->push_back(tau);
220 reco::PFTau nullTau(std::numeric_limits<int>::quiet_NaN(), jetRef->p4());
222 output->push_back(nullTau);
227 for ( reco::PFTauCollection::iterator
tau = output->begin();
228 tau != output->end(); ++
tau ) {
229 for ( ModifierList::const_iterator modifier =
modifiers_.begin();
235 for ( ModifierList::iterator modifier =
modifiers_.begin();
237 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)