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.

59  {
60  CastorRawGain item(fId.rawId());
61  mItems.push_back(item);
62  mSorted = false;
63  return &(mItems.back());
64 }

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

◆ addValues()

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

fill values

Definition at line 66 of file CastorRawGains.cc.

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

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

◆ getAllChannels()

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

get list of all available channels

Definition at line 51 of file CastorRawGains.cc.

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 }

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

◆ getValues()

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

get value

Definition at line 35 of file CastorRawGains.cc.

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 }

References CastorRawGain::BAD, beam_dqm_sourceclient-live_cfg::cerr, spr::find(), cuda_std::lower_bound(), mItems, DetId::rawId(), sorted(), and filterCSVwithJSON::target.

◆ sort()

void CastorRawGains::sort ( )

sort values by channelId

Definition at line 72 of file CastorRawGains.cc.

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

References mItems, and mSorted.

◆ sorted()

bool CastorRawGains::sorted ( ) const
inline

check if data are sorted

Definition at line 26 of file CastorRawGains.h.

26 { return mSorted; }

References mSorted.

Referenced by getValues().

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

HcalGenericDetId
Definition: HcalGenericDetId.h:15
CastorRawGain::getValue
float getValue() const
Definition: CastorRawGain.h:15
CastorRawGain::getVoltage
float getVoltage() const
Definition: CastorRawGain.h:17
CastorRawGain::BAD
Definition: CastorRawGain.h:14
CastorRawGain::getError
float getError() const
Definition: CastorRawGain.h:16
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
CastorRawGains::Item
CastorRawGain Item
Definition: CastorRawGains.h:34
CastorRawGains::mItems
Container mItems
Definition: CastorRawGains.h:38
DetId
Definition: DetId.h:17
CastorRawGain::getStatus
Status getStatus() const
Definition: CastorRawGain.h:18
CastorRawGain
Definition: CastorRawGain.h:12
cuda_std::lower_bound
__host__ constexpr __device__ RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
Definition: cudastdAlgorithm.h:27
beam_dqm_sourceclient-live_cfg.cerr
cerr
Definition: beam_dqm_sourceclient-live_cfg.py:17
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
CastorRawGains::mSorted
bool mSorted
Definition: CastorRawGains.h:39
CastorRawGains::sorted
bool sorted() const
check if data are sorted
Definition: CastorRawGains.h:26
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:303
cms::Exception
Definition: Exception.h:70