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

◆ Container

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

Definition at line 38 of file HcalRawGains.h.

◆ Item

Definition at line 37 of file HcalRawGains.h.

Constructor & Destructor Documentation

◆ HcalRawGains()

HcalRawGains::HcalRawGains ( )

Definition at line 34 of file HcalRawGains.cc.

34 : mSorted(false) {}

◆ ~HcalRawGains()

HcalRawGains::~HcalRawGains ( )

Definition at line 36 of file HcalRawGains.cc.

36 {}

Member Function Documentation

◆ addItem()

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

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

◆ addValues()

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

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

◆ getAllChannels()

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

◆ getValues()

const HcalRawGain * HcalRawGains::getValues ( DetId  fId) const

get value

Definition at line 38 of file HcalRawGains.cc.

References HcalRawGain::BAD, DMR_cfg::cerr, spr::find(), pfDeepBoostedJetPreprocessParams_cfi::lower_bound, 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 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
bool sorted() const
check if data are sorted
Definition: HcalRawGains.h:29
Container mItems
Definition: HcalRawGains.h:41
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
HcalRawGain Item
Definition: HcalRawGains.h:37

◆ sort()

void HcalRawGains::sort ( )

sort values by channelId

Definition at line 74 of file HcalRawGains.cc.

References mItems, mSorted, and jetsAK4_CHS_cff::sort.

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

◆ sorted()

bool HcalRawGains::sorted ( ) const
inline

check if data are sorted

Definition at line 29 of file HcalRawGains.h.

References mSorted.

Referenced by getValues().

29 { return mSorted; }

Member Data Documentation

◆ mItems

Container HcalRawGains::mItems
private

Definition at line 41 of file HcalRawGains.h.

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

◆ mSorted

bool HcalRawGains::mSorted
private

Definition at line 42 of file HcalRawGains.h.

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