15 #include <boost/ptr_container/ptr_vector.hpp>
16 #include <boost/ptr_container/ptr_list.hpp>
17 #include <boost/foreach.hpp>
48 void print(
const std::vector<reco::RecoTauPiZero>& piZeros,
67 std::auto_ptr<StringCutObjectSelector<reco::RecoTauPiZero> >
74 typedef std::vector<edm::ParameterSet> VPSet;
79 const VPSet& builders = pset.
getParameter<VPSet>(
"builders");
81 for (VPSet::const_iterator builderPSet = builders.begin();
82 builderPSet != builders.end(); ++builderPSet) {
84 const std::string& pluginType =
85 builderPSet->getParameter<std::string>(
"plugin");
88 pluginType, *builderPSet));
92 const VPSet& rankers = pset.
getParameter<VPSet>(
"ranking");
93 for (VPSet::const_iterator rankerPSet = rankers.begin();
94 rankerPSet != rankers.end(); ++rankerPSet) {
95 const std::string& pluginType =
96 rankerPSet->getParameter<std::string>(
"plugin");
98 pluginType, *rankerPSet));
105 if (pset.
exists(
"outputSelection")) {
107 if (selection !=
"") {
113 produces<reco::JetPiZeroAssociation>();
124 builder.
setup(evt, es);
129 reco::tau::castView<reco::PFJetRefVector>(jetView);
131 std::auto_ptr<reco::JetPiZeroAssociation> association;
133 if (jetRefs.
size()) {
149 dirtyPiZeros.transfer(dirtyPiZeros.end(),
result);
152 <<
"Exception caught in builder plugin " << builder.
name()
153 <<
", rethrowing" << std::endl;
161 std::vector<reco::RecoTauPiZero> cleanPiZeros;
162 std::set<reco::CandidatePtr> photonsInCleanCollection;
163 while (dirtyPiZeros.size()) {
165 std::auto_ptr<reco::RecoTauPiZero>
toAdd(
166 dirtyPiZeros.pop_front().release());
172 std::vector<reco::CandidatePtr> uniqueGammas;
173 std::set_difference(
toAdd->daughterPtrVector().begin(),
174 toAdd->daughterPtrVector().end(),
175 photonsInCleanCollection.begin(),
176 photonsInCleanCollection.end(),
177 std::back_inserter(uniqueGammas));
180 if (!uniqueGammas.size()) {
182 }
else if (uniqueGammas.size() ==
toAdd->daughterPtrVector().size()) {
185 photonsInCleanCollection.insert(
toAdd->daughterPtrVector().begin(),
186 toAdd->daughterPtrVector().end());
187 cleanPiZeros.push_back(*
toAdd);
191 toAdd->clearDaughters();
194 toAdd->addDaughter(gamma);
200 PiZeroList::iterator insertionPoint = std::lower_bound(
202 dirtyPiZeros.insert(insertionPoint,
toAdd);
208 cleanPiZeros.begin(), cleanPiZeros.end(),
214 association->setValue(jet.
key(), cleanPiZeros);
216 evt.
put(association);
221 const std::vector<reco::RecoTauPiZero>& piZeros, std::ostream&
out) {
222 const unsigned int width = 25;
225 out <<
"* Rankers:" << std::endl;
226 for (rankerList::const_iterator ranker =
rankers_.begin();
227 ranker !=
rankers_.end(); ++ranker) {
228 out <<
"* " << std::setiosflags(std::ios::left)
229 << std::setw(width) << ranker->name()
230 <<
" " << std::resetiosflags(std::ios::left)
231 << std::setprecision(3) << (*ranker)(piZero);
T getParameter(std::string const &) const
#define DEFINE_FWK_MODULE(type)
reco::tau::RecoTauPiZeroQualityPlugin Ranker
bool exists(std::string const ¶meterName) const
checks if a parameter exists
RecoTauPiZeroProducer(const edm::ParameterSet &pset)
reco::tau::RecoTauLexicographicalRanking< rankerList, reco::RecoTauPiZero > PiZeroPredicate
void print(const std::vector< reco::RecoTauPiZero > &piZeros, std::ostream &out)
reco::tau::RecoTauPiZeroBuilderPlugin Builder
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
boost::ptr_vector< reco::RecoTauPiZero > PiZeroVector
boost::ptr_vector< Builder > builderList
boost::ptr_list< reco::RecoTauPiZero > PiZeroList
key_type key() const
Accessor for product key.
void produce(edm::Event &evt, const edm::EventSetup &es)
size_type size() const
Size of the RefVector.
boost::ptr_vector< Ranker > rankerList
void set(reco::Candidate &c) const
set up a candidate
std::auto_ptr< StringCutObjectSelector< reco::RecoTauPiZero > > outputSelector_
virtual void setMass(double m)
set particle mass
void setup(const edm::Event &, const edm::EventSetup &)
const std::string & name() const
T get(const Candidate &c)
std::auto_ptr< PiZeroPredicate > predicate_