CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
EcalSeverityLevelAlgo Class Reference

#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. More...
 
EcalSeverityLevel severityLevel (const DetId &id, const EcalRecHitCollection &rhs) const
 Evaluate status from id. More...
 
EcalSeverityLevel severityLevel (const EcalRecHit &rh) const
 Evaluate status from rechit, using its EcalRecHit::Flag. More...
 

Private Attributes

const EcalChannelStatuschStatus_
 
std::vector< uint32_t > dbstatusMask_
 Configure which DBStatus::Flag is mapped into which EcalSeverityLevel. More...
 
std::vector< uint32_t > flagMask_
 Configure which EcalRecHit::Flag is mapped into which EcalSeverityLevel. More...
 
float timeThresh_
 Return kTime only if the rechit is flagged kOutOfTime and E>timeThresh_. More...
 

Detailed Description

Definition at line 35 of file EcalSeverityLevelAlgo.h.

Member Enumeration Documentation

Levels of severity:

  • kGood –> good channel
  • kProblematic –> problematic (e.g. noisy)
  • kRecovered –> recovered (e.g. an originally dead or saturated)
  • kTime –> the channel is out of time (e.g. spike)
  • kWeird –> weird (e.g. spike)
  • kBad –> bad, not suitable to be used for reconstruction
Enumerator
kGood 
kProblematic 
kRecovered 
kTime 
kWeird 
kBad 

Definition at line 48 of file EcalSeverityLevelAlgo.h.

Constructor & Destructor Documentation

EcalSeverityLevelAlgo::EcalSeverityLevelAlgo ( const edm::ParameterSet p)
explicit

Definition at line 23 of file EcalSeverityLevelAlgo.cc.

References chStatus_, dbstatusMask_, flagMask_, edm::ParameterSet::getParameter(), and timeThresh_.

23  {
24  flagMask_ = p.getParameter< std::vector<uint32_t> >("flagMask");
25  dbstatusMask_ = p.getParameter< std::vector<uint32_t> >("dbstatusMask");
26  timeThresh_ = p.getParameter< double> ("timeThresh");
27  chStatus_ =0;
28 
29 }
T getParameter(std::string const &) const
float timeThresh_
Return kTime only if the rechit is flagged kOutOfTime and E&gt;timeThresh_.
std::vector< uint32_t > flagMask_
Configure which EcalRecHit::Flag is mapped into which EcalSeverityLevel.
const EcalChannelStatus * chStatus_
std::vector< uint32_t > dbstatusMask_
Configure which DBStatus::Flag is mapped into which EcalSeverityLevel.

Member Function Documentation

void EcalSeverityLevelAlgo::setChannelStatus ( const EcalChannelStatus chs)
inline

Set the ChannelStatus record.

Definition at line 66 of file EcalSeverityLevelAlgo.h.

References chStatus_.

66 {chStatus_=&chs;}
const EcalChannelStatus * chStatus_
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(), EcalCondObjectContainer< T >::find(), edm::SortedCollection< T, SORT >::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().

34  {
35 
36 
37  // if the detid is within our rechits, evaluate from flag
39  if ( rh != rhs.end() )
40  return severityLevel(*rh);
41 
42 
43  // else evaluate from dbstatus
44 
45  if (!chStatus_)
46  edm::LogError("ObjectNotFound") << "Channel Status not set for EcalSeverityLevelAlgo";
47 
48 
50  uint16_t dbStatus = 0;
51  if ( chIt != chStatus_->end() ) {
52  dbStatus = chIt->getStatusCode();
53  } else {
54  edm::LogError("ObjectNotFound") << "No channel status found for xtal "
55  << id.rawId()
56  << "! something wrong with EcalChannelStatus in your DB? ";
57  }
58 
59  // kGood==0 we know!
60  if (0==dbStatus) return kGood;
61 
62  // check if the bit corresponding to that dbStatus is set in the mask
63  // This implementation implies that the statuses have a priority
64  for (size_t i=0; i< dbstatusMask_.size();++i){
65  uint32_t tmp = 0x1<<dbStatus;
66  if (dbstatusMask_[i] & tmp) return EcalSeverityLevel(i);
67  }
68 
69  // no matching
70  LogDebug("EcalSeverityLevelAlgo")<<
71  "Unmatched DB status, returning kGood";
72  return kGood;
73 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
std::vector< T >::const_iterator const_iterator
EcalSeverityLevel severityLevel(const DetId &id, const EcalRecHitCollection &rhs) const
Evaluate status from id.
const_iterator end() const
std::vector< Item >::const_iterator const_iterator
const EcalChannelStatus * chStatus_
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
iterator find(key_type k)
const_iterator find(uint32_t rawId) const
const_iterator end() const
std::vector< uint32_t > dbstatusMask_
Configure which DBStatus::Flag is mapped into which EcalSeverityLevel.
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_.

77  {
78 
79  //if marked good, do not do any further test
80  if (rh.checkFlag(kGood)) return kGood;
81 
82  // check if the bit corresponding to that flag is set in the mask
83  // This implementation implies that severities have a priority...
84  for (int sev=kBad;sev>=0;--sev){
85  if(sev==kTime && rh.energy() < timeThresh_ ) continue;
86  if (rh.checkFlagMask(flagMask_[sev])) return EcalSeverityLevel(sev);
87  }
88 
89  // no matching
90  LogDebug("EcalSeverityLevelAlgo")<< "Unmatched Flag , returning kGood";
91  return kGood;
92 
93 }
#define LogDebug(id)
float timeThresh_
Return kTime only if the rechit is flagged kOutOfTime and E&gt;timeThresh_.
bool checkFlag(int flag) const
check if the flag is true
Definition: EcalRecHit.h:100
float energy() const
Definition: CaloRecHit.h:19
std::vector< uint32_t > flagMask_
Configure which EcalRecHit::Flag is mapped into which EcalSeverityLevel.
bool checkFlagMask(uint32_t mask) const
apply a bitmask to our flags. Experts only
Definition: EcalRecHit.h:103

Member Data Documentation

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().