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;
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()) {
143 evt.
get(jetRefs.
id(), pfJetCollectionHandle);
159 dirtyPiZeros.transfer(dirtyPiZeros.end(),
result);
162 <<
"Exception caught in builder plugin " << builder.
name()
163 <<
", rethrowing" << std::endl;
171 std::vector<reco::RecoTauPiZero> cleanPiZeros;
172 std::set<reco::CandidatePtr> photonsInCleanCollection;
173 while (dirtyPiZeros.size()) {
175 std::auto_ptr<reco::RecoTauPiZero>
toAdd(
176 dirtyPiZeros.pop_front().release());
182 std::vector<reco::CandidatePtr> uniqueGammas;
183 std::set_difference(
toAdd->daughterPtrVector().begin(),
184 toAdd->daughterPtrVector().end(),
185 photonsInCleanCollection.begin(),
186 photonsInCleanCollection.end(),
187 std::back_inserter(uniqueGammas));
190 if (!uniqueGammas.size()) {
192 }
else if (uniqueGammas.size() ==
toAdd->daughterPtrVector().size()) {
195 photonsInCleanCollection.insert(
toAdd->daughterPtrVector().begin(),
196 toAdd->daughterPtrVector().end());
197 cleanPiZeros.push_back(*
toAdd);
201 toAdd->clearDaughters();
204 toAdd->addDaughter(gamma);
210 PiZeroList::iterator insertionPoint = std::lower_bound(
212 dirtyPiZeros.insert(insertionPoint,
toAdd);
218 cleanPiZeros.begin(), cleanPiZeros.end(),
226 association->setValue(jet.
key(), cleanPiZeros);
228 evt.
put(association);
233 const std::vector<reco::RecoTauPiZero>& piZeros, std::ostream&
out) {
234 const unsigned int width = 25;
237 out <<
"* Rankers:" << std::endl;
238 for (rankerList::const_iterator ranker =
rankers_.begin();
239 ranker !=
rankers_.end(); ++ranker) {
240 out <<
"* " << std::setiosflags(std::ios::left)
241 << std::setw(width) << ranker->name()
242 <<
" " << std::resetiosflags(std::ios::left)
243 << 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
ProductID id() const
Accessor for product ID.
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
bool get(ProductID const &oid, Handle< PROD > &result) const
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_