CMS 3D CMS Logo

Public Types | Public Member Functions | Protected Member Functions | Private Attributes

HcalDcsValues Class Reference

#include <HcalDcsValues.h>

List of all members.

Public Types

typedef std::vector< HcalDcsValueDcsSet
enum  DcsSubDet {
  HcalHB = 1, HcalHE = 2, HcalHO0 = 3, HcalHO12 = 4,
  HcalHF = 5
}

Public Member Functions

bool addValue (HcalDcsValue const &newVal)
bool DcsValuesOK (DcsSubDet subd, int LS=-1)
bool exists (HcalDcsDetId const &fid)
DcsSet const & getAllSubdetValues (DcsSubDet subd) const
DcsSet getValues (HcalDcsDetId const &fid)
 HcalDcsValues ()
std::string myname () const
void sortAll ()
virtual ~HcalDcsValues ()

Protected Member Functions

bool foundDcsId (DcsSet const &valList, HcalDcsDetId const &fid) const
bool sortList (DcsSet &valList) const
bool subDetOk (DcsSet const &valList, int LS) const

Private Attributes

bool mHBsorted
DcsSet mHBValues
bool mHEsorted
DcsSet mHEValues
bool mHFsorted
DcsSet mHFValues
bool mHO0sorted
DcsSet mHO0Values
bool mHO12sorted
DcsSet mHO12Values

Detailed Description

Definition at line 23 of file HcalDcsValues.h.


Member Typedef Documentation

typedef std::vector<HcalDcsValue> HcalDcsValues::DcsSet

Definition at line 25 of file HcalDcsValues.h.


Member Enumeration Documentation

Enumerator:
HcalHB 
HcalHE 
HcalHO0 
HcalHO12 
HcalHF 

Definition at line 28 of file HcalDcsValues.h.

                { HcalHB = 1, HcalHE = 2, HcalHO0 = 3, HcalHO12 = 4,
                  HcalHF = 5 };

Constructor & Destructor Documentation

HcalDcsValues::HcalDcsValues ( )

Definition at line 5 of file HcalDcsValues.cc.

                             : 
  mHBsorted(false),mHEsorted(false),mHO0sorted(false), mHO12sorted(false),
  mHFsorted(false) {
}
HcalDcsValues::~HcalDcsValues ( ) [virtual]

Definition at line 10 of file HcalDcsValues.cc.

                              {
}

Member Function Documentation

bool HcalDcsValues::addValue ( HcalDcsValue const &  newVal)

Definition at line 13 of file HcalDcsValues.cc.

References HcalDcsValue::DcsId(), HcalDcsBarrel, HcalDcsEndcap, HcalDcsForward, HcalDcsOuter, mHBsorted, mHBValues, mHEsorted, mHEValues, mHFsorted, mHFValues, mHO0sorted, mHO0Values, mHO12sorted, and mHO12Values.

                                                       {
  HcalDcsDetId tempId( newVal.DcsId() );
  switch (tempId.subdet()) {
  case HcalDcsBarrel :
    mHBValues.push_back(newVal);
    mHBsorted=false;
    return true;
  case HcalDcsEndcap :
    mHEValues.push_back(newVal);
    mHEsorted=false;
    return true;
  case HcalDcsOuter :
    if (tempId.ring() == 0) {
      mHO0Values.push_back(newVal);
      mHO0sorted=false;
    } else {
      mHO12Values.push_back(newVal);
      mHO12sorted=false;
    }
    return true;
  case HcalDcsForward :
    mHFValues.push_back(newVal);
    mHFsorted=false;
    return true;
  default : 
    return false;
  }
}
bool HcalDcsValues::DcsValuesOK ( DcsSubDet  subd,
int  LS = -1 
)

Definition at line 166 of file HcalDcsValues.cc.

References HcalHB, HcalHE, HcalHF, HcalHO0, HcalHO12, mHBsorted, mHBValues, mHEsorted, mHEValues, mHFsorted, mHFValues, mHO0sorted, mHO0Values, mHO12sorted, mHO12Values, sortList(), and subDetOk().

                                                      {
  switch (subd) {
  case HcalHB : 
    if (!mHBsorted) mHBsorted = sortList(mHBValues);
    return subDetOk(mHBValues, LS);
  case HcalHE : 
    if (!mHEsorted) mHEsorted = sortList(mHEValues);
    return subDetOk(mHEValues, LS);
  case HcalHO0 : 
    if (!mHO0sorted) mHO0sorted = sortList(mHO0Values);
    return subDetOk(mHO0Values, LS);
  case HcalHO12 : 
    if (!mHO12sorted) mHO12sorted = sortList(mHO12Values);
    return subDetOk(mHO12Values, LS);
  case HcalHF : 
    if (!mHFsorted) mHFsorted = sortList(mHFValues);
    return subDetOk(mHFValues, LS);
  default : return false;
  }
  return false;
}
bool HcalDcsValues::exists ( HcalDcsDetId const &  fid)
bool HcalDcsValues::foundDcsId ( DcsSet const &  valList,
HcalDcsDetId const &  fid 
) const [protected]

Definition at line 188 of file HcalDcsValues.cc.

References DetId::rawId().

Referenced by exists().

                                                              {
  HcalDcsValue dummy(fid.rawId(), -1, 0., 0., 0.);
  DcsSet::const_iterator lb = lower_bound(valList.begin(), valList.end(), dummy);
  if ((lb != valList.end()) && (lb->DcsId() == fid.rawId()))
    return true;
  return false;
}
HcalDcsValues::DcsSet const & HcalDcsValues::getAllSubdetValues ( DcsSubDet  subd) const

Definition at line 155 of file HcalDcsValues.cc.

References HcalHB, HcalHE, HcalHF, HcalHO0, HcalHO12, mHBValues, mHEValues, mHFValues, mHO0Values, and mHO12Values.

                                                                                  {
  switch (subd) {
  case HcalHB : return mHBValues;
  case HcalHE : return mHEValues;
  case HcalHO0 : return mHO0Values;
  case HcalHO12 : return mHO12Values;
  case HcalHF : return mHFValues;
  }
  return mHBValues;
}
HcalDcsValues::DcsSet HcalDcsValues::getValues ( HcalDcsDetId const &  fid)

Definition at line 73 of file HcalDcsValues.cc.

References HcalDcsBarrel, HcalDcsEndcap, HcalDcsForward, HcalDcsOuter, mHBsorted, mHBValues, mHEsorted, mHEValues, mHFsorted, mHFValues, mHO0sorted, mHO0Values, mHO12sorted, mHO12Values, DetId::rawId(), HcalDcsDetId::ring(), sortList(), and HcalOtherDetId::subdet().

                                                                    {
  DcsSet * valList = 0;
  switch(fid.subdet()) {
  case HcalDcsBarrel : 
    valList = &mHBValues; 
    if (!mHBsorted) mHBsorted = sortList(mHBValues);
    break;
  case HcalDcsEndcap : 
    valList = &mHEValues; 
    if (!mHEsorted) mHEsorted = sortList(mHEValues);
    break;
  case HcalDcsOuter :
    if (fid.ring() == 0) {
      valList = &mHO0Values;
      if (!mHO0sorted) mHO0sorted = sortList(mHO0Values);
    } else {
      valList = &mHO12Values;
      if (!mHO12sorted) mHO12sorted = sortList(mHO12Values);
    }
    break;
  case HcalDcsForward : 
    valList = &mHFValues; 
    if (!mHFsorted) mHFsorted = sortList(mHFValues);
    break;
  default : valList = 0;
  }

  if (valList) {
    HcalDcsValue dummy(fid.rawId(), -1, 0., 0., 0.);
    DcsSet::const_iterator lb = lower_bound(valList->begin(), valList->end(), dummy);
    if ((lb != valList->end()) && (lb->DcsId() == fid.rawId())) {
      DcsSet::const_iterator ub = upper_bound(valList->begin(), valList->end(), dummy);
      return DcsSet(lb, ub) ;
    }
  }
  return DcsSet() ;
}
std::string HcalDcsValues::myname ( ) const [inline]

Definition at line 45 of file HcalDcsValues.h.

{ return (std::string)"HcalDcsValues"; }
void HcalDcsValues::sortAll ( )
bool HcalDcsValues::sortList ( DcsSet valList) const [protected]

Definition at line 213 of file HcalDcsValues.cc.

References python::multivaluedict::sort().

Referenced by DcsValuesOK(), exists(), getValues(), and sortAll().

                                                  {
  sort(valList.begin(), valList.end());
  return true;
}
bool HcalDcsValues::subDetOk ( DcsSet const &  valList,
int  LS 
) const [protected]

Definition at line 197 of file HcalDcsValues.cc.

Referenced by DcsValuesOK().

                                                                {
  std::set<uint32_t> badIds;
  DcsSet::const_iterator val = valList.begin();
  while ( (val != valList.end()) &&
          ( (LS>-1) ? (val->LS()<=LS) : true) ) {
    if (!val->isValueGood()) {
      badIds.insert(val->DcsId());
    } else {
      std::set<uint32_t>::iterator fnd = badIds.find(val->DcsId());
      if (*fnd == val->DcsId()) badIds.erase(fnd);
    }
    ++val;
  }
  return (badIds.size()==0);
}

Member Data Documentation

bool HcalDcsValues::mHBsorted [mutable, private]

Definition at line 59 of file HcalDcsValues.h.

Referenced by addValue(), DcsValuesOK(), exists(), getValues(), and sortAll().

Definition at line 58 of file HcalDcsValues.h.

Referenced by addValue(), DcsValuesOK(), exists(), getAllSubdetValues(), getValues(), and sortAll().

bool HcalDcsValues::mHEsorted [mutable, private]

Definition at line 61 of file HcalDcsValues.h.

Referenced by addValue(), DcsValuesOK(), exists(), getValues(), and sortAll().

Definition at line 60 of file HcalDcsValues.h.

Referenced by addValue(), DcsValuesOK(), exists(), getAllSubdetValues(), getValues(), and sortAll().

bool HcalDcsValues::mHFsorted [mutable, private]

Definition at line 67 of file HcalDcsValues.h.

Referenced by addValue(), DcsValuesOK(), exists(), getValues(), and sortAll().

Definition at line 66 of file HcalDcsValues.h.

Referenced by addValue(), DcsValuesOK(), exists(), getAllSubdetValues(), getValues(), and sortAll().

bool HcalDcsValues::mHO0sorted [mutable, private]

Definition at line 63 of file HcalDcsValues.h.

Referenced by addValue(), DcsValuesOK(), exists(), getValues(), and sortAll().

Definition at line 62 of file HcalDcsValues.h.

Referenced by addValue(), DcsValuesOK(), exists(), getAllSubdetValues(), getValues(), and sortAll().

bool HcalDcsValues::mHO12sorted [mutable, private]

Definition at line 65 of file HcalDcsValues.h.

Referenced by addValue(), DcsValuesOK(), exists(), getValues(), and sortAll().

Definition at line 64 of file HcalDcsValues.h.

Referenced by addValue(), DcsValuesOK(), exists(), getAllSubdetValues(), getValues(), and sortAll().