CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

HcalRawGains Class Reference

#include <HcalRawGains.h>

List of all members.

Public Types

typedef std::vector< ItemContainer
typedef HcalRawGain Item

Public Member Functions

HcalRawGainaddItem (DetId fId)
 add new (empty) item
void addValues (DetId fId, const HcalRawGain &fValues)
 fill values
std::vector< DetIdgetAllChannels () const
 get list of all available channels
const HcalRawGaingetValues (DetId fId) const
 get value
 HcalRawGains ()
void sort ()
 sort values by channelId
bool sorted () const
 check if data are sorted
 ~HcalRawGains ()

Private Attributes

Container mItems
bool mSorted

Detailed Description

Author:
Fedor Ratnikov (UMd) POOL container to store Gain values 4xCapId $Author: ratnikov
Date:
2006/11/21 03:35:33
Revision:
1.1
Author:
Fedor Ratnikov (UMd) POOL object to store Gain values 4xCapId $Author: ratnikov
Date:
2007/12/04 19:06:24
Revision:
1.4

Definition at line 20 of file HcalRawGains.h.


Member Typedef Documentation

typedef std::vector<Item> HcalRawGains::Container

Definition at line 38 of file HcalRawGains.h.

Definition at line 37 of file HcalRawGains.h.


Constructor & Destructor Documentation

HcalRawGains::HcalRawGains ( )

Definition at line 34 of file HcalRawGains.cc.

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

Definition at line 37 of file HcalRawGains.cc.

{}

Member Function Documentation

HcalRawGain * HcalRawGains::addItem ( DetId  fId)

add new (empty) item

Definition at line 63 of file HcalRawGains.cc.

References mItems, mSorted, and DetId::rawId().

                                             {
  HcalRawGain item (fId.rawId ());
  mItems.push_back (item);
  mSorted = false;
  return &(mItems.back ());
}
void HcalRawGains::addValues ( DetId  fId,
const HcalRawGain fValues 
)

fill values

Definition at line 70 of file HcalRawGains.cc.

References HcalRawGain::getError(), HcalRawGain::getStatus(), HcalRawGain::getValue(), HcalRawGain::getVoltage(), mItems, mSorted, and DetId::rawId().

                                                                   {
  Item item (fId.rawId (), fValues.getValue(), fValues.getError(), fValues.getVoltage(), fValues.getStatus());
  mItems.push_back (item);
  mSorted = false;
}
std::vector< DetId > HcalRawGains::getAllChannels ( ) const

get list of all available channels

Definition at line 54 of file HcalRawGains.cc.

References mItems, and query::result.

                                                     {
  std::vector<DetId> result;
  for (std::vector<Item>::const_iterator item = mItems.begin (); item != mItems.end (); item++) {
    result.push_back (DetId (item->rawId ()));
  }
  return result;
}
const HcalRawGain * HcalRawGains::getValues ( DetId  fId) const

get value

Definition at line 39 of file HcalRawGains.cc.

References pat::BAD, dtNoiseDBValidation_cfg::cerr, spr::find(), mItems, DetId::rawId(), sorted(), and filterCSVwithJSON::target.

                                                           {
  Item target (fId.rawId (), 0, 0, 0, HcalRawGain::BAD);
  std::vector<Item>::const_iterator cell;
  if (sorted ()) {
    cell = std::lower_bound (mItems.begin(), mItems.end(), target, compareItems ());
  }
  else {
    std::cerr << "HcalRawGains::getValues-> container is not sorted. Please sort it to search effectively" << std::endl;
    cell = find (mItems, fId.rawId ());
  }
  if (cell == mItems.end() || cell->rawId () != target.rawId ())
    throw cms::Exception ("Conditions not found") << "Unavailable Raw Gains for cell " << HcalGenericDetId(target.rawId());
  return &(*cell);
}
void HcalRawGains::sort ( )

sort values by channelId

Definition at line 77 of file HcalRawGains.cc.

References mItems, and mSorted.

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

check if data are sorted

Definition at line 29 of file HcalRawGains.h.

References mSorted.

Referenced by getValues().

{return mSorted;}

Member Data Documentation

Definition at line 40 of file HcalRawGains.h.

Referenced by addItem(), addValues(), getAllChannels(), getValues(), and sort().

bool HcalRawGains::mSorted [private]

Definition at line 41 of file HcalRawGains.h.

Referenced by addItem(), addValues(), sort(), and sorted().