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.

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

Definition at line 37 of file HcalRawGains.cc.

37 {}

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

Referenced by sorted().

63  {
64  HcalRawGain item (fId.rawId ());
65  mItems.push_back (item);
66  mSorted = false;
67  return &(mItems.back ());
68 }
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
Container mItems
Definition: HcalRawGains.h:40
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().

Referenced by sorted().

70  {
71  Item item (fId.rawId (), fValues.getValue(), fValues.getError(), fValues.getVoltage(), fValues.getStatus());
72  mItems.push_back (item);
73  mSorted = false;
74 }
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
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:40
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 54 of file HcalRawGains.cc.

References mItems, and mps_fire::result.

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

get value

Definition at line 39 of file HcalRawGains.cc.

References HcalRawGain::BAD, MessageLogger_cfi::cerr, spr::find(), mItems, DetId::rawId(), sorted(), and edmPickEvents::target.

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

References mItems, and mSorted.

Referenced by sorted().

77  {
78  if (!mSorted) {
79  std::sort (mItems.begin(), mItems.end(), compareItems ());
80  mSorted = true;
81  }
82 }
Container mItems
Definition: HcalRawGains.h:40
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 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().