CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
EcalSeverityLevelAlgo Class Reference

#include <EcalSeverityLevelAlgo.h>

Public Member Functions

 EcalSeverityLevelAlgo (const edm::ParameterSet &p)
 
void setChannelStatus (const EcalChannelStatus &chs)
 Set the ChannelStatus record. More...
 
EcalSeverityLevel::SeverityLevel severityLevel (const DetId &id) const
 Evaluate status from id use channelStatus from DB. More...
 
EcalSeverityLevel::SeverityLevel severityLevel (const DetId &id, const EcalRecHitCollection &rhs) const
 
EcalSeverityLevel::SeverityLevel 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.

Constructor & Destructor Documentation

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

Definition at line 23 of file EcalSeverityLevelAlgo.cc.

References chStatus_, dbstatusMask_, f, flagMask_, flags, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNames(), RecoTauDiscriminantConfiguration::mask, and timeThresh_.

23  {
24 
25 
26  timeThresh_ = p.getParameter< double> ("timeThresh");
27  chStatus_ =nullptr;
28 
29  const edm::ParameterSet & ps=p.getParameter< edm::ParameterSet >("flagMask");
30  std::vector<std::string> severities = ps.getParameterNames();
31  std::vector<std::string> flags;
32 
33  flagMask_.resize(severities.size());
34 
35  // read configuration of severities
36 
37  for (unsigned int is=0;is!=severities.size();++is){
38 
40  (EcalSeverityLevel::SeverityLevel) StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severities[is]);
41  flags=ps.getParameter<std::vector<std::string> >(severities[is]);
42  uint32_t mask=0;
43  for (unsigned int ifi=0;ifi!=flags.size();++ifi){
45  (EcalRecHit::Flags)StringToEnumValue<EcalRecHit::Flags>(flags[ifi]);
46  //manipulate the mask
47  mask|=(0x1<<f);
48  }
49 
50  flagMask_[snum]=mask;
51  }
52  // read configuration of dbstatus
53 
54  const edm::ParameterSet & dbps=
55  p.getParameter< edm::ParameterSet >("dbstatusMask");
56  std::vector<std::string> dbseverities = dbps.getParameterNames();
57  std::vector<std::string> dbflags;
58 
59  dbstatusMask_.resize(dbseverities.size());
60 
61  for (unsigned int is=0;is!=dbseverities.size();++is){
62 
64  (EcalSeverityLevel::SeverityLevel) StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severities[is]);
65 
66  dbflags=dbps.getParameter<std::vector<std::string> >(severities[is]);
67  uint32_t mask=0;
68  for (unsigned int ifi=0;ifi!=dbflags.size();++ifi){
70  (EcalChannelStatusCode::Code)StringToEnumValue<EcalChannelStatusCode::Code>(dbflags[ifi]);
71 
72  //manipulate the mask
73  mask|=(0x1<<f);
74  }
75 
76  dbstatusMask_[snum]=mask;
77  }
78 
79 
80 }
T getParameter(std::string const &) const
float timeThresh_
Return kTime only if the rechit is flagged kOutOfTime and E>timeThresh_.
std::vector< Variable::Flags > flags
Definition: MVATrainer.cc:135
double f[11][100]
std::vector< std::string > getParameterNames() const
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 60 of file EcalSeverityLevelAlgo.h.

References chStatus_.

Referenced by EcalSeverityLevelESProducer::setupChannelStatus().

60 {chStatus_=&chs;}
const EcalChannelStatus * chStatus_
EcalSeverityLevel::SeverityLevel EcalSeverityLevelAlgo::severityLevel ( const DetId id) const

Evaluate status from id use channelStatus from DB.

Definition at line 101 of file EcalSeverityLevelAlgo.cc.

References chStatus_, dbstatusMask_, EcalCondObjectContainer< T >::find(), mps_fire::i, EcalSeverityLevel::kGood, LogDebug, and tmp.

Referenced by CaloTowersCreationAlgo::assignHitEcal(), EcalClusterSeverityLevelAlgo::closestProblematic(), egammaisolation::EgammaRecHitExtractor::collect(), CaloTowersCreationAlgo::ecalChanStatusForCaloTower(), spr::eECALmatrix(), spr::energyECAL(), EgammaRecHitIsolation::getSum_(), EcalClusterSeverityLevelAlgo::goodFraction(), HybridClusterAlgo::makeClusters(), CaloTowersCreationAlgo::makeEcalBadChs(), EleIsoDetIdCollectionProducer::produce(), GamIsoDetIdCollectionProducer::produce(), InterestingDetIdCollectionProducer::produce(), InterestingDetIdFromSuperClusterProducer::produce(), HiSpikeCleaner::produce(), L1Analysis::L1AnalysisRecoMet::SetECALFlags(), EcalSeverityLevelService::severityLevel(), severityLevel(), and ObjectValidator::validHit().

101  {
102 
103  using namespace EcalSeverityLevel;
104 
105 
107 
108  uint16_t dbStatus = chIt->getStatusCode();
109 
110  // kGood==0 we know!
111  if (0==dbStatus) return kGood;
112 
113  // check if the bit corresponding to that dbStatus is set in the mask
114  // This implementation implies that the statuses have a priority
115  for (size_t i=0; i< dbstatusMask_.size();++i){
116  uint32_t tmp = 0x1<<dbStatus;
117  if (dbstatusMask_[i] & tmp) return SeverityLevel(i);
118  }
119 
120  // no matching
121  LogDebug("EcalSeverityLevelAlgo")<<
122  "Unmatched DB status, returning kGood";
123  return kGood;
124 }
#define LogDebug(id)
std::vector< Item >::const_iterator const_iterator
const EcalChannelStatus * chStatus_
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
const_iterator find(uint32_t rawId) const
std::vector< uint32_t > dbstatusMask_
Configure which DBStatus::Flag is mapped into which EcalSeverityLevel.
EcalSeverityLevel::SeverityLevel EcalSeverityLevelAlgo::severityLevel ( const DetId id,
const EcalRecHitCollection rhs 
) const

If the id is in the collection, use the EcalRecHit::Flag else use the channelStatus from DB

Definition at line 84 of file EcalSeverityLevelAlgo.cc.

References edm::SortedCollection< T, SORT >::end(), edm::SortedCollection< T, SORT >::find(), and severityLevel().

85  {
86 
87  using namespace EcalSeverityLevel;
88 
89  // if the detid is within our rechits, evaluate from flag
91  if ( rh != rhs.end() )
92  return severityLevel(*rh);
93 
94 
95  // else evaluate from dbstatus
96  return severityLevel(id);
97 
98 }
EcalSeverityLevel::SeverityLevel severityLevel(const DetId &id) const
Evaluate status from id use channelStatus from DB.
std::vector< EcalRecHit >::const_iterator const_iterator
const_iterator end() const
iterator find(key_type k)
EcalSeverityLevel::SeverityLevel EcalSeverityLevelAlgo::severityLevel ( const EcalRecHit rh) const

Evaluate status from rechit, using its EcalRecHit::Flag.

Definition at line 128 of file EcalSeverityLevelAlgo.cc.

References EcalRecHit::checkFlag(), EcalRecHit::checkFlagMask(), EcalRecHit::energy(), flagMask_, EcalSeverityLevel::kBad, EcalSeverityLevel::kGood, EcalSeverityLevel::kTime, LogDebug, and timeThresh_.

128  {
129 
130  using namespace EcalSeverityLevel;
131 
132  //if marked good, do not do any further test
133  if (rh.checkFlag(kGood)) return kGood;
134 
135  // check if the bit corresponding to that flag is set in the mask
136  // This implementation implies that severities have a priority...
137  for (int sev=kBad;sev>=0;--sev){
138  if(sev==kTime && rh.energy() < timeThresh_ ) continue;
139  if (rh.checkFlagMask(flagMask_[sev])) return SeverityLevel(sev);
140  }
141 
142  // no matching
143  LogDebug("EcalSeverityLevelAlgo")<< "Unmatched Flag , returning kGood";
144  return kGood;
145 
146 }
#define LogDebug(id)
float timeThresh_
Return kTime only if the rechit is flagged kOutOfTime and E>timeThresh_.
bool checkFlag(int flag) const
check if the flag is true
Definition: EcalRecHit.h:189
float energy() const
Definition: EcalRecHit.h:68
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:203

Member Data Documentation

const EcalChannelStatus* EcalSeverityLevelAlgo::chStatus_
private

Definition at line 82 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 76 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 69 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 80 of file EcalSeverityLevelAlgo.h.

Referenced by EcalSeverityLevelAlgo(), and severityLevel().