CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
HcalRawGains Class Reference

#include <HcalRawGains.h>

Public Types

typedef std::vector< ItemContainer
 
typedef HcalRawGain Item
 

Public Member Functions

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

Private Attributes

Container mItems
 
bool mSorted
 

Detailed Description

Author
Fedor Ratnikov (UMd) POOL container to store Gain values 4xCapId $Author: ratnikov
Date
2006/07/29 00:21:32
Revision
1.7
Author
Fedor Ratnikov (UMd) POOL object to store Gain values 4xCapId $Author: ratnikov
Date
2007/01/09 22:49:21
Revision
1.3

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.

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

Definition at line 36 of file HcalRawGains.cc.

36 {}

Member Function Documentation

HcalRawGain * HcalRawGains::addItem ( DetId  fId)

add new (empty) item

Definition at line 61 of file HcalRawGains.cc.

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

Referenced by sorted().

61  {
62  HcalRawGain item(fId.rawId());
63  mItems.push_back(item);
64  mSorted = false;
65  return &(mItems.back());
66 }
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
Container mItems
Definition: HcalRawGains.h:41
void HcalRawGains::addValues ( DetId  fId,
const HcalRawGain fValues 
)

fill values

Definition at line 68 of file HcalRawGains.cc.

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

Referenced by sorted().

68  {
69  Item item(fId.rawId(), fValues.getValue(), fValues.getError(), fValues.getVoltage(), fValues.getStatus());
70  mItems.push_back(item);
71  mSorted = false;
72 }
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
float getValue() const
Definition: HcalRawGain.h:18
float getError() const
Definition: HcalRawGain.h:19
float getVoltage() const
Definition: HcalRawGain.h:20
Container mItems
Definition: HcalRawGains.h:41
HcalRawGain Item
Definition: HcalRawGains.h:37
Status getStatus() const
Definition: HcalRawGain.h:21
std::vector< DetId > HcalRawGains::getAllChannels ( ) const

get list of all available channels

Definition at line 53 of file HcalRawGains.cc.

References B2GTnPMonitor_cfi::item, mItems, and mps_fire::result.

53  {
54  std::vector<DetId> result;
55  for (std::vector<Item>::const_iterator item = mItems.begin(); item != mItems.end(); item++) {
56  result.push_back(DetId(item->rawId()));
57  }
58  return result;
59 }
Container mItems
Definition: HcalRawGains.h:41
Definition: DetId.h:17
const HcalRawGain * HcalRawGains::getValues ( DetId  fId) const

get value

Definition at line 38 of file HcalRawGains.cc.

References HcalRawGain::BAD, beam_dqm_sourceclient-live_cfg::cerr, spr::find(), mItems, DetId::rawId(), sorted(), and filterCSVwithJSON::target.

38  {
39  Item target(fId.rawId(), 0, 0, 0, HcalRawGain::BAD);
40  std::vector<Item>::const_iterator cell;
41  if (sorted()) {
42  cell = std::lower_bound(mItems.begin(), mItems.end(), target, compareItems());
43  } else {
44  std::cerr << "HcalRawGains::getValues-> container is not sorted. Please sort it to search effectively" << std::endl;
45  cell = find(mItems, fId.rawId());
46  }
47  if (cell == mItems.end() || cell->rawId() != target.rawId())
48  throw cms::Exception("Conditions not found")
49  << "Unavailable Raw Gains for cell " << HcalGenericDetId(target.rawId());
50  return &(*cell);
51 }
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
Container mItems
Definition: HcalRawGains.h:41
HcalRawGain Item
Definition: HcalRawGains.h:37
bool sorted() const
check if data are sorted
Definition: HcalRawGains.h:29
void HcalRawGains::sort ( )

sort values by channelId

Definition at line 74 of file HcalRawGains.cc.

References mItems, and mSorted.

Referenced by sorted().

74  {
75  if (!mSorted) {
76  std::sort(mItems.begin(), mItems.end(), compareItems());
77  mSorted = true;
78  }
79 }
Container mItems
Definition: HcalRawGains.h:41
bool HcalRawGains::sorted ( ) const
inline

check if data are sorted

Definition at line 29 of file HcalRawGains.h.

References addItem(), addValues(), mSorted, and sort().

Referenced by getValues().

29 { return mSorted; }

Member Data Documentation

Container HcalRawGains::mItems
private

Definition at line 41 of file HcalRawGains.h.

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

bool HcalRawGains::mSorted
private

Definition at line 42 of file HcalRawGains.h.

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