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

◆ Container

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

Definition at line 35 of file CastorRawGains.h.

◆ Item

Definition at line 34 of file CastorRawGains.h.

Constructor & Destructor Documentation

◆ CastorRawGains()

CastorRawGains::CastorRawGains ( )

Definition at line 31 of file CastorRawGains.cc.

31 : mSorted(false) {}

◆ ~CastorRawGains()

CastorRawGains::~CastorRawGains ( )

Definition at line 33 of file CastorRawGains.cc.

33 {}

Member Function Documentation

◆ addItem()

CastorRawGain * CastorRawGains::addItem ( DetId  fId)

add new (empty) item

Definition at line 59 of file CastorRawGains.cc.

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

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

◆ addValues()

void CastorRawGains::addValues ( DetId  fId,
const CastorRawGain fValues 
)

fill values

Definition at line 66 of file CastorRawGains.cc.

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

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

◆ getAllChannels()

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

get list of all available channels

Definition at line 51 of file CastorRawGains.cc.

References B2GTnPMonitor_cfi::item, 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:17
Container mItems

◆ getValues()

const CastorRawGain * CastorRawGains::getValues ( DetId  fId) const

get value

Definition at line 35 of file CastorRawGains.cc.

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

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

◆ sort()

void CastorRawGains::sort ( )

sort values by channelId

Definition at line 72 of file CastorRawGains.cc.

References mItems, mSorted, and jetUpdater_cfi::sort.

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

◆ sorted()

bool CastorRawGains::sorted ( ) const
inline

check if data are sorted

Definition at line 26 of file CastorRawGains.h.

References mSorted.

Referenced by getValues().

26 { return mSorted; }

Member Data Documentation

◆ mItems

Container CastorRawGains::mItems
private

Definition at line 38 of file CastorRawGains.h.

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

◆ mSorted

bool CastorRawGains::mSorted
private

Definition at line 39 of file CastorRawGains.h.

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