CMS 3D CMS Logo

Public Member Functions | Private Attributes

EcalUncalibRecHitProducer Class Reference

#include <EcalUncalibRecHitProducer.h>

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

List of all members.

Public Member Functions

 EcalUncalibRecHitProducer (const edm::ParameterSet &ps)
virtual void produce (edm::Event &evt, const edm::EventSetup &es)
 ~EcalUncalibRecHitProducer ()

Private Attributes

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

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(), AlCaHLTBitMon_QueryRunRegistry::string, and worker_.

{
        ebDigiCollection_ = ps.getParameter<edm::InputTag>("EBdigiCollection");
        eeDigiCollection_ = ps.getParameter<edm::InputTag>("EEdigiCollection");
        ebHitCollection_  = ps.getParameter<std::string>("EBhitCollection");
        eeHitCollection_  = ps.getParameter<std::string>("EEhitCollection");
        produces< EBUncalibratedRecHitCollection >(ebHitCollection_);
        produces< EEUncalibratedRecHitCollection >(eeHitCollection_);

        std::string componentType = ps.getParameter<std::string>("algo");
        worker_ = EcalUncalibRecHitWorkerFactory::get()->create(componentType, ps);
}
EcalUncalibRecHitProducer::~EcalUncalibRecHitProducer ( )

Definition at line 25 of file EcalUncalibRecHitProducer.cc.

References worker_.

{
        delete 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_.

                                                                         {

        using namespace edm;

        Handle< EBDigiCollection > pEBDigis;
        Handle< EEDigiCollection > pEEDigis;

        const EBDigiCollection* ebDigis =0;
        const EEDigiCollection* eeDigis =0;

        if ( ebDigiCollection_.label() != "" && ebDigiCollection_.instance() != "" ) {
                evt.getByLabel( ebDigiCollection_, pEBDigis);
                //evt.getByLabel( digiProducer_, pEBDigis);
                if ( pEBDigis.isValid() ) {
                        ebDigis = pEBDigis.product(); // get a ptr to the produc
                        edm::LogInfo("EcalUncalibRecHitInfo") << "total # ebDigis: " << ebDigis->size() ;
                } else {
                        edm::LogError("EcalUncalibRecHitError") << "Error! can't get the product " << ebDigiCollection_;
                }
        }

        if ( eeDigiCollection_.label() != "" && eeDigiCollection_.instance() != "" ) {
                evt.getByLabel( eeDigiCollection_, pEEDigis);
                //evt.getByLabel( digiProducer_, pEEDigis);
                if ( pEEDigis.isValid() ) {
                        eeDigis = pEEDigis.product(); // get a ptr to the product
                        edm::LogInfo("EcalUncalibRecHitInfo") << "total # eeDigis: " << eeDigis->size() ;
                } else {
                        edm::LogError("EcalUncalibRecHitError") << "Error! can't get the product " << eeDigiCollection_;
                }
        }

        // tranparently get things from event setup
        worker_->set(es);

        // prepare output
        std::auto_ptr< EBUncalibratedRecHitCollection > ebUncalibRechits( new EBUncalibratedRecHitCollection );
        std::auto_ptr< EEUncalibratedRecHitCollection > eeUncalibRechits( new EEUncalibratedRecHitCollection );

        // loop over EB digis
        if (ebDigis)
        {
                ebUncalibRechits->reserve(ebDigis->size());
                for(EBDigiCollection::const_iterator itdg = ebDigis->begin(); itdg != ebDigis->end(); ++itdg) {
                        worker_->run(evt, itdg, *ebUncalibRechits);
                }
        }

        // loop over EB digis
        if (eeDigis)
        {
                eeUncalibRechits->reserve(eeDigis->size());
                for(EEDigiCollection::const_iterator itdg = eeDigis->begin(); itdg != eeDigis->end(); ++itdg) {
                        worker_->run(evt, itdg, *eeUncalibRechits);
                }
        }

        // put the collection of recunstructed hits in the event
        evt.put( ebUncalibRechits, ebHitCollection_ );
        evt.put( eeUncalibRechits, eeHitCollection_ );
}

Member Data Documentation

Definition at line 24 of file EcalUncalibRecHitProducer.h.

Referenced by EcalUncalibRecHitProducer(), and produce().

Definition at line 27 of file EcalUncalibRecHitProducer.h.

Referenced by EcalUncalibRecHitProducer(), and produce().

Definition at line 25 of file EcalUncalibRecHitProducer.h.

Referenced by EcalUncalibRecHitProducer(), and produce().

Definition at line 28 of file EcalUncalibRecHitProducer.h.

Referenced by EcalUncalibRecHitProducer(), and produce().