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 33 of file EcalSeverityLevelAlgo.h.

Constructor & Destructor Documentation

◆ EcalSeverityLevelAlgo()

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

Definition at line 21 of file EcalSeverityLevelAlgo.cc.

21  {
22  timeThresh_ = p.getParameter<double>("timeThresh");
23  chStatus_ = nullptr;
24 
25  const edm::ParameterSet& ps = p.getParameter<edm::ParameterSet>("flagMask");
26  std::vector<std::string> severities = ps.getParameterNames();
27  std::vector<std::string> flags;
28 
29  flagMask_.resize(severities.size());
30 
31  // read configuration of severities
32 
33  for (unsigned int is = 0; is != severities.size(); ++is) {
35  (EcalSeverityLevel::SeverityLevel)StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severities[is]);
36  flags = ps.getParameter<std::vector<std::string> >(severities[is]);
37  uint32_t mask = 0;
38  for (unsigned int ifi = 0; ifi != flags.size(); ++ifi) {
39  EcalRecHit::Flags f = (EcalRecHit::Flags)StringToEnumValue<EcalRecHit::Flags>(flags[ifi]);
40  //manipulate the mask
41  mask |= (0x1 << f);
42  }
43 
44  flagMask_[snum] = mask;
45  }
46  // read configuration of dbstatus
47 
48  const edm::ParameterSet& dbps = p.getParameter<edm::ParameterSet>("dbstatusMask");
49  std::vector<std::string> dbseverities = dbps.getParameterNames();
50  std::vector<std::string> dbflags;
51 
52  dbstatusMask_.resize(dbseverities.size());
53 
54  for (unsigned int is = 0; is != dbseverities.size(); ++is) {
56  (EcalSeverityLevel::SeverityLevel)StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severities[is]);
57 
58  dbflags = dbps.getParameter<std::vector<std::string> >(severities[is]);
59  uint32_t mask = 0;
60  for (unsigned int ifi = 0; ifi != dbflags.size(); ++ifi) {
62  (EcalChannelStatusCode::Code)StringToEnumValue<EcalChannelStatusCode::Code>(dbflags[ifi]);
63 
64  //manipulate the mask
65  mask |= (0x1 << f);
66  }
67 
68  dbstatusMask_[snum] = mask;
69  }
70 }

References chStatus_, dbstatusMask_, f, flagMask_, HLT_FULL_cff::flags, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNames(), AlCaHLTBitMon_ParallelJobs::p, and timeThresh_.

Member Function Documentation

◆ setChannelStatus()

void EcalSeverityLevelAlgo::setChannelStatus ( const EcalChannelStatus chs)
inline

Set the ChannelStatus record.

Definition at line 49 of file EcalSeverityLevelAlgo.h.

49 { chStatus_ = &chs; }

References chStatus_.

◆ severityLevel() [1/3]

EcalSeverityLevel::SeverityLevel EcalSeverityLevelAlgo::severityLevel ( const DetId id) const

Evaluate status from id use channelStatus from DB.

Definition at line 85 of file EcalSeverityLevelAlgo.cc.

85  {
86  using namespace EcalSeverityLevel;
87 
89 
90  uint16_t dbStatus = chIt->getStatusCode();
91 
92  // kGood==0 we know!
93  if (0 == dbStatus)
94  return kGood;
95 
96  // check if the bit corresponding to that dbStatus is set in the mask
97  // This implementation implies that the statuses have a priority
98  for (size_t i = 0; i < dbstatusMask_.size(); ++i) {
99  uint32_t tmp = 0x1 << dbStatus;
100  if (dbstatusMask_[i] & tmp)
101  return SeverityLevel(i);
102  }
103 
104  // no matching
105  LogDebug("EcalSeverityLevelAlgo") << "Unmatched DB status, returning kGood";
106  return kGood;
107 }

References chStatus_, dbstatusMask_, EcalCondObjectContainer< T >::find(), mps_fire::i, EcalSeverityLevel::kGood, LogDebug, and createJobs::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(), HiSpikeCleaner::produce(), InterestingDetIdFromSuperClusterProducer::produce(), InterestingDetIdCollectionProducer::produce(), L1Analysis::L1AnalysisRecoMet::SetECALFlags(), severityLevel(), and ObjectValidator::validHit().

◆ severityLevel() [2/3]

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 72 of file EcalSeverityLevelAlgo.cc.

73  {
74  using namespace EcalSeverityLevel;
75 
76  // if the detid is within our rechits, evaluate from flag
78  if (rh != rhs.end())
79  return severityLevel(*rh);
80 
81  // else evaluate from dbstatus
82  return severityLevel(id);
83 }

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

◆ severityLevel() [3/3]

EcalSeverityLevel::SeverityLevel EcalSeverityLevelAlgo::severityLevel ( const EcalRecHit rh) const

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

Definition at line 109 of file EcalSeverityLevelAlgo.cc.

109  {
110  using namespace EcalSeverityLevel;
111 
112  //if marked good, do not do any further test
113  if (rh.checkFlag(kGood))
114  return kGood;
115 
116  // check if the bit corresponding to that flag is set in the mask
117  // This implementation implies that severities have a priority...
118  for (int sev = kBad; sev >= 0; --sev) {
119  if (sev == kTime && rh.energy() < timeThresh_)
120  continue;
121  if (rh.checkFlagMask(flagMask_[sev]))
122  return SeverityLevel(sev);
123  }
124 
125  // no matching
126  LogDebug("EcalSeverityLevelAlgo") << "Unmatched Flag , returning kGood";
127  return kGood;
128 }

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

Member Data Documentation

◆ chStatus_

const EcalChannelStatus* EcalSeverityLevelAlgo::chStatus_
private

Definition at line 67 of file EcalSeverityLevelAlgo.h.

Referenced by EcalSeverityLevelAlgo(), setChannelStatus(), and severityLevel().

◆ dbstatusMask_

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 62 of file EcalSeverityLevelAlgo.h.

Referenced by EcalSeverityLevelAlgo(), and severityLevel().

◆ flagMask_

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 56 of file EcalSeverityLevelAlgo.h.

Referenced by EcalSeverityLevelAlgo(), and severityLevel().

◆ timeThresh_

float EcalSeverityLevelAlgo::timeThresh_
private

Return kTime only if the rechit is flagged kOutOfTime and E>timeThresh_.

Definition at line 65 of file EcalSeverityLevelAlgo.h.

Referenced by EcalSeverityLevelAlgo(), and severityLevel().

mps_fire.i
i
Definition: mps_fire.py:428
EcalSeverityLevel::kGood
Definition: EcalSeverityLevel.h:19
edm::SortedCollection< EcalRecHit >::const_iterator
std::vector< EcalRecHit >::const_iterator const_iterator
Definition: SortedCollection.h:80
EcalSeverityLevelAlgo::dbstatusMask_
std::vector< uint32_t > dbstatusMask_
Configure which DBStatus::Flag is mapped into which EcalSeverityLevel.
Definition: EcalSeverityLevelAlgo.h:62
EcalSeverityLevelAlgo::severityLevel
EcalSeverityLevel::SeverityLevel severityLevel(const DetId &id) const
Evaluate status from id use channelStatus from DB.
Definition: EcalSeverityLevelAlgo.cc:85
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
EcalRecHit::Flags
Flags
Definition: EcalRecHit.h:20
EcalRecHit::energy
float energy() const
Definition: EcalRecHit.h:68
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
EcalRecHit::checkFlag
bool checkFlag(int flag) const
check if the flag is true
Definition: EcalRecHit.h:187
EcalCondObjectContainer::find
const_iterator find(uint32_t rawId) const
Definition: EcalCondObjectContainer.h:53
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
edm::ParameterSet
Definition: ParameterSet.h:47
edm::SortedCollection::end
const_iterator end() const
Definition: SortedCollection.h:267
EcalSeverityLevelAlgo::flagMask_
std::vector< uint32_t > flagMask_
Configure which EcalRecHit::Flag is mapped into which EcalSeverityLevel.
Definition: EcalSeverityLevelAlgo.h:56
edm::ParameterSet::getParameterNames
std::vector< std::string > getParameterNames() const
Definition: ParameterSet.cc:663
EcalSeverityLevelAlgo::timeThresh_
float timeThresh_
Return kTime only if the rechit is flagged kOutOfTime and E>timeThresh_.
Definition: EcalSeverityLevelAlgo.h:65
EcalSeverityLevel::SeverityLevel
SeverityLevel
Definition: EcalSeverityLevel.h:18
EcalSeverityLevel
Definition: EcalSeverityLevel.h:16
edm::SortedCollection::find
iterator find(key_type k)
Definition: SortedCollection.h:240
EcalChannelStatusCode::Code
Code
Definition: EcalChannelStatusCode.h:20
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
EcalSeverityLevelAlgo::chStatus_
const EcalChannelStatus * chStatus_
Definition: EcalSeverityLevelAlgo.h:67
EcalCondObjectContainer::const_iterator
std::vector< Item >::const_iterator const_iterator
Definition: EcalCondObjectContainer.h:19
EcalSeverityLevel::kBad
Definition: EcalSeverityLevel.h:24
EcalRecHit::checkFlagMask
bool checkFlagMask(uint32_t mask) const
apply a bitmask to our flags. Experts only
Definition: EcalRecHit.h:204
HLT_FULL_cff.flags
flags
Definition: HLT_FULL_cff.py:13150
EcalSeverityLevel::kTime
Definition: EcalSeverityLevel.h:22