#include <EcalRecHitWorkerSimple.h>
Public Member Functions | |
EcalRecHitWorkerSimple (const edm::ParameterSet &) | |
bool | run (const edm::Event &evt, const EcalUncalibratedRecHit &uncalibRH, EcalRecHitCollection &result) |
void | set (const edm::EventSetup &es) |
virtual | ~EcalRecHitWorkerSimple () |
Protected Attributes | |
edm::ESHandle < EcalADCToGeVConstant > | agc |
edm::ESHandle< EcalChannelStatus > | chStatus |
edm::ESHandle < EcalIntercalibConstants > | ical |
edm::ESHandle < EcalTimeCalibConstants > | itime |
bool | killDeadChannels_ |
edm::ESHandle< EcalLaserDbService > | laser |
bool | laserCorrection_ |
EcalRecHitSimpleAlgo * | rechitMaker_ |
std::vector< int > | v_chstatus_ |
std::vector< int > | v_DB_reco_flags_ |
Definition at line 25 of file EcalRecHitWorkerSimple.h.
EcalRecHitWorkerSimple::EcalRecHitWorkerSimple | ( | const edm::ParameterSet & | ps | ) |
Definition at line 14 of file EcalRecHitWorkerSimple.cc.
References edm::ParameterSet::getParameter(), killDeadChannels_, laserCorrection_, rechitMaker_, v_chstatus_, and v_DB_reco_flags_.
: EcalRecHitWorkerBaseClass(ps) { rechitMaker_ = new EcalRecHitSimpleAlgo(); v_chstatus_ = ps.getParameter<std::vector<int> >("ChannelStatusToBeExcluded"); v_DB_reco_flags_ = ps.getParameter<std::vector<int> >("flagsMapDBReco"); killDeadChannels_ = ps.getParameter<bool>("killDeadChannels"); laserCorrection_ = ps.getParameter<bool>("laserCorrection"); }
virtual EcalRecHitWorkerSimple::~EcalRecHitWorkerSimple | ( | ) | [inline, virtual] |
Definition at line 28 of file EcalRecHitWorkerSimple.h.
{};
bool EcalRecHitWorkerSimple::run | ( | const edm::Event & | evt, |
const EcalUncalibratedRecHit & | uncalibRH, | ||
EcalRecHitCollection & | result | ||
) | [virtual] |
Implements EcalRecHitWorkerBaseClass.
Definition at line 36 of file EcalRecHitWorkerSimple.cc.
References agc, chStatus, cond::rpcobgas::detid, EcalEndcap, EcalCondObjectContainer< T >::end(), EcalCondObjectContainer< T >::find(), spr::find(), EcalChannelStatusCode::getStatusCode(), ical, EcalUncalibratedRecHit::id(), itime, killDeadChannels_, EcalRecHit::kLeadingEdgeRecovered, laser, laserCorrection_, EcalRecHitSimpleAlgo::makeRecHit(), edm::SortedCollection< T, SORT >::push_back(), DetId::rawId(), rechitMaker_, EcalRecHitSimpleAlgo::setADCToGeVConstant(), DetId::subdetId(), edm::EventBase::time(), v_chstatus_, and v_DB_reco_flags_.
{ DetId detid=uncalibRH.id(); EcalChannelStatusMap::const_iterator chit = chStatus->find(detid); EcalChannelStatusCode chStatusCode = 1; if ( chit != chStatus->end() ) { chStatusCode = *chit; } else { edm::LogError("EcalRecHitError") << "No channel status found for xtal " << detid.rawId() << "! something wrong with EcalChannelStatus in your DB? "; } if ( v_chstatus_.size() > 0) { uint16_t code = chStatusCode.getStatusCode() & 0x001F; std::vector<int>::const_iterator res = std::find( v_chstatus_.begin(), v_chstatus_.end(), code ); if ( res != v_chstatus_.end() ) { return false; } } // find the proper flag for the recHit // from a configurable vector // (see cfg file for the association) uint32_t recoFlag = 0; uint16_t statusCode = chStatusCode.getStatusCode() & 0x001F; if ( statusCode < v_DB_reco_flags_.size() ) { // not very nice... recoFlag = v_DB_reco_flags_[ statusCode ]; } else { edm::LogError("EcalRecHitError") << "Flag " << statusCode << " in DB exceed the allowed range of " << v_DB_reco_flags_.size(); } const EcalIntercalibConstantMap& icalMap = ical->getMap(); if ( detid.subdetId() == EcalEndcap ) { rechitMaker_->setADCToGeVConstant( float(agc->getEEValue()) ); } else { rechitMaker_->setADCToGeVConstant( float(agc->getEBValue()) ); } // first intercalibration constants EcalIntercalibConstantMap::const_iterator icalit = icalMap.find(detid); EcalIntercalibConstant icalconst = 1; if( icalit!=icalMap.end() ) { icalconst = (*icalit); } else { edm::LogError("EcalRecHitError") << "No intercalib const found for xtal " << detid.rawId() << "! something wrong with EcalIntercalibConstants in your DB? "; } // get laser coefficient float lasercalib = 1.; if ( laserCorrection_ ) lasercalib = laser->getLaserCorrection( detid, evt.time()); // get time calibration coefficient const EcalTimeCalibConstantMap & itimeMap = itime->getMap(); EcalTimeCalibConstantMap::const_iterator itime = itimeMap.find(detid); EcalTimeCalibConstant itimeconst = 0; if( itime!=itimeMap.end() ) { itimeconst = (*itime); } else { edm::LogError("EcalRecHitError") << "No time calib const found for xtal " << detid.rawId() << "! something wrong with EcalTimeCalibConstants in your DB? "; } // make the rechit and put in the output collection if ( recoFlag <= EcalRecHit::kLeadingEdgeRecovered || !killDeadChannels_ ) { result.push_back(EcalRecHit( rechitMaker_->makeRecHit(uncalibRH, icalconst * lasercalib, itimeconst, recoFlag) )); } return true; }
void EcalRecHitWorkerSimple::set | ( | const edm::EventSetup & | es | ) | [virtual] |
Implements EcalRecHitWorkerBaseClass.
Definition at line 25 of file EcalRecHitWorkerSimple.cc.
References agc, chStatus, edm::EventSetup::get(), ical, itime, laser, and laserCorrection_.
{ es.get<EcalIntercalibConstantsRcd>().get(ical); es.get<EcalTimeCalibConstantsRcd>().get(itime); es.get<EcalADCToGeVConstantRcd>().get(agc); es.get<EcalChannelStatusRcd>().get(chStatus); if ( laserCorrection_ ) es.get<EcalLaserDbRecord>().get(laser); }
edm::ESHandle<EcalADCToGeVConstant> EcalRecHitWorkerSimple::agc [protected] |
Definition at line 37 of file EcalRecHitWorkerSimple.h.
Definition at line 38 of file EcalRecHitWorkerSimple.h.
Definition at line 35 of file EcalRecHitWorkerSimple.h.
Definition at line 36 of file EcalRecHitWorkerSimple.h.
bool EcalRecHitWorkerSimple::killDeadChannels_ [protected] |
Definition at line 42 of file EcalRecHitWorkerSimple.h.
Referenced by EcalRecHitWorkerSimple(), and run().
edm::ESHandle<EcalLaserDbService> EcalRecHitWorkerSimple::laser [protected] |
Definition at line 40 of file EcalRecHitWorkerSimple.h.
bool EcalRecHitWorkerSimple::laserCorrection_ [protected] |
Definition at line 43 of file EcalRecHitWorkerSimple.h.
Referenced by EcalRecHitWorkerSimple(), run(), and set().
EcalRecHitSimpleAlgo* EcalRecHitWorkerSimple::rechitMaker_ [protected] |
Definition at line 45 of file EcalRecHitWorkerSimple.h.
Referenced by EcalRecHitWorkerSimple(), and run().
std::vector<int> EcalRecHitWorkerSimple::v_chstatus_ [protected] |
Definition at line 39 of file EcalRecHitWorkerSimple.h.
Referenced by EcalRecHitWorkerSimple(), and run().
std::vector<int> EcalRecHitWorkerSimple::v_DB_reco_flags_ [protected] |
Definition at line 41 of file EcalRecHitWorkerSimple.h.
Referenced by EcalRecHitWorkerSimple(), and run().