CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EcalSeverityLevelAlgo.cc
Go to the documentation of this file.
1 
15 
19 
21 
22 
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 }
30 
31 
34  const EcalRecHitCollection& rhs) const{
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 }
74 
75 
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 }
94 
95 
96 
97 
98 // Configure (x)emacs for this file ...
99 // Local Variables:
100 // mode:c++
101 // compile-command: "scram b -k"
102 // End:
#define LogDebug(id)
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
EcalSeverityLevelAlgo(const edm::ParameterSet &p)
float timeThresh_
Return kTime only if the rechit is flagged kOutOfTime and E&gt;timeThresh_.
std::vector< T >::const_iterator const_iterator
EcalSeverityLevel severityLevel(const DetId &id, const EcalRecHitCollection &rhs) const
Evaluate status from id.
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.
const_iterator end() const
Definition: DetId.h:20
std::vector< Item >::const_iterator const_iterator
const EcalChannelStatus * chStatus_
bool checkFlagMask(uint32_t mask) const
apply a bitmask to our flags. Experts only
Definition: EcalRecHit.h:103
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.