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.

61  {
62  HcalRawGain item(fId.rawId());
63  mItems.push_back(item);
64  mSorted = false;
65  return &(mItems.back());
66 }

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

◆ addValues()

void HcalRawGains::addValues ( DetId  fId,
const HcalRawGain fValues 
)

fill values

Definition at line 68 of file HcalRawGains.cc.

68  {
69  Item item(fId.rawId(), fValues.getValue(), fValues.getError(), fValues.getVoltage(), fValues.getStatus());
70  mItems.push_back(item);
71  mSorted = false;
72 }

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

◆ getAllChannels()

std::vector< DetId > HcalRawGains::getAllChannels ( ) const

get list of all available channels

Definition at line 53 of file HcalRawGains.cc.

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 }

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

◆ getValues()

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

get value

Definition at line 38 of file HcalRawGains.cc.

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 }

References HcalRawGain::BAD, EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, spr::find(), pfDeepBoostedJetPreprocessParams_cfi::lower_bound, mItems, DetId::rawId(), sorted(), and filterCSVwithJSON::target.

◆ sort()

void HcalRawGains::sort ( )

sort values by channelId

Definition at line 74 of file HcalRawGains.cc.

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

References mItems, and mSorted.

◆ sorted()

bool HcalRawGains::sorted ( ) const
inline

check if data are sorted

Definition at line 29 of file HcalRawGains.h.

29 { return mSorted; }

References mSorted.

Referenced by getValues().

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

HcalRawGain::getStatus
Status getStatus() const
Definition: HcalRawGain.h:21
HcalGenericDetId
Definition: HcalGenericDetId.h:15
HcalRawGains::mItems
Container mItems
Definition: HcalRawGains.h:41
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
DetId
Definition: DetId.h:17
HcalRawGain::getVoltage
float getVoltage() const
Definition: HcalRawGain.h:20
HcalRawGain
Definition: HcalRawGain.h:15
HcalRawGain::getError
float getError() const
Definition: HcalRawGain.h:19
pfDeepBoostedJetPreprocessParams_cfi.lower_bound
lower_bound
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:15
HcalRawGain::BAD
Definition: HcalRawGain.h:17
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
HcalRawGains::Item
HcalRawGain Item
Definition: HcalRawGains.h:37
HcalRawGains::sorted
bool sorted() const
check if data are sorted
Definition: HcalRawGains.h:29
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
filterCSVwithJSON.target
target
Definition: filterCSVwithJSON.py:32
mps_fire.result
result
Definition: mps_fire.py:311
cms::Exception
Definition: Exception.h:70
HcalRawGains::mSorted
bool mSorted
Definition: HcalRawGains.h:42
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.cerr
cerr
Definition: EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.py:8
HcalRawGain::getValue
float getValue() const
Definition: HcalRawGain.h:18