CMS 3D CMS Logo

CandReducer.cc
Go to the documentation of this file.
1 
22 
23 class CandReducer : public edm::EDProducer {
24 public:
26  explicit CandReducer( const edm::ParameterSet& );
28  ~CandReducer() override;
29 private:
31  void produce( edm::Event& evt, const edm::EventSetup& ) override;
34 };
35 
40 
41 using namespace reco;
42 using namespace edm;
43 
45  srcToken_( consumes<reco::CandidateView>(cfg.getParameter<edm::InputTag>("src") ) ) {
46  produces<CandidateCollection>();
47 }
48 
50 }
51 
52 void CandReducer::produce( Event& evt, const EventSetup& ) {
54  evt.getByToken( srcToken_, cands );
55  std::unique_ptr<CandidateCollection> comp( new CandidateCollection );
56  for( reco::CandidateView::const_iterator c = cands->begin(); c != cands->end(); ++c ) {
57  std::unique_ptr<Candidate> cand( new LeafCandidate( * c ) );
58  comp->push_back( cand.release() );
59  }
60  evt.put(std::move(comp));
61 }
62 
64 
edm::EDGetTokenT< reco::CandidateView > srcToken_
label of source candidate collection
Definition: CandReducer.cc:33
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const_iterator begin() const
~CandReducer() override
destructor
Definition: CandReducer.cc:49
CandReducer(const edm::ParameterSet &)
constructor from parameter set
Definition: CandReducer.cc:44
void produce(edm::Event &evt, const edm::EventSetup &) override
process one evevnt
Definition: CandReducer.cc:52
fixed size matrix
HLT enums.
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
const_iterator end() const
def move(src, dest)
Definition: eostools.py:511