CMS 3D CMS Logo

ObjectSelectorProducer.h
Go to the documentation of this file.
1 #ifndef CommonTools_UtilAlgos_ObjectSelectorProducer_h
2 #define CommonTools_UtilAlgos_ObjectSelectorProducer_h
3 
12 #include <utility>
13 #include <vector>
14 #include <memory>
15 #include <algorithm>
16 
24 template <typename Selector,
25  typename OutputCollection,
26  typename PostProcessor,
27  typename StoreManager,
28  typename Base,
29  typename Init>
30 class ObjectSelectorProducer : public Base {
31 public:
34  : Base(cfg),
35  srcToken_(
36  this->template consumes<typename Selector::collection>(cfg.template getParameter<edm::InputTag>("src"))),
37  selectorInit_(this->consumesCollector()),
38  selector_(cfg, this->consumesCollector()),
39  postProcessor_(cfg, this->consumesCollector()) {
40  postProcessor_.init(*this);
41  }
44 
45 private:
47  void produce(edm::Event& evt, const edm::EventSetup& es) override {
48  selectorInit_.init(selector_, evt, es);
51  StoreManager manager(source);
52  selector_.select(source, evt, es);
53  manager.cloneAndStore(selector_.begin(), selector_.end(), evt);
55  postProcessor_.process(filtered, evt);
56  }
63  PostProcessor postProcessor_;
64 };
65 
66 #endif
ObjectSelectorProducer(const edm::ParameterSet &cfg)
constructor
PostProcessor postProcessor_
post processor
edm::EDGetTokenT< typename Selector::collection > srcToken_
source collection label
def Base(process)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:540
static const TGPicture * filtered(bool iBackgroundIsBlack)
def template(fileName, svg, replaceme="REPLACEME")
Definition: svgfig.py:521
Functor that operates on <T>
Definition: Selector.h:22
void produce(edm::Event &evt, const edm::EventSetup &es) override
process one event
HLT enums.
~ObjectSelectorProducer() override
destructor
static std::string const source
Definition: EdmProvDump.cc:49
Init selectorInit_
Object collection selector.