CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
EcalUncalibRecHitProducer Class Reference

#include <EcalUncalibRecHitProducer.h>

Inheritance diagram for EcalUncalibRecHitProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 EcalUncalibRecHitProducer (const edm::ParameterSet &ps)
 
virtual void produce (edm::Event &evt, const edm::EventSetup &es)
 
 ~EcalUncalibRecHitProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Attributes

edm::InputTag ebDigiCollection_
 
std::string ebHitCollection_
 
edm::InputTag eeDigiCollection_
 
std::string eeHitCollection_
 
EcalUncalibRecHitWorkerBaseClassworker_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 15 of file EcalUncalibRecHitProducer.h.

Constructor & Destructor Documentation

EcalUncalibRecHitProducer::EcalUncalibRecHitProducer ( const edm::ParameterSet ps)
explicit

Definition at line 12 of file EcalUncalibRecHitProducer.cc.

References ebDigiCollection_, ebHitCollection_, eeDigiCollection_, eeHitCollection_, reco::get(), edm::ParameterSet::getParameter(), and worker_.

13 {
14  ebDigiCollection_ = ps.getParameter<edm::InputTag>("EBdigiCollection");
15  eeDigiCollection_ = ps.getParameter<edm::InputTag>("EEdigiCollection");
16  ebHitCollection_ = ps.getParameter<std::string>("EBhitCollection");
17  eeHitCollection_ = ps.getParameter<std::string>("EEhitCollection");
18  produces< EBUncalibratedRecHitCollection >(ebHitCollection_);
19  produces< EEUncalibratedRecHitCollection >(eeHitCollection_);
20 
21  std::string componentType = ps.getParameter<std::string>("algo");
22  worker_ = EcalUncalibRecHitWorkerFactory::get()->create(componentType, ps);
23 }
T getParameter(std::string const &) const
EcalUncalibRecHitWorkerBaseClass * worker_
T get(const Candidate &c)
Definition: component.h:56
EcalUncalibRecHitProducer::~EcalUncalibRecHitProducer ( )

Definition at line 25 of file EcalUncalibRecHitProducer.cc.

References worker_.

26 {
27  delete worker_;
28 }
EcalUncalibRecHitWorkerBaseClass * worker_

Member Function Documentation

void EcalUncalibRecHitProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
virtual

Implements edm::EDProducer.

Definition at line 31 of file EcalUncalibRecHitProducer.cc.

References ebDigiCollection_, ebHitCollection_, eeDigiCollection_, eeHitCollection_, edm::Event::getByLabel(), edm::InputTag::instance(), edm::InputTag::label(), edm::Event::put(), EcalUncalibRecHitWorkerBaseClass::run(), EcalUncalibRecHitWorkerBaseClass::set(), and worker_.

31  {
32 
33  using namespace edm;
34 
37 
38  const EBDigiCollection* ebDigis =0;
39  const EEDigiCollection* eeDigis =0;
40 
41  if ( ebDigiCollection_.label() != "" && ebDigiCollection_.instance() != "" ) {
42  evt.getByLabel( ebDigiCollection_, pEBDigis);
43  //evt.getByLabel( digiProducer_, pEBDigis);
44  if ( pEBDigis.isValid() ) {
45  ebDigis = pEBDigis.product(); // get a ptr to the produc
46  edm::LogInfo("EcalUncalibRecHitInfo") << "total # ebDigis: " << ebDigis->size() ;
47  } else {
48  edm::LogError("EcalUncalibRecHitError") << "Error! can't get the product " << ebDigiCollection_;
49  }
50  }
51 
52  if ( eeDigiCollection_.label() != "" && eeDigiCollection_.instance() != "" ) {
53  evt.getByLabel( eeDigiCollection_, pEEDigis);
54  //evt.getByLabel( digiProducer_, pEEDigis);
55  if ( pEEDigis.isValid() ) {
56  eeDigis = pEEDigis.product(); // get a ptr to the product
57  edm::LogInfo("EcalUncalibRecHitInfo") << "total # eeDigis: " << eeDigis->size() ;
58  } else {
59  edm::LogError("EcalUncalibRecHitError") << "Error! can't get the product " << eeDigiCollection_;
60  }
61  }
62 
63  // tranparently get things from event setup
64  worker_->set(es);
65 
66  // prepare output
67  std::auto_ptr< EBUncalibratedRecHitCollection > ebUncalibRechits( new EBUncalibratedRecHitCollection );
68  std::auto_ptr< EEUncalibratedRecHitCollection > eeUncalibRechits( new EEUncalibratedRecHitCollection );
69 
70  // loop over EB digis
71  if (ebDigis)
72  {
73  ebUncalibRechits->reserve(ebDigis->size());
74  for(EBDigiCollection::const_iterator itdg = ebDigis->begin(); itdg != ebDigis->end(); ++itdg) {
75  worker_->run(evt, itdg, *ebUncalibRechits);
76  }
77  }
78 
79  // loop over EB digis
80  if (eeDigis)
81  {
82  eeUncalibRechits->reserve(eeDigis->size());
83  for(EEDigiCollection::const_iterator itdg = eeDigis->begin(); itdg != eeDigis->end(); ++itdg) {
84  worker_->run(evt, itdg, *eeUncalibRechits);
85  }
86  }
87 
88  // put the collection of recunstructed hits in the event
89  evt.put( ebUncalibRechits, ebHitCollection_ );
90  evt.put( eeUncalibRechits, eeHitCollection_ );
91 }
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
virtual void set(const edm::EventSetup &es)=0
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
EcalUncalibRecHitWorkerBaseClass * worker_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
virtual bool run(const edm::Event &evt, const EcalDigiCollection::const_iterator &digi, EcalUncalibratedRecHitCollection &result)=0
std::string const & label() const
Definition: InputTag.h:25
std::string const & instance() const
Definition: InputTag.h:26

Member Data Documentation

edm::InputTag EcalUncalibRecHitProducer::ebDigiCollection_
private

Definition at line 24 of file EcalUncalibRecHitProducer.h.

Referenced by EcalUncalibRecHitProducer(), and produce().

std::string EcalUncalibRecHitProducer::ebHitCollection_
private

Definition at line 27 of file EcalUncalibRecHitProducer.h.

Referenced by EcalUncalibRecHitProducer(), and produce().

edm::InputTag EcalUncalibRecHitProducer::eeDigiCollection_
private

Definition at line 25 of file EcalUncalibRecHitProducer.h.

Referenced by EcalUncalibRecHitProducer(), and produce().

std::string EcalUncalibRecHitProducer::eeHitCollection_
private

Definition at line 28 of file EcalUncalibRecHitProducer.h.

Referenced by EcalUncalibRecHitProducer(), and produce().

EcalUncalibRecHitWorkerBaseClass* EcalUncalibRecHitProducer::worker_
private