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.

References chStatus_, dbstatusMask_, f, flagMask_, HLT_2022v12_cff::flags, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNames(), gpuClustering::pixelStatus::mask, AlCaHLTBitMon_ParallelJobs::p, and timeThresh_.

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 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
float timeThresh_
Return kTime only if the rechit is flagged kOutOfTime and E>timeThresh_.
constexpr uint32_t mask
Definition: gpuClustering.h:24
double f[11][100]
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.
std::vector< std::string > getParameterNames() const

Member Function Documentation

◆ setChannelStatus()

void EcalSeverityLevelAlgo::setChannelStatus ( const EcalChannelStatus chs)
inline

Set the ChannelStatus record.

Definition at line 49 of file EcalSeverityLevelAlgo.h.

References chStatus_.

49 { chStatus_ = &chs; }
const EcalChannelStatus * 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.

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(), EgammaIsoDetIdCollectionProducer< T1 >::produce(), InterestingDetIdFromSuperClusterProducer::produce(), InterestingDetIdCollectionProducer::produce(), L1Analysis::L1AnalysisRecoMet::SetECALFlags(), severityLevel(), and ObjectValidator::validHit().

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 }
const_iterator find(uint32_t rawId) const
std::vector< Item >::const_iterator const_iterator
const EcalChannelStatus * chStatus_
std::vector< uint32_t > dbstatusMask_
Configure which DBStatus::Flag is mapped into which EcalSeverityLevel.
tmp
align.sh
Definition: createJobs.py:716
#define LogDebug(id)

◆ 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.

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

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 }
std::vector< EcalRecHit >::const_iterator const_iterator
EcalSeverityLevel::SeverityLevel severityLevel(const DetId &id) const
Evaluate status from id use channelStatus from DB.
const_iterator end() const
iterator find(key_type k)

◆ 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.

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

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 }
float timeThresh_
Return kTime only if the rechit is flagged kOutOfTime and E>timeThresh_.
bool checkFlagMask(uint32_t mask) const
apply a bitmask to our flags. Experts only
Definition: EcalRecHit.h:204
std::vector< uint32_t > flagMask_
Configure which EcalRecHit::Flag is mapped into which EcalSeverityLevel.
float energy() const
Definition: EcalRecHit.h:68
bool checkFlag(int flag) const
check if the flag is true
Definition: EcalRecHit.h:187
#define LogDebug(id)

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