1 #ifndef PhysicsTools_PatAlgos_plugins_PATCleaner_h
2 #define PhysicsTools_PatAlgos_plugins_PATCleaner_h
40 template<
class PATObjType>
62 template <
class PATObjType>
64 src_(iConfig.getParameter<edm::
InputTag>(
"src")),
65 srcToken_(consumes<edm::
View<PATObjType> >(src_)),
66 preselectionCut_(iConfig.getParameter<std::
string>(
"preselection")),
67 finalCut_(iConfig.getParameter<std::
string>(
"finalCut"))
74 for (std::vector<std::string>::const_iterator itn = overlapNames.begin(); itn != overlapNames.end(); ++itn) {
78 if (cfg.
empty())
continue;
82 if (algorithm ==
"byDeltaR") {
84 }
else if (algorithm ==
"bySuperClusterSeed") {
87 throw cms::Exception(
"Configuration") <<
"PATCleaner for " <<
src_ <<
": unsupported algorithm '" << algorithm <<
"'\n";
92 produces<std::vector<PATObjType> >();
95 template <
class PATObjType>
104 std::auto_ptr< std::vector<PATObjType> >
output(
new std::vector<PATObjType>());
107 for (
auto& itov : overlapTests_) {
108 itov->readInput(iEvent,iSetup);
113 if (!preselectionCut_(*it))
continue;
117 output->push_back(*it);
118 PATObjType &
obj = output->back();
121 bool badForOverlap =
false;
122 for (
auto& itov : overlapTests_) {
124 bool hasOverlap = itov->fillOverlapsForItem(obj, overlaps);
125 if (hasOverlap && itov->requireNoOverlaps()) {
126 badForOverlap =
true;
129 obj.setOverlaps(itov->name(),
overlaps);
131 if (badForOverlap) { output->pop_back();
continue; }
134 if (!finalCut_(obj)) output->pop_back();
T getParameter(std::string const &) const
virtual void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) overridefinal
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const Selector preselectionCut_
PAT Cleaner module for PAT Objects.
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
std::vector< std::unique_ptr< OverlapTest > > overlapTests_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
pat::helper::OverlapTest OverlapTest
PATCleaner(const edm::ParameterSet &iConfig)
const edm::EDGetTokenT< edm::View< PATObjType > > srcToken_
StringCutObjectSelector< PATObjType > Selector