#include <EcalSeverityLevelAlgo.h>
Public Types | |
enum | EcalSeverityLevel { kGood = 0, kProblematic, kRecovered, kTime, kWeird, kBad } |
Public Member Functions | |
EcalSeverityLevelAlgo (const edm::ParameterSet &p) | |
void | setChannelStatus (const EcalChannelStatus &chs) |
Set the ChannelStatus record. | |
EcalSeverityLevel | severityLevel (const EcalRecHit &rh) const |
Evaluate status from rechit, using its EcalRecHit::Flag. | |
EcalSeverityLevel | severityLevel (const DetId &id, const EcalRecHitCollection &rhs) const |
Evaluate status from id. | |
Private Attributes | |
const EcalChannelStatus * | chStatus_ |
std::vector< uint32_t > | dbstatusMask_ |
Configure which DBStatus::Flag is mapped into which EcalSeverityLevel. | |
std::vector< uint32_t > | flagMask_ |
Configure which EcalRecHit::Flag is mapped into which EcalSeverityLevel. | |
float | timeThresh_ |
Return kTime only if the rechit is flagged kOutOfTime and E>timeThresh_. |
Definition at line 35 of file EcalSeverityLevelAlgo.h.
Levels of severity:
Definition at line 48 of file EcalSeverityLevelAlgo.h.
{ kGood=0, kProblematic, kRecovered, kTime, kWeird, kBad };
EcalSeverityLevelAlgo::EcalSeverityLevelAlgo | ( | const edm::ParameterSet & | p | ) | [explicit] |
Definition at line 23 of file EcalSeverityLevelAlgo.cc.
References chStatus_, dbstatusMask_, flagMask_, edm::ParameterSet::getParameter(), and timeThresh_.
{ flagMask_ = p.getParameter< std::vector<uint32_t> >("flagMask"); dbstatusMask_ = p.getParameter< std::vector<uint32_t> >("dbstatusMask"); timeThresh_ = p.getParameter< double> ("timeThresh"); chStatus_ =0; }
void EcalSeverityLevelAlgo::setChannelStatus | ( | const EcalChannelStatus & | chs | ) | [inline] |
Set the ChannelStatus record.
Definition at line 66 of file EcalSeverityLevelAlgo.h.
References chStatus_.
{chStatus_=&chs;}
EcalSeverityLevelAlgo::EcalSeverityLevel EcalSeverityLevelAlgo::severityLevel | ( | const DetId & | id, |
const EcalRecHitCollection & | rhs | ||
) | const |
Evaluate status from id.
If the id is in the collection, use the EcalRecHit::Flag else use the channelStatus from DB
Definition at line 33 of file EcalSeverityLevelAlgo.cc.
References chStatus_, dbstatusMask_, EcalCondObjectContainer< T >::end(), edm::SortedCollection< T, SORT >::end(), edm::SortedCollection< T, SORT >::find(), EcalCondObjectContainer< T >::find(), i, kGood, LogDebug, and tmp.
Referenced by EcalClusterSeverityLevelAlgo::closestProblematic(), egammaisolation::EgammaRecHitExtractor::collect(), CaloTowersCreationAlgo::convert(), CaloTowersCreationAlgo::ecalChanStatusForCaloTower(), spr::eECALmatrix(), EgammaRecHitIsolation::getSum_(), EcalClusterSeverityLevelAlgo::goodFraction(), HybridClusterAlgo::makeClusters(), InterestingDetIdCollectionProducer::produce(), EcalSeverityLevelService::severityLevel(), and ObjectValidator::validHit().
{ // if the detid is within our rechits, evaluate from flag EcalRecHitCollection::const_iterator rh= rhs.find(id); if ( rh != rhs.end() ) return severityLevel(*rh); // else evaluate from dbstatus if (!chStatus_) edm::LogError("ObjectNotFound") << "Channel Status not set for EcalSeverityLevelAlgo"; EcalChannelStatus::const_iterator chIt = chStatus_->find( id ); uint16_t dbStatus = 0; if ( chIt != chStatus_->end() ) { dbStatus = chIt->getStatusCode(); } else { edm::LogError("ObjectNotFound") << "No channel status found for xtal " << id.rawId() << "! something wrong with EcalChannelStatus in your DB? "; } // kGood==0 we know! if (0==dbStatus) return kGood; // check if the bit corresponding to that dbStatus is set in the mask // This implementation implies that the statuses have a priority for (size_t i=0; i< dbstatusMask_.size();++i){ uint32_t tmp = 0x1<<dbStatus; if (dbstatusMask_[i] & tmp) return EcalSeverityLevel(i); } // no matching LogDebug("EcalSeverityLevelAlgo")<< "Unmatched DB status, returning kGood"; return kGood; }
EcalSeverityLevelAlgo::EcalSeverityLevel EcalSeverityLevelAlgo::severityLevel | ( | const EcalRecHit & | rh | ) | const |
Evaluate status from rechit, using its EcalRecHit::Flag.
Definition at line 77 of file EcalSeverityLevelAlgo.cc.
References EcalRecHit::checkFlag(), EcalRecHit::checkFlagMask(), CaloRecHit::energy(), flagMask_, kBad, kGood, kTime, LogDebug, and timeThresh_.
{ //if marked good, do not do any further test if (rh.checkFlag(kGood)) return kGood; // check if the bit corresponding to that flag is set in the mask // This implementation implies that severities have a priority... for (int sev=kBad;sev>=0;--sev){ if(sev==kTime && rh.energy() < timeThresh_ ) continue; if (rh.checkFlagMask(flagMask_[sev])) return EcalSeverityLevel(sev); } // no matching LogDebug("EcalSeverityLevelAlgo")<< "Unmatched Flag , returning kGood"; return kGood; }
const EcalChannelStatus* EcalSeverityLevelAlgo::chStatus_ [private] |
Definition at line 88 of file EcalSeverityLevelAlgo.h.
Referenced by EcalSeverityLevelAlgo(), setChannelStatus(), and severityLevel().
std::vector<uint32_t> EcalSeverityLevelAlgo::dbstatusMask_ [private] |
Configure which DBStatus::Flag is mapped into which EcalSeverityLevel.
The position in the vector is the EcalSeverityLevel The content defines which EcalRecHit::Flag should be mapped into that EcalSeverityLevel in a bit-wise way
Definition at line 82 of file EcalSeverityLevelAlgo.h.
Referenced by EcalSeverityLevelAlgo(), and severityLevel().
std::vector<uint32_t> EcalSeverityLevelAlgo::flagMask_ [private] |
Configure which EcalRecHit::Flag is mapped into which EcalSeverityLevel.
The position in the vector is the EcalSeverityLevel The content defines which EcalRecHit::Flag should be mapped into that EcalSeverityLevel in a bit-wise way
Definition at line 75 of file EcalSeverityLevelAlgo.h.
Referenced by EcalSeverityLevelAlgo(), and severityLevel().
float EcalSeverityLevelAlgo::timeThresh_ [private] |
Return kTime only if the rechit is flagged kOutOfTime and E>timeThresh_.
Definition at line 86 of file EcalSeverityLevelAlgo.h.
Referenced by EcalSeverityLevelAlgo(), and severityLevel().