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) {
77 const std::string& pluginType =
78 builderPSet->getParameter<std::string>(
"plugin");
84 const VPSet& modfiers = pset.
getParameter<VPSet>(
"modifiers");
85 for (VPSet::const_iterator modfierPSet = modfiers.begin();
86 modfierPSet != modfiers.end(); ++modfierPSet) {
88 const std::string& pluginType =
89 modfierPSet->getParameter<std::string>(
"plugin");
96 if (pset.
exists(
"outputSelection")) {
98 if (selection !=
"") {
104 produces<reco::PFTauCollection>();
114 reco::tau::castView<reco::PFJetRefVector>(jetView);
125 for (BuilderList::iterator builder =
builders_.begin();
127 builder->setup(evt, es);
129 for (ModifierList::iterator modifier =
modifiers_.begin();
131 modifier->setup(evt, es);
141 if (jetRegionRef.
isNull()) {
143 <<
" found for the current jet: " << jetRef.
id();
146 std::vector<reco::PFCandidatePtr> jetCands = jetRef->getPFConstituents();
147 std::vector<reco::PFCandidatePtr> allRegionalCands =
148 jetRegionRef->getPFConstituents();
150 std::sort(jetCands.begin(), jetCands.end());
151 std::sort(allRegionalCands.begin(), allRegionalCands.end());
153 std::vector<reco::PFCandidatePtr> uniqueRegionalCands;
157 if (allRegionalCands.size() > jetCands.size())
158 uniqueRegionalCands.reserve(allRegionalCands.size() - jetCands.size());
161 std::set_difference(allRegionalCands.begin(), allRegionalCands.end(),
162 jetCands.begin(), jetCands.end(),
163 std::back_inserter(uniqueRegionalCands));
166 const std::vector<reco::RecoTauPiZero>& piZeros = (*piZeroAssoc)[jetRef];
168 unsigned int nTausBuilt = 0;
169 for (BuilderList::const_iterator builder =
builders_.begin();
173 (*builder)(jetRegionRef, piZeros, uniqueRegionalCands));
175 std::for_each(taus.begin(), taus.end(),
179 output->reserve(output->size() + taus.size());
182 output->insert(output->end(), taus.begin(), taus.end());
183 nTausBuilt += taus.size();
189 output->push_back(tau);
198 reco::PFTau nullTau(std::numeric_limits<int>::quiet_NaN(), jetRef->p4());
200 output->push_back(nullTau);
205 for (reco::PFTauCollection::iterator
tau = output->begin();
206 tau != output->end(); ++
tau) {
207 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)