14 #include <boost/ptr_container/ptr_vector.hpp>
15 #include <boost/ptr_container/ptr_list.hpp>
16 #include <boost/foreach.hpp>
48 void print(
const std::vector<reco::RecoTauPiZero>& piZeros,
66 std::auto_ptr<StringCutObjectSelector<reco::RecoTauPiZero> >
79 typedef std::vector<edm::ParameterSet> VPSet;
84 const VPSet& builders = pset.
getParameter<VPSet>(
"builders");
86 for (VPSet::const_iterator builderPSet = builders.begin();
87 builderPSet != builders.end(); ++builderPSet) {
97 const VPSet& rankers = pset.
getParameter<VPSet>(
"ranking");
98 for (VPSet::const_iterator rankerPSet = rankers.begin();
99 rankerPSet != rankers.end(); ++rankerPSet) {
103 pluginType, *rankerPSet));
110 if (pset.
exists(
"outputSelection")) {
112 if (selection !=
"") {
121 produces<reco::JetPiZeroAssociation>();
132 builder.
setup(evt, es);
137 reco::tau::castView<reco::PFJetRefVector>(jetView);
139 std::auto_ptr<reco::JetPiZeroAssociation> association;
141 if (jetRefs.
size()) {
157 dirtyPiZeros.transfer(dirtyPiZeros.end(),
result);
160 <<
"Exception caught in builder plugin " << builder.
name()
161 <<
", rethrowing" << std::endl;
169 std::vector<reco::RecoTauPiZero> cleanPiZeros;
170 std::set<reco::CandidatePtr> photonsInCleanCollection;
171 while (dirtyPiZeros.size()) {
173 std::auto_ptr<reco::RecoTauPiZero>
toAdd(
174 dirtyPiZeros.pop_front().release());
180 std::vector<reco::CandidatePtr> uniqueGammas;
181 std::set_difference(
toAdd->daughterPtrVector().begin(),
182 toAdd->daughterPtrVector().end(),
183 photonsInCleanCollection.begin(),
184 photonsInCleanCollection.end(),
185 std::back_inserter(uniqueGammas));
188 if (!uniqueGammas.size()) {
190 }
else if (uniqueGammas.size() ==
toAdd->daughterPtrVector().size()) {
193 photonsInCleanCollection.insert(
toAdd->daughterPtrVector().begin(),
194 toAdd->daughterPtrVector().end());
195 cleanPiZeros.push_back(*
toAdd);
199 toAdd->clearDaughters();
202 toAdd->addDaughter(gamma);
208 PiZeroList::iterator insertionPoint = std::lower_bound(
210 dirtyPiZeros.insert(insertionPoint,
toAdd);
216 cleanPiZeros.begin(), cleanPiZeros.end(),
224 association->setValue(jet.
key(), cleanPiZeros);
226 evt.
put(association);
231 const std::vector<reco::RecoTauPiZero>& piZeros, std::ostream&
out) {
232 const unsigned int width = 25;
235 out <<
"* Rankers:" << std::endl;
236 for (rankerList::const_iterator ranker =
rankers_.begin();
237 ranker !=
rankers_.end(); ++ranker) {
238 out <<
"* " << std::setiosflags(std::ios::left)
239 << std::setw(width) << ranker->name()
240 <<
" " << std::resetiosflags(std::ios::left)
241 << std::setprecision(3) << (*ranker)(piZero);
T getParameter(std::string const &) const
void produce(edm::Event &evt, const edm::EventSetup &es) override
edm::EDGetTokenT< reco::CandidateView > cand_token
bool getByToken(EDGetToken token, Handle< PROD > &result) 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
key_type key() const
Accessor for product key.
void print(const std::vector< reco::RecoTauPiZero > &piZeros, std::ostream &out)
void setup(edm::Event &, const edm::EventSetup &)
reco::tau::RecoTauPiZeroBuilderPlugin Builder
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
boost::ptr_vector< reco::RecoTauPiZero > PiZeroVector
boost::ptr_vector< Builder > builderList
boost::ptr_list< reco::RecoTauPiZero > PiZeroList
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
const std::string & name() const
T get(const Candidate &c)
std::auto_ptr< PiZeroPredicate > predicate_