#include <EcalRecHitProducer.h>
Public Member Functions | |
EcalRecHitProducer (const edm::ParameterSet &ps) | |
virtual void | produce (edm::Event &evt, const edm::EventSetup &es) |
~EcalRecHitProducer () | |
Private Attributes | |
edm::InputTag | ebDetIdToBeRecovered_ |
edm::InputTag | ebFEToBeRecovered_ |
std::string | ebRechitCollection_ |
edm::InputTag | ebUncalibRecHitCollection_ |
edm::InputTag | eeDetIdToBeRecovered_ |
edm::InputTag | eeFEToBeRecovered_ |
std::string | eeRechitCollection_ |
edm::InputTag | eeUncalibRecHitCollection_ |
bool | killDeadChannels_ |
bool | recoverEBFE_ |
bool | recoverEBIsolatedChannels_ |
bool | recoverEBVFE_ |
bool | recoverEEFE_ |
bool | recoverEEIsolatedChannels_ |
bool | recoverEEVFE_ |
EcalRecHitWorkerBaseClass * | worker_ |
EcalRecHitWorkerBaseClass * | workerRecover_ |
produce ECAL rechits from uncalibrated rechits
produce ECAL rechits from uncalibrated rechits
Definition at line 23 of file EcalRecHitProducer.h.
EcalRecHitProducer::EcalRecHitProducer | ( | const edm::ParameterSet & | ps | ) | [explicit] |
Definition at line 31 of file EcalRecHitProducer.cc.
References ebDetIdToBeRecovered_, ebFEToBeRecovered_, ebRechitCollection_, ebUncalibRecHitCollection_, eeDetIdToBeRecovered_, eeFEToBeRecovered_, eeRechitCollection_, eeUncalibRecHitCollection_, reco::get(), edm::ParameterSet::getParameter(), killDeadChannels_, recoverEBFE_, recoverEBIsolatedChannels_, recoverEBVFE_, recoverEEFE_, recoverEEIsolatedChannels_, recoverEEVFE_, worker_, and workerRecover_.
{ ebUncalibRecHitCollection_ = ps.getParameter<edm::InputTag>("EBuncalibRecHitCollection"); eeUncalibRecHitCollection_ = ps.getParameter<edm::InputTag>("EEuncalibRecHitCollection"); ebRechitCollection_ = ps.getParameter<std::string>("EBrechitCollection"); eeRechitCollection_ = ps.getParameter<std::string>("EErechitCollection"); recoverEBIsolatedChannels_ = ps.getParameter<bool>("recoverEBIsolatedChannels"); recoverEEIsolatedChannels_ = ps.getParameter<bool>("recoverEEIsolatedChannels"); recoverEBVFE_ = ps.getParameter<bool>("recoverEBVFE"); recoverEEVFE_ = ps.getParameter<bool>("recoverEEVFE"); recoverEBFE_ = ps.getParameter<bool>("recoverEBFE"); recoverEEFE_ = ps.getParameter<bool>("recoverEEFE"); killDeadChannels_ = ps.getParameter<bool>("killDeadChannels"); ebDetIdToBeRecovered_ = ps.getParameter<edm::InputTag>("ebDetIdToBeRecovered"); eeDetIdToBeRecovered_ = ps.getParameter<edm::InputTag>("eeDetIdToBeRecovered"); ebFEToBeRecovered_ = ps.getParameter<edm::InputTag>("ebFEToBeRecovered"); eeFEToBeRecovered_ = ps.getParameter<edm::InputTag>("eeFEToBeRecovered"); produces< EBRecHitCollection >(ebRechitCollection_); produces< EERecHitCollection >(eeRechitCollection_); std::string componentType = ps.getParameter<std::string>("algo"); worker_ = EcalRecHitWorkerFactory::get()->create(componentType, ps); // to recover problematic channels componentType = ps.getParameter<std::string>("algoRecover"); workerRecover_ = EcalRecHitWorkerFactory::get()->create(componentType, ps); }
EcalRecHitProducer::~EcalRecHitProducer | ( | ) |
Definition at line 62 of file EcalRecHitProducer.cc.
References worker_, and workerRecover_.
{ delete worker_; delete workerRecover_; }
void EcalRecHitProducer::produce | ( | edm::Event & | evt, |
const edm::EventSetup & | es | ||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 69 of file EcalRecHitProducer.cc.
References EcalRecHitWorkerBaseClass::EB_FE, EcalRecHitWorkerBaseClass::EB_single, EcalRecHitWorkerBaseClass::EB_VFE, ebDetIdToBeRecovered_, ebFEToBeRecovered_, ebRechitCollection_, ebUncalibRecHitCollection_, EcalRecHitWorkerBaseClass::EE_FE, EcalRecHitWorkerBaseClass::EE_single, EcalRecHitWorkerBaseClass::EE_VFE, eeDetIdToBeRecovered_, eeFEToBeRecovered_, eeRechitCollection_, eeUncalibRecHitCollection_, EBDetId::ETAPHIMODE, edm::EventSetup::get(), edm::Event::getByLabel(), EcalChannelStatusCode::getStatusCode(), edm::InputTag::instance(), edm::HandleBase::isValid(), killDeadChannels_, edm::InputTag::label(), LogDebug, edm::Handle< T >::product(), edm::Event::put(), recoverEBFE_, recoverEBIsolatedChannels_, recoverEBVFE_, recoverEEFE_, recoverEEIsolatedChannels_, recoverEEVFE_, EcalRecHitWorkerBaseClass::run(), EcalRecHitWorkerBaseClass::set(), EEDetId::validDetId(), worker_, and workerRecover_.
{ using namespace edm; Handle< EBUncalibratedRecHitCollection > pEBUncalibRecHits; Handle< EEUncalibratedRecHitCollection > pEEUncalibRecHits; const EBUncalibratedRecHitCollection* ebUncalibRecHits = 0; const EEUncalibratedRecHitCollection* eeUncalibRecHits = 0; // get the barrel uncalib rechit collection if ( ebUncalibRecHitCollection_.label() != "" && ebUncalibRecHitCollection_.instance() != "" ) { evt.getByLabel( ebUncalibRecHitCollection_, pEBUncalibRecHits); if ( pEBUncalibRecHits.isValid() ) { ebUncalibRecHits = pEBUncalibRecHits.product(); LogDebug("EcalRecHitDebug") << "total # EB uncalibrated rechits: " << ebUncalibRecHits->size(); } else { edm::LogError("EcalRecHitError") << "Error! can't get the product " << ebUncalibRecHitCollection_; } } if ( eeUncalibRecHitCollection_.label() != "" && eeUncalibRecHitCollection_.instance() != "" ) { evt.getByLabel( eeUncalibRecHitCollection_, pEEUncalibRecHits); if ( pEEUncalibRecHits.isValid() ) { eeUncalibRecHits = pEEUncalibRecHits.product(); // get a ptr to the product LogDebug("EcalRecHitDebug") << "total # EE uncalibrated rechits: " << eeUncalibRecHits->size(); } else { edm::LogError("EcalRecHitError") << "Error! can't get the product " << eeUncalibRecHitCollection_; } } // collection of rechits to put in the event std::auto_ptr< EBRecHitCollection > ebRecHits( new EBRecHitCollection ); std::auto_ptr< EERecHitCollection > eeRecHits( new EERecHitCollection ); worker_->set(es); if ( recoverEBIsolatedChannels_ || recoverEEIsolatedChannels_ || recoverEBFE_ || recoverEEFE_ || recoverEBVFE_ || recoverEEVFE_ || killDeadChannels_ ) { workerRecover_->set(es); } if (ebUncalibRecHits) { // loop over uncalibrated rechits to make calibrated ones for(EBUncalibratedRecHitCollection::const_iterator it = ebUncalibRecHits->begin(); it != ebUncalibRecHits->end(); ++it) { worker_->run(evt, *it, *ebRecHits); } } if (eeUncalibRecHits) { // loop over uncalibrated rechits to make calibrated ones for(EEUncalibratedRecHitCollection::const_iterator it = eeUncalibRecHits->begin(); it != eeUncalibRecHits->end(); ++it) { worker_->run(evt, *it, *eeRecHits); } } // sort collections before attempting recovery, to avoid insertion of double recHits ebRecHits->sort(); eeRecHits->sort(); if ( recoverEBIsolatedChannels_ || recoverEBFE_ || killDeadChannels_ ) { edm::Handle< std::set<EBDetId> > pEBDetId; const std::set<EBDetId> * detIds = 0; if ( ebDetIdToBeRecovered_.label() != "" && ebDetIdToBeRecovered_.instance() != "" ) { evt.getByLabel( ebDetIdToBeRecovered_, pEBDetId); if ( pEBDetId.isValid() ) { detIds = pEBDetId.product(); } else { edm::LogError("EcalRecHitError") << "Error! can't get the product " << ebDetIdToBeRecovered_; } } if ( detIds ) { edm::ESHandle<EcalChannelStatus> chStatus; es.get<EcalChannelStatusRcd>().get(chStatus); for( std::set<EBDetId>::const_iterator it = detIds->begin(); it != detIds->end(); ++it ) { // get channel status map to treat dead VFE separately EcalChannelStatusMap::const_iterator chit = chStatus->find( *it ); EcalChannelStatusCode chStatusCode = 1; if ( chit != chStatus->end() ) { chStatusCode = *chit; } else { edm::LogError("EcalRecHitProducerError") << "No channel status found for xtal " << (*it).rawId() << "! something wrong with EcalChannelStatus in your DB? "; } EcalUncalibratedRecHit urh; if ( (chStatusCode.getStatusCode() & 0x001F) == 12 ) { // dead VFE (from DB info) // uses the EcalUncalibratedRecHit to pass the DetId info urh = EcalUncalibratedRecHit( *it, 0, 0, 0, 0, EcalRecHitWorkerBaseClass::EB_VFE ); if ( recoverEBVFE_ || killDeadChannels_ ) workerRecover_->run( evt, urh, *ebRecHits ); } else { // uses the EcalUncalibratedRecHit to pass the DetId info urh = EcalUncalibratedRecHit( *it, 0, 0, 0, 0, EcalRecHitWorkerBaseClass::EB_single ); if ( recoverEBIsolatedChannels_ || killDeadChannels_ ) workerRecover_->run( evt, urh, *ebRecHits ); } } } } if ( recoverEEIsolatedChannels_ || recoverEEVFE_ || killDeadChannels_ ) { edm::Handle< std::set<EEDetId> > pEEDetId; const std::set<EEDetId> * detIds = 0; if ( eeDetIdToBeRecovered_.label() != "" && eeDetIdToBeRecovered_.instance() != "" ) { evt.getByLabel( eeDetIdToBeRecovered_, pEEDetId); if ( pEEDetId.isValid() ) { detIds = pEEDetId.product(); } else { edm::LogError("EcalRecHitError") << "Error! can't get the product " << eeDetIdToBeRecovered_; } } if ( detIds ) { edm::ESHandle<EcalChannelStatus> chStatus; es.get<EcalChannelStatusRcd>().get(chStatus); for( std::set<EEDetId>::const_iterator it = detIds->begin(); it != detIds->end(); ++it ) { // get channel status map to treat dead VFE separately EcalChannelStatusMap::const_iterator chit = chStatus->find( *it ); EcalChannelStatusCode chStatusCode = 1; if ( chit != chStatus->end() ) { chStatusCode = *chit; } else { edm::LogError("EcalRecHitProducerError") << "No channel status found for xtal " << (*it).rawId() << "! something wrong with EcalChannelStatus in your DB? "; } EcalUncalibratedRecHit urh; if ( (chStatusCode.getStatusCode() & 0x001F) == 12 ) { // dead VFE (from DB info) // uses the EcalUncalibratedRecHit to pass the DetId info urh = EcalUncalibratedRecHit( *it, 0, 0, 0, 0, EcalRecHitWorkerBaseClass::EE_VFE ); if ( recoverEEVFE_ || killDeadChannels_ ) workerRecover_->run( evt, urh, *eeRecHits ); } else { // uses the EcalUncalibratedRecHit to pass the DetId info urh = EcalUncalibratedRecHit( *it, 0, 0, 0, 0, EcalRecHitWorkerBaseClass::EE_single ); if ( recoverEEIsolatedChannels_ || killDeadChannels_ ) workerRecover_->run( evt, urh, *eeRecHits ); } } } } if ( recoverEBFE_ || killDeadChannels_ ) { edm::Handle< std::set<EcalTrigTowerDetId> > pEBFEId; const std::set<EcalTrigTowerDetId> * ttIds = 0; if ( ebFEToBeRecovered_.label() != "" && ebFEToBeRecovered_.instance() != "" ) { evt.getByLabel( ebFEToBeRecovered_, pEBFEId); if ( pEBFEId.isValid() ) { ttIds = pEBFEId.product(); } else { edm::LogError("EcalRecHitError") << "Error! can't get the product " << ebFEToBeRecovered_; } } if ( ttIds ) { for( std::set<EcalTrigTowerDetId>::const_iterator it = ttIds->begin(); it != ttIds->end(); ++it ) { // uses the EcalUncalibratedRecHit to pass the DetId info int ieta = (((*it).ietaAbs()-1)*5+1)*(*it).zside(); // from EcalTrigTowerConstituentsMap int iphi = ((*it).iphi()-1)*5+11; // from EcalTrigTowerConstituentsMap if( iphi <= 0 ) iphi += 360; // from EcalTrigTowerConstituentsMap EcalUncalibratedRecHit urh( EBDetId(ieta, iphi, EBDetId::ETAPHIMODE), 0, 0, 0, 0, EcalRecHitWorkerBaseClass::EB_FE ); workerRecover_->run( evt, urh, *ebRecHits ); } } } if ( recoverEEFE_ || killDeadChannels_ ) { edm::Handle< std::set<EcalScDetId> > pEEFEId; const std::set<EcalScDetId> * scIds = 0; if ( eeFEToBeRecovered_.label() != "" && eeFEToBeRecovered_.instance() != "" ) { evt.getByLabel( eeFEToBeRecovered_, pEEFEId); if ( pEEFEId.isValid() ) { scIds = pEEFEId.product(); } else { edm::LogError("EcalRecHitError") << "Error! can't get the product " << eeFEToBeRecovered_; } } if ( scIds ) { for( std::set<EcalScDetId>::const_iterator it = scIds->begin(); it != scIds->end(); ++it ) { // uses the EcalUncalibratedRecHit to pass the DetId info if (EEDetId::validDetId( ((*it).ix()-1)*5+1, ((*it).iy()-1)*5+1, (*it).zside() )) { EcalUncalibratedRecHit urh( EEDetId( ((*it).ix()-1)*5+1, ((*it).iy()-1)*5+1, (*it).zside() ), 0, 0, 0, 0, EcalRecHitWorkerBaseClass::EE_FE ); workerRecover_->run( evt, urh, *eeRecHits ); } } } } // put the collection of recunstructed hits in the event LogInfo("EcalRecHitInfo") << "total # EB calibrated rechits: " << ebRecHits->size(); LogInfo("EcalRecHitInfo") << "total # EE calibrated rechits: " << eeRecHits->size(); evt.put( ebRecHits, ebRechitCollection_ ); evt.put( eeRecHits, eeRechitCollection_ ); }
Definition at line 45 of file EcalRecHitProducer.h.
Referenced by EcalRecHitProducer(), and produce().
Definition at line 47 of file EcalRecHitProducer.h.
Referenced by EcalRecHitProducer(), and produce().
std::string EcalRecHitProducer::ebRechitCollection_ [private] |
Definition at line 34 of file EcalRecHitProducer.h.
Referenced by EcalRecHitProducer(), and produce().
Definition at line 32 of file EcalRecHitProducer.h.
Referenced by EcalRecHitProducer(), and produce().
Definition at line 46 of file EcalRecHitProducer.h.
Referenced by EcalRecHitProducer(), and produce().
Definition at line 48 of file EcalRecHitProducer.h.
Referenced by EcalRecHitProducer(), and produce().
std::string EcalRecHitProducer::eeRechitCollection_ [private] |
Definition at line 35 of file EcalRecHitProducer.h.
Referenced by EcalRecHitProducer(), and produce().
Definition at line 33 of file EcalRecHitProducer.h.
Referenced by EcalRecHitProducer(), and produce().
bool EcalRecHitProducer::killDeadChannels_ [private] |
Definition at line 43 of file EcalRecHitProducer.h.
Referenced by EcalRecHitProducer(), and produce().
bool EcalRecHitProducer::recoverEBFE_ [private] |
Definition at line 41 of file EcalRecHitProducer.h.
Referenced by EcalRecHitProducer(), and produce().
bool EcalRecHitProducer::recoverEBIsolatedChannels_ [private] |
Definition at line 37 of file EcalRecHitProducer.h.
Referenced by EcalRecHitProducer(), and produce().
bool EcalRecHitProducer::recoverEBVFE_ [private] |
Definition at line 39 of file EcalRecHitProducer.h.
Referenced by EcalRecHitProducer(), and produce().
bool EcalRecHitProducer::recoverEEFE_ [private] |
Definition at line 42 of file EcalRecHitProducer.h.
Referenced by EcalRecHitProducer(), and produce().
bool EcalRecHitProducer::recoverEEIsolatedChannels_ [private] |
Definition at line 38 of file EcalRecHitProducer.h.
Referenced by EcalRecHitProducer(), and produce().
bool EcalRecHitProducer::recoverEEVFE_ [private] |
Definition at line 40 of file EcalRecHitProducer.h.
Referenced by EcalRecHitProducer(), and produce().
Definition at line 50 of file EcalRecHitProducer.h.
Referenced by EcalRecHitProducer(), produce(), and ~EcalRecHitProducer().
Definition at line 51 of file EcalRecHitProducer.h.
Referenced by EcalRecHitProducer(), produce(), and ~EcalRecHitProducer().