CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EcalUncalibRecHitProducer.cc
Go to the documentation of this file.
3 
6 
8 
10 
12 
14 {
15  ebHitCollection_ = ps.getParameter<std::string>("EBhitCollection");
16  eeHitCollection_ = ps.getParameter<std::string>("EEhitCollection");
17  produces< EBUncalibratedRecHitCollection >(ebHitCollection_);
18  produces< EEUncalibratedRecHitCollection >(eeHitCollection_);
19 
20  ebDigiCollectionToken_ = consumes<EBDigiCollection>(ps.getParameter<edm::InputTag>("EBdigiCollection"));
21 
22  eeDigiCollectionToken_ = consumes<EEDigiCollection>(ps.getParameter<edm::InputTag>("EEdigiCollection"));
23 
24  std::string componentType = ps.getParameter<std::string>("algo");
26  worker_ = EcalUncalibRecHitWorkerFactory::get()->create(componentType, ps, c);
27 }
28 
30 {
31  delete worker_;
32 }
33 
34 void
36 
37  using namespace edm;
38 
41 
42  const EBDigiCollection* ebDigis =0;
43  const EEDigiCollection* eeDigis =0;
44 
45 
46  evt.getByToken( ebDigiCollectionToken_, pEBDigis);
47  ebDigis = pEBDigis.product(); // get a ptr to the produc
48  edm::LogInfo("EcalUncalibRecHitInfo") << "total # ebDigis: " << ebDigis->size() ;
49 
50  evt.getByToken( eeDigiCollectionToken_, pEEDigis);
51  eeDigis = pEEDigis.product(); // get a ptr to the product
52  edm::LogInfo("EcalUncalibRecHitInfo") << "total # eeDigis: " << eeDigis->size() ;
53 
54 
55  // tranparently get things from event setup
56  worker_->set(es);
57  worker_->set(evt);
58 
59  // prepare output
60  std::auto_ptr< EBUncalibratedRecHitCollection > ebUncalibRechits( new EBUncalibratedRecHitCollection );
61  std::auto_ptr< EEUncalibratedRecHitCollection > eeUncalibRechits( new EEUncalibratedRecHitCollection );
62 
63  // loop over EB digis
64  if (ebDigis)
65  {
66  ebUncalibRechits->reserve(ebDigis->size());
67  for(EBDigiCollection::const_iterator itdg = ebDigis->begin(); itdg != ebDigis->end(); ++itdg) {
68  worker_->run(evt, itdg, *ebUncalibRechits);
69  }
70  }
71 
72  // loop over EB digis
73  if (eeDigis)
74  {
75  eeUncalibRechits->reserve(eeDigis->size());
76  for(EEDigiCollection::const_iterator itdg = eeDigis->begin(); itdg != eeDigis->end(); ++itdg) {
77  worker_->run(evt, itdg, *eeUncalibRechits);
78  }
79  }
80 
81  // put the collection of recunstructed hits in the event
82  evt.put( ebUncalibRechits, ebHitCollection_ );
83  evt.put( eeUncalibRechits, eeHitCollection_ );
84 }
85 
T getParameter(std::string const &) const
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
virtual void set(const edm::EventSetup &es)=0
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
edm::EDGetTokenT< EEDigiCollection > eeDigiCollectionToken_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
EcalUncalibRecHitWorkerBaseClass * worker_
virtual void produce(edm::Event &evt, const edm::EventSetup &es) override
EcalUncalibRecHitProducer(const edm::ParameterSet &ps)
virtual bool run(const edm::Event &evt, const EcalDigiCollection::const_iterator &digi, EcalUncalibratedRecHitCollection &result)=0
edm::EDGetTokenT< EBDigiCollection > ebDigiCollectionToken_
T get(const Candidate &c)
Definition: component.h:55