#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 |
double | EBLaserMAX_ |
double | EBLaserMIN_ |
double | EELaserMAX_ |
double | EELaserMIN_ |
edm::ESHandle < EcalIntercalibConstants > | ical |
edm::ESHandle < EcalTimeCalibConstants > | itime |
bool | killDeadChannels_ |
edm::ESHandle< EcalLaserDbService > | laser |
bool | laserCorrection_ |
edm::ESHandle < EcalTimeOffsetConstant > | offtime |
EcalRecHitSimpleAlgo * | rechitMaker_ |
std::vector< int > | v_chstatus_ |
std::vector< int > | v_DB_reco_flags_ |
Definition at line 26 of file EcalRecHitWorkerSimple.h.
EcalRecHitWorkerSimple::EcalRecHitWorkerSimple | ( | const edm::ParameterSet & | ps | ) |
Definition at line 15 of file EcalRecHitWorkerSimple.cc.
References EBLaserMAX_, EBLaserMIN_, EELaserMAX_, EELaserMIN_, 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"); EBLaserMIN_ = ps.getParameter<double>("EBLaserMIN"); EELaserMIN_ = ps.getParameter<double>("EELaserMIN"); EBLaserMAX_ = ps.getParameter<double>("EBLaserMAX"); EELaserMAX_ = ps.getParameter<double>("EELaserMAX"); }
EcalRecHitWorkerSimple::~EcalRecHitWorkerSimple | ( | ) | [virtual] |
Definition at line 130 of file EcalRecHitWorkerSimple.cc.
References rechitMaker_.
{ delete rechitMaker_; }
bool EcalRecHitWorkerSimple::run | ( | const edm::Event & | evt, |
const EcalUncalibratedRecHit & | uncalibRH, | ||
EcalRecHitCollection & | result | ||
) | [virtual] |
Implements EcalRecHitWorkerBaseClass.
Definition at line 44 of file EcalRecHitWorkerSimple.cc.
References agc, chStatus, cond::rpcobgas::detid, EBLaserMAX_, EcalBarrel, EcalEndcap, EELaserMAX_, EcalCondObjectContainer< T >::end(), EcalCondObjectContainer< T >::find(), spr::find(), EcalChannelStatusCode::getStatusCode(), ical, EcalUncalibratedRecHit::id(), itime, killDeadChannels_, EcalRecHit::kLeadingEdgeRecovered, EcalRecHit::kPoorCalib, laser, laserCorrection_, EcalRecHitSimpleAlgo::makeRecHit(), offtime, edm::SortedCollection< T, SORT >::push_back(), DetId::rawId(), rechitMaker_, EcalRecHitSimpleAlgo::setADCToGeVConstant(), EcalRecHit::setFlag(), 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(); } float offsetTime = 0; // the global time phase const EcalIntercalibConstantMap& icalMap = ical->getMap(); if ( detid.subdetId() == EcalEndcap ) { rechitMaker_->setADCToGeVConstant( float(agc->getEEValue()) ); offsetTime = offtime->getEEValue(); } else { rechitMaker_->setADCToGeVConstant( float(agc->getEBValue()) ); offsetTime = offtime->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_) { EcalRecHit myrechit( rechitMaker_->makeRecHit(uncalibRH, icalconst * lasercalib, (itimeconst + offsetTime), /*recoflags_*/ 0) ); if (detid.subdetId() == EcalBarrel && (lasercalib < EBLaserMIN_ || lasercalib > EBLaserMAX_)) myrechit.setFlag(EcalRecHit::kPoorCalib); if (detid.subdetId() == EcalEndcap && (lasercalib < EELaserMIN_ || lasercalib > EELaserMAX_)) myrechit.setFlag(EcalRecHit::kPoorCalib); result.push_back(myrechit); } return true; }
void EcalRecHitWorkerSimple::set | ( | const edm::EventSetup & | es | ) | [virtual] |
Implements EcalRecHitWorkerBaseClass.
Definition at line 32 of file EcalRecHitWorkerSimple.cc.
References agc, chStatus, edm::EventSetup::get(), ical, itime, laser, laserCorrection_, and offtime.
{ es.get<EcalIntercalibConstantsRcd>().get(ical); es.get<EcalTimeCalibConstantsRcd>().get(itime); es.get<EcalTimeOffsetConstantRcd>().get(offtime); 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 47 of file EcalRecHitWorkerSimple.h.
Definition at line 48 of file EcalRecHitWorkerSimple.h.
double EcalRecHitWorkerSimple::EBLaserMAX_ [protected] |
Definition at line 40 of file EcalRecHitWorkerSimple.h.
Referenced by EcalRecHitWorkerSimple(), and run().
double EcalRecHitWorkerSimple::EBLaserMIN_ [protected] |
Definition at line 38 of file EcalRecHitWorkerSimple.h.
Referenced by EcalRecHitWorkerSimple().
double EcalRecHitWorkerSimple::EELaserMAX_ [protected] |
Definition at line 41 of file EcalRecHitWorkerSimple.h.
Referenced by EcalRecHitWorkerSimple(), and run().
double EcalRecHitWorkerSimple::EELaserMIN_ [protected] |
Definition at line 39 of file EcalRecHitWorkerSimple.h.
Referenced by EcalRecHitWorkerSimple().
Definition at line 44 of file EcalRecHitWorkerSimple.h.
Definition at line 45 of file EcalRecHitWorkerSimple.h.
bool EcalRecHitWorkerSimple::killDeadChannels_ [protected] |
Definition at line 54 of file EcalRecHitWorkerSimple.h.
Referenced by EcalRecHitWorkerSimple(), and run().
edm::ESHandle<EcalLaserDbService> EcalRecHitWorkerSimple::laser [protected] |
Definition at line 50 of file EcalRecHitWorkerSimple.h.
bool EcalRecHitWorkerSimple::laserCorrection_ [protected] |
Definition at line 55 of file EcalRecHitWorkerSimple.h.
Referenced by EcalRecHitWorkerSimple(), run(), and set().
Definition at line 46 of file EcalRecHitWorkerSimple.h.
EcalRecHitSimpleAlgo* EcalRecHitWorkerSimple::rechitMaker_ [protected] |
Definition at line 57 of file EcalRecHitWorkerSimple.h.
Referenced by EcalRecHitWorkerSimple(), run(), and ~EcalRecHitWorkerSimple().
std::vector<int> EcalRecHitWorkerSimple::v_chstatus_ [protected] |
Definition at line 49 of file EcalRecHitWorkerSimple.h.
Referenced by EcalRecHitWorkerSimple(), and run().
std::vector<int> EcalRecHitWorkerSimple::v_DB_reco_flags_ [protected] |
Definition at line 52 of file EcalRecHitWorkerSimple.h.
Referenced by EcalRecHitWorkerSimple(), and run().