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 
58  // prepare output
59  std::auto_ptr< EBUncalibratedRecHitCollection > ebUncalibRechits( new EBUncalibratedRecHitCollection );
60  std::auto_ptr< EEUncalibratedRecHitCollection > eeUncalibRechits( new EEUncalibratedRecHitCollection );
61 
62  // loop over EB digis
63  if (ebDigis)
64  {
65  ebUncalibRechits->reserve(ebDigis->size());
66  for(EBDigiCollection::const_iterator itdg = ebDigis->begin(); itdg != ebDigis->end(); ++itdg) {
67  worker_->run(evt, itdg, *ebUncalibRechits);
68  }
69  }
70 
71  // loop over EB digis
72  if (eeDigis)
73  {
74  eeUncalibRechits->reserve(eeDigis->size());
75  for(EEDigiCollection::const_iterator itdg = eeDigis->begin(); itdg != eeDigis->end(); ++itdg) {
76  worker_->run(evt, itdg, *eeUncalibRechits);
77  }
78  }
79 
80  // put the collection of recunstructed hits in the event
81  evt.put( ebUncalibRechits, ebHitCollection_ );
82  evt.put( eeUncalibRechits, eeHitCollection_ );
83 }
84 
T getParameter(std::string const &) const
virtual void produce(edm::Event &evt, const edm::EventSetup &es)
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:434
#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:116
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
EcalUncalibRecHitWorkerBaseClass * worker_
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