18 #include <boost/ptr_container/ptr_vector.hpp>
19 #include <boost/foreach.hpp>
71 typedef std::vector<edm::ParameterSet> VPSet;
73 const VPSet& builders = pset.
getParameter<VPSet>(
"builders");
74 for (VPSet::const_iterator builderPSet = builders.begin();
75 builderPSet != builders.end(); ++builderPSet) {
82 pluginType, *builderPSet));
86 const VPSet& modfiers = pset.
getParameter<VPSet>(
"modifiers");
87 for (VPSet::const_iterator modfierPSet = modfiers.begin();
88 modfierPSet != modfiers.end(); ++modfierPSet) {
95 pluginType, *modfierPSet));
100 if (pset.
exists(
"outputSelection")) {
102 if (selection !=
"") {
108 produces<reco::PFTauCollection>();
118 reco::tau::castView<reco::PFJetRefVector>(jetView);
129 for (BuilderList::iterator builder =
builders_.begin();
131 builder->setup(evt, es);
133 for (ModifierList::iterator modifier =
modifiers_.begin();
135 modifier->setup(evt, es);
145 if (jetRegionRef.
isNull()) {
147 <<
" found for the current jet: " << jetRef.
id();
150 std::vector<reco::PFCandidatePtr> jetCands = jetRef->getPFConstituents();
151 std::vector<reco::PFCandidatePtr> allRegionalCands =
152 jetRegionRef->getPFConstituents();
154 std::sort(jetCands.begin(), jetCands.end());
155 std::sort(allRegionalCands.begin(), allRegionalCands.end());
157 std::vector<reco::PFCandidatePtr> uniqueRegionalCands;
161 if (allRegionalCands.size() > jetCands.size())
162 uniqueRegionalCands.reserve(allRegionalCands.size() - jetCands.size());
165 std::set_difference(allRegionalCands.begin(), allRegionalCands.end(),
166 jetCands.begin(), jetCands.end(),
167 std::back_inserter(uniqueRegionalCands));
170 const std::vector<reco::RecoTauPiZero>& piZeros = (*piZeroAssoc)[jetRef];
172 unsigned int nTausBuilt = 0;
173 for (BuilderList::const_iterator builder =
builders_.begin();
177 (*builder)(jetRef, piZeros, uniqueRegionalCands));
179 std::for_each(taus.begin(), taus.end(),
183 output->reserve(output->size() + taus.size());
186 output->insert(output->end(), taus.begin(), taus.end());
187 nTausBuilt += taus.size();
193 output->push_back(tau);
202 reco::PFTau nullTau(std::numeric_limits<int>::quiet_NaN(), jetRef->p4());
204 output->push_back(nullTau);
209 for (reco::PFTauCollection::iterator
tau = output->begin();
210 tau != output->end(); ++
tau) {
211 for (ModifierList::const_iterator modifier =
modifiers_.begin();
T getParameter(std::string const &) const
boost::ptr_vector< Modifier > ModifierList
std::vector< PFTau > PFTauCollection
collection of PFTau objects
#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.
RecoTauProducer(const edm::ParameterSet &pset)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
reco::tau::RecoTauModifierPlugin Modifier
reco::tau::RecoTauBuilderPlugin Builder
ProductID id() const
Accessor for product ID.
edm::InputTag jetRegionSrc_
void produce(edm::Event &evt, const edm::EventSetup &es)
boost::ptr_vector< Builder > BuilderList
T get(const Candidate &c)