test
CMS 3D CMS Logo

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

#include <HcalDQMChannelQuality.h>

Classes

class  Item
 

Public Types

enum  Quality {
  UNKNOWN = 0, BAD = 1, GOOD = 2, COOL = 3,
  HOT = 4, DEAD = 5, END = 6
}
 

Public Member Functions

std::string comment (unsigned long fId, bool fWarning=true) const
 
unsigned short flagAlgo (unsigned long fId, bool fWarning=true) const
 
std::vector< unsigned long > getAllChannels () const
 
 HcalDQMChannelQuality ()
 
bool isMasked (unsigned long fId, bool fWarning=true) const
 
bool maskCell (Quality fQual) const
 
Quality quality (unsigned long fId, bool fWarning=true) const
 
bool setChannel (unsigned long fId, unsigned short algo, Quality fQuality=UNKNOWN)
 
void sort ()
 
bool sorted () const
 
 ~HcalDQMChannelQuality ()
 

Static Public Member Functions

static const char * str (Quality fQuality)
 

Protected Attributes

std::vector< ItemmItems
 
bool mSorted
 

Detailed Description

Definition at line 10 of file HcalDQMChannelQuality.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

HcalDQMChannelQuality::HcalDQMChannelQuality ( )

Definition at line 6 of file HcalDQMChannelQuality.cc.

7  : mSorted (false) {}
HcalDQMChannelQuality::~HcalDQMChannelQuality ( )

Definition at line 9 of file HcalDQMChannelQuality.cc.

9 {}

Member Function Documentation

std::string HcalDQMChannelQuality::comment ( unsigned long  fId,
bool  fWarning = true 
) const
unsigned short HcalDQMChannelQuality::flagAlgo ( unsigned long  fId,
bool  fWarning = true 
) const

Definition at line 45 of file HcalDQMChannelQuality.cc.

References ecal_dqm_sourceclient-live_cfg::cerr, spr::find(), HcalDQMChannelQuality::Item::mId, mItems, sorted(), and filterCSVwithJSON::target.

45  {
46 
47  Item target;
48  target.mId = fId;
49  std::vector<Item>::const_iterator cell;
50  if (sorted ()) {
51  cell = std::lower_bound (mItems.begin(), mItems.end(), target);
52  }
53  else {
54  if (fWarning) std::cerr << "HcalDQMChannelQuality::quality-> container is not sorted. Sort it to search effectively" << std::endl;
55  cell = std::find (mItems.begin(), mItems.end(), target);
56  }
57  if (cell == mItems.end() || cell->mId != fId)
58  throw cms::Exception ("Conditions not found") << "Unavailable Quality for cell " << fId;
59  return cell->mAlgo;
60 
61 }
std::vector< Item > mItems
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
std::vector< unsigned long > HcalDQMChannelQuality::getAllChannels ( ) const

Definition at line 63 of file HcalDQMChannelQuality.cc.

References mItems, and mps_fire::result.

63  {
64  std::vector<unsigned long> result;
65  for (std::vector<Item>::const_iterator item = mItems.begin (); item != mItems.end (); item++) {
66  result.push_back (item->mId);
67  }
68  return result;
69 }
std::vector< Item > mItems
tuple result
Definition: mps_fire.py:84
bool HcalDQMChannelQuality::isMasked ( unsigned long  fId,
bool  fWarning = true 
) const

Definition at line 27 of file HcalDQMChannelQuality.cc.

References ecal_dqm_sourceclient-live_cfg::cerr, spr::find(), HcalDQMChannelQuality::Item::mId, mItems, sorted(), and filterCSVwithJSON::target.

27  {
28 
29  Item target;
30  target.mId = fId;
31  std::vector<Item>::const_iterator cell;
32  if (sorted ()) {
33  cell = std::lower_bound (mItems.begin(), mItems.end(), target);
34  }
35  else {
36  if (fWarning) std::cerr << "HcalDQMChannelQuality::quality-> container is not sorted. Sort it to search effectively" << std::endl;
37  cell = std::find (mItems.begin(), mItems.end(), target);
38  }
39  if (cell == mItems.end() || cell->mId != fId)
40  throw cms::Exception ("Conditions not found") << "Unavailable Quality for cell " << fId;
41  return cell->mMasked;
42 
43 }
std::vector< Item > mItems
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
bool HcalDQMChannelQuality::maskCell ( Quality  fQual) const

Definition at line 81 of file HcalDQMChannelQuality.cc.

References BAD, COOL, DEAD, END, GOOD, and HOT.

Referenced by setChannel().

81  {
82  switch (fQuality) {
83  case BAD: return true;
84  case HOT: return true;
85  case GOOD: return false;
86  case COOL: return false;
87  case DEAD: return false;
88  case END: return false;
89  default: return false;
90  }
91 }
HcalDQMChannelQuality::Quality HcalDQMChannelQuality::quality ( unsigned long  fId,
bool  fWarning = true 
) const

Definition at line 11 of file HcalDQMChannelQuality.cc.

References ecal_dqm_sourceclient-live_cfg::cerr, spr::find(), HcalDQMChannelQuality::Item::mId, mItems, sorted(), and filterCSVwithJSON::target.

11  {
12  Item target;
13  target.mId = fId;
14  std::vector<Item>::const_iterator cell;
15  if (sorted ()) {
16  cell = std::lower_bound (mItems.begin(), mItems.end(), target);
17  }
18  else {
19  if (fWarning) std::cerr << "HcalDQMChannelQuality::quality-> container is not sorted. Sort it to search effectively" << std::endl;
20  cell = std::find (mItems.begin(), mItems.end(), target);
21  }
22  if (cell == mItems.end() || cell->mId != fId)
23  throw cms::Exception ("Conditions not found") << "Unavailable Quality for cell " << fId;
24  return (HcalDQMChannelQuality::Quality) cell->mQuality;
25 }
std::vector< Item > mItems
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
bool HcalDQMChannelQuality::setChannel ( unsigned long  fId,
unsigned short  algo,
Quality  fQuality = UNKNOWN 
)

Definition at line 71 of file HcalDQMChannelQuality.cc.

References HcalDQMChannelQuality::Item::mAlgo, maskCell(), HcalDQMChannelQuality::Item::mId, HcalDQMChannelQuality::Item::mMasked, HcalDQMChannelQuality::Item::mQuality, and mSorted.

71  {
72  Item item;
73  item.mId = fId;
74  item.mAlgo = fAlgo;
75  item.mMasked = maskCell(fQuality);
76  item.mQuality = unsigned (fQuality);
77  mSorted = false;
78  return true;
79 }
bool maskCell(Quality fQual) const
void HcalDQMChannelQuality::sort ( )

Definition at line 93 of file HcalDQMChannelQuality.cc.

References mItems, and mSorted.

93  {
94  if (!mSorted) {
95  std::sort (mItems.begin(), mItems.end());
96  mSorted = true;
97  }
98 }
std::vector< Item > mItems
bool HcalDQMChannelQuality::sorted ( ) const
inline

Definition at line 31 of file HcalDQMChannelQuality.h.

References mSorted.

Referenced by flagAlgo(), isMasked(), and quality().

const char * HcalDQMChannelQuality::str ( Quality  fQuality)
static

Definition at line 100 of file HcalDQMChannelQuality.cc.

References BAD, COOL, DEAD, END, GOOD, and HOT.

100  {
101  switch (fQuality) {
102  case BAD: return "BAD";
103  case GOOD: return "GOOD";
104  case COOL: return "COOL";
105  case HOT: return "HOT";
106  case DEAD: return "DEAD";
107  case END: return "END";
108  default: return "UNKNOWN";
109  }
110 }

Member Data Documentation

std::vector<Item> HcalDQMChannelQuality::mItems
protected

Definition at line 49 of file HcalDQMChannelQuality.h.

Referenced by flagAlgo(), getAllChannels(), isMasked(), quality(), and sort().

bool HcalDQMChannelQuality::mSorted
protected

Definition at line 50 of file HcalDQMChannelQuality.h.

Referenced by setChannel(), sort(), and sorted().