CMS 3D CMS Logo

Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes

HcalDQMChannelQuality Class Reference

#include <HcalDQMChannelQuality.h>

List of all members.

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

Enumerator:
UNKNOWN 
BAD 
GOOD 
COOL 
HOT 
DEAD 
END 

Definition at line 12 of file HcalDQMChannelQuality.h.

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

Constructor & Destructor Documentation

HcalDQMChannelQuality::HcalDQMChannelQuality ( )

Definition at line 6 of file HcalDQMChannelQuality.cc.

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

Definition at line 9 of file HcalDQMChannelQuality.cc.

{}

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 benchmark_cfg::cerr, spr::find(), HcalDQMChannelQuality::Item::mId, mItems, sorted(), and filterCSVwithJSON::target.

                                                                                     {

  Item target;
  target.mId = fId;
  std::vector<Item>::const_iterator cell;
  if (sorted ()) {
    cell = std::lower_bound (mItems.begin(), mItems.end(), target);
  }
  else {
    if (fWarning) std::cerr << "HcalDQMChannelQuality::quality-> container is not sorted. Sort it to search effectively" << std::endl;
    cell = std::find (mItems.begin(), mItems.end(), target);
  }
  if (cell == mItems.end() || cell->mId != fId)
    throw cms::Exception ("Conditions not found") << "Unavailable Quality for cell " << fId;
  return cell->mAlgo;

}
std::vector< unsigned long > HcalDQMChannelQuality::getAllChannels ( ) const

Definition at line 63 of file HcalDQMChannelQuality.cc.

References mItems, and query::result.

                                                                      {
  std::vector<unsigned long> result;
  for (std::vector<Item>::const_iterator item = mItems.begin (); item != mItems.end (); item++) {
    result.push_back (item->mId);
  }
  return result;
}
bool HcalDQMChannelQuality::isMasked ( unsigned long  fId,
bool  fWarning = true 
) const

Definition at line 27 of file HcalDQMChannelQuality.cc.

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

                                                                           {

  Item target;
  target.mId = fId;
  std::vector<Item>::const_iterator cell;
  if (sorted ()) {
    cell = std::lower_bound (mItems.begin(), mItems.end(), target);
  }
  else {
    if (fWarning) std::cerr << "HcalDQMChannelQuality::quality-> container is not sorted. Sort it to search effectively" << std::endl;
    cell = std::find (mItems.begin(), mItems.end(), target);
  }
  if (cell == mItems.end() || cell->mId != fId)
    throw cms::Exception ("Conditions not found") << "Unavailable Quality for cell " << fId;
  return cell->mMasked;
  
}
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().

                                                           {
  switch (fQuality) {
  case BAD: return true;
  case HOT: return  true;
  case GOOD: return false;
  case COOL: return false;
  case DEAD: return false;
  case END: return false;
  default: return false;
  }
}
HcalDQMChannelQuality::Quality HcalDQMChannelQuality::quality ( unsigned long  fId,
bool  fWarning = true 
) const

Definition at line 11 of file HcalDQMChannelQuality.cc.

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

                                                                                                   {
  Item target;
  target.mId = fId;
  std::vector<Item>::const_iterator cell;
  if (sorted ()) {
    cell = std::lower_bound (mItems.begin(), mItems.end(), target);
  }
  else {
    if (fWarning) std::cerr << "HcalDQMChannelQuality::quality-> container is not sorted. Sort it to search effectively" << std::endl;
    cell = std::find (mItems.begin(), mItems.end(), target);
  }
  if (cell == mItems.end() || cell->mId != fId)
    throw cms::Exception ("Conditions not found") << "Unavailable Quality for cell " << fId;
  return (HcalDQMChannelQuality::Quality) cell->mQuality;
}
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.

                                                                                                 {
  Item item;
  item.mId = fId;
  item.mAlgo = fAlgo;
  item.mMasked = maskCell(fQuality);
  item.mQuality = unsigned (fQuality);
  mSorted = false;
  return true;
}
void HcalDQMChannelQuality::sort ( )

Definition at line 93 of file HcalDQMChannelQuality.cc.

References mItems, and mSorted.

                                  {
  if (!mSorted) {
    std::sort (mItems.begin(), mItems.end());
    mSorted = true;
  }
}
bool HcalDQMChannelQuality::sorted ( ) const [inline]

Definition at line 31 of file HcalDQMChannelQuality.h.

References mSorted.

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

{return mSorted;}
const char * HcalDQMChannelQuality::str ( Quality  fQuality) [static]

Definition at line 100 of file HcalDQMChannelQuality.cc.

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

                                                        {
  switch (fQuality) {
  case BAD: return "BAD";
  case GOOD: return "GOOD";
  case COOL: return "COOL";
  case HOT: return "HOT";
  case DEAD: return "DEAD";
  case END: return "END";
  default: return "UNKNOWN";
  }
}

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

Definition at line 50 of file HcalDQMChannelQuality.h.

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