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  selector_(cfg, this->consumesCollector()),
38  postProcessor_(cfg, this->consumesCollector()) {
39  postProcessor_.init(*this);
40  }
43 
44 private:
46  void produce(edm::Event& evt, const edm::EventSetup& es) override {
47  Init::init(selector_, evt, es);
49  evt.getByToken(srcToken_, source);
50  StoreManager manager(source);
51  selector_.select(source, evt, es);
52  manager.cloneAndStore(selector_.begin(), selector_.end(), evt);
54  postProcessor_.process(filtered, evt);
55  }
61  PostProcessor postProcessor_;
62 };
63 
64 #endif
ObjectSelectorProducer(const edm::ParameterSet &cfg)
constructor
PostProcessor postProcessor_
post processor
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
int init
Definition: HydjetWrapper.h:64
edm::EDGetTokenT< typename Selector::collection > srcToken_
source collection label
def Base(process)
static const TGPicture * filtered(bool iBackgroundIsBlack)
def template(fileName, svg, replaceme="REPLACEME")
Definition: svgfig.py:521
Selector selector_
Object collection selector.
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:47