CMS 3D CMS Logo

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

#include <CastorRawGains.h>

Public Types

typedef std::vector< ItemContainer
 
typedef CastorRawGain Item
 

Public Member Functions

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

Private Attributes

Container mItems
 
bool mSorted
 

Detailed Description

Author
Panos Katsas (UoA) POOL container to store Gain values 4xCapId
Panos Katsas (UoA) POOL object to store Gain values 4xCapId

Definition at line 17 of file CastorRawGains.h.

Member Typedef Documentation

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

Definition at line 35 of file CastorRawGains.h.

Definition at line 34 of file CastorRawGains.h.

Constructor & Destructor Documentation

CastorRawGains::CastorRawGains ( )

Definition at line 31 of file CastorRawGains.cc.

32  : mSorted (false) {}
CastorRawGains::~CastorRawGains ( )

Definition at line 34 of file CastorRawGains.cc.

34 {}

Member Function Documentation

CastorRawGain * CastorRawGains::addItem ( DetId  fId)

add new (empty) item

Definition at line 60 of file CastorRawGains.cc.

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

Referenced by sorted().

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

fill values

Definition at line 67 of file CastorRawGains.cc.

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

Referenced by sorted().

67  {
68  Item item (fId.rawId (), fValues.getValue(), fValues.getError(), fValues.getVoltage(), fValues.getStatus());
69  mItems.push_back (item);
70  mSorted = false;
71 }
Status getStatus() const
Definition: CastorRawGain.h:18
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:47
float getValue() const
Definition: CastorRawGain.h:15
float getVoltage() const
Definition: CastorRawGain.h:17
float getError() const
Definition: CastorRawGain.h:16
CastorRawGain Item
Container mItems
std::vector< DetId > CastorRawGains::getAllChannels ( ) const

get list of all available channels

Definition at line 51 of file CastorRawGains.cc.

References mItems, and mps_fire::result.

51  {
52  std::vector<DetId> result;
53  for (std::vector<Item>::const_iterator item = mItems.begin (); item != mItems.end (); item++) {
54  result.push_back (DetId (item->rawId ()));
55  }
56  return result;
57 }
Definition: DetId.h:18
Container mItems
const CastorRawGain * CastorRawGains::getValues ( DetId  fId) const

get value

Definition at line 36 of file CastorRawGains.cc.

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

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

sort values by channelId

Definition at line 74 of file CastorRawGains.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
bool CastorRawGains::sorted ( ) const
inline

check if data are sorted

Definition at line 26 of file CastorRawGains.h.

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

Referenced by getValues().

26 {return mSorted;}

Member Data Documentation

Container CastorRawGains::mItems
private

Definition at line 37 of file CastorRawGains.h.

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

bool CastorRawGains::mSorted
private

Definition at line 38 of file CastorRawGains.h.

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