CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CandReducer.cc
Go to the documentation of this file.
1 
21 
22 class CandReducer : public edm::EDProducer {
23 public:
25  explicit CandReducer( const edm::ParameterSet& );
27  ~CandReducer();
28 private:
30  void produce( edm::Event& evt, const edm::EventSetup& );
33 };
34 
40 
41 using namespace reco;
42 using namespace edm;
43 
45  src_( cfg.getParameter<edm::InputTag>("src") ) {
46  produces<CandidateCollection>();
47 }
48 
50 }
51 
52 void CandReducer::produce( Event& evt, const EventSetup& ) {
54  evt.getByLabel( src_, cands );
55  std::auto_ptr<CandidateCollection> comp( new CandidateCollection );
56  for( reco::CandidateView::const_iterator c = cands->begin(); c != cands->end(); ++c ) {
57  std::auto_ptr<Candidate> cand( new LeafCandidate( * c ) );
58  comp->push_back( cand.release() );
59  }
60  evt.put( comp );
61 }
62 
64 
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
edm::InputTag src_
label of source candidate collection
Definition: CandReducer.cc:32
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
CandReducer(const edm::ParameterSet &)
constructor from parameter set
Definition: CandReducer.cc:44
void produce(edm::Event &evt, const edm::EventSetup &)
process one evevnt
Definition: CandReducer.cc:52
~CandReducer()
destructor
Definition: CandReducer.cc:49