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,
69 std::auto_ptr<StringCutObjectSelector<reco::RecoTauPiZero> >
76 typedef std::vector<edm::ParameterSet> VPSet;
81 const VPSet& builders = pset.
getParameter<VPSet>(
"builders");
82 for (VPSet::const_iterator builderPSet = builders.begin();
83 builderPSet != builders.end(); ++builderPSet) {
93 const VPSet& rankers = pset.
getParameter<VPSet>(
"ranking");
94 for (VPSet::const_iterator rankerPSet = rankers.begin();
95 rankerPSet != rankers.end(); ++rankerPSet) {
99 pluginType, *rankerPSet));
106 if (pset.
exists(
"outputSelection")) {
108 if (selection !=
"") {
114 produces<reco::JetPiZeroAssociation>();
125 builder.
setup(evt, es);
130 reco::tau::castView<reco::PFJetRefVector>(jetView);
132 std::auto_ptr<reco::JetPiZeroAssociation> association;
134 if (jetRefs.
size()) {
150 dirtyPiZeros.transfer(dirtyPiZeros.end(),
result);
153 <<
"Exception caught in builder plugin " << builder.
name()
154 <<
", rethrowing" << std::endl;
162 std::vector<reco::RecoTauPiZero> cleanPiZeros;
163 std::set<reco::CandidatePtr> photonsInCleanCollection;
164 while (dirtyPiZeros.size()) {
166 std::auto_ptr<reco::RecoTauPiZero>
toAdd(
167 dirtyPiZeros.pop_front().release());
173 std::vector<reco::CandidatePtr> uniqueGammas;
174 std::set_difference(
toAdd->daughterPtrVector().begin(),
175 toAdd->daughterPtrVector().end(),
176 photonsInCleanCollection.begin(),
177 photonsInCleanCollection.end(),
178 std::back_inserter(uniqueGammas));
181 if (!uniqueGammas.size()) {
183 }
else if (uniqueGammas.size() ==
toAdd->daughterPtrVector().size()) {
186 photonsInCleanCollection.insert(
toAdd->daughterPtrVector().begin(),
187 toAdd->daughterPtrVector().end());
188 cleanPiZeros.push_back(*
toAdd);
192 toAdd->clearDaughters();
195 toAdd->addDaughter(gamma);
201 PiZeroList::iterator insertionPoint = std::lower_bound(
203 dirtyPiZeros.insert(insertionPoint,
toAdd);
209 cleanPiZeros.begin(), cleanPiZeros.end(),
215 association->setValue(jet.
key(), cleanPiZeros);
217 evt.
put(association);
222 const std::vector<reco::RecoTauPiZero>& piZeros, std::ostream&
out) {
223 const unsigned int width = 25;
226 out <<
"* Rankers:" << std::endl;
227 for (rankerList::const_iterator ranker =
rankers_.begin();
228 ranker !=
rankers_.end(); ++ranker) {
229 out <<
"* " << std::setiosflags(std::ios::left)
230 << std::setw(width) << ranker->name()
231 <<
" " << std::resetiosflags(std::ios::left)
232 << 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
virtual void setMass(double m) GCC11_FINAL
set particle mass
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
key_type key() const
Accessor for product key.
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_
const std::string & name() const
T get(const Candidate &c)
std::auto_ptr< PiZeroPredicate > predicate_