CMS 3D CMS Logo

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

#include <HcalCalibrationsSet.h>

Classes

struct  CalibSetObject
 

Public Member Functions

void clear ()
 
std::vector< DetIdgetAllChannels () const
 
const HcalCalibrationsgetCalibrations (const DetId id) const
 
 HcalCalibrationsSet ()
 
void setCalibrations (const DetId id, const HcalCalibrations &ca)
 

Private Types

typedef CalibSetObject Item
 

Private Attributes

HcalCalibrations dummy
 
std::unordered_map< uint32_t, CalibSetObjectmItems
 

Detailed Description

Author
J. Mans - Minnesota

Definition at line 16 of file HcalCalibrationsSet.h.

Member Typedef Documentation

Definition at line 33 of file HcalCalibrationsSet.h.

Constructor & Destructor Documentation

HcalCalibrationsSet::HcalCalibrationsSet ( )

Definition at line 8 of file HcalCalibrationsSet.cc.

9 {}

Member Function Documentation

void HcalCalibrationsSet::clear ( )
std::vector< DetId > HcalCalibrationsSet::getAllChannels ( ) const

Definition at line 34 of file HcalCalibrationsSet.cc.

References mItems, and tmp.

Referenced by dumpHcalMatrixObject().

34  {
35  std::vector<DetId> channels;
36  channels.reserve(mItems.size());
37  for(const auto& tmp : mItems){
38  channels.push_back(tmp.second.id);
39  }
40  return channels;
41 }
std::unordered_map< uint32_t, CalibSetObject > mItems
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
const HcalCalibrations & HcalCalibrationsSet::getCalibrations ( const DetId  id) const

Definition at line 11 of file HcalCalibrationsSet.cc.

References Exception, hcalEqualDetId(), hcalTransformedId(), and mItems.

Referenced by dumpHcalMatrixObject().

11  {
12  DetId fId2(hcalTransformedId(fId));
13  auto cell = mItems.find(fId2);
14  if ((cell == mItems.end()) || (!hcalEqualDetId(cell->first,fId2)))
15  throw cms::Exception ("Conditions not found") << "Unavailable HcalCalibrations for cell " << HcalGenericDetId(fId);
16  return cell->second.calib;
17 }
bool hcalEqualDetId(Item *cell, const DetId &fId)
std::unordered_map< uint32_t, CalibSetObject > mItems
DetId hcalTransformedId(const DetId &aid)
Definition: DetId.h:18
void HcalCalibrationsSet::setCalibrations ( const DetId  id,
const HcalCalibrations ca 
)

Definition at line 19 of file HcalCalibrationsSet.cc.

References hcalTransformedId(), mItems, and mps_fire::result.

19  {
20  DetId fId2(hcalTransformedId(fId));
21  auto cell = mItems.find(fId2);
22  if (cell==mItems.end()) {
23  auto result = mItems.emplace(fId2,fId2);
24  result.first->second.calib=ca;
25  return;
26  }
27  cell->second.calib=ca;
28 }
std::unordered_map< uint32_t, CalibSetObject > mItems
DetId hcalTransformedId(const DetId &aid)
Definition: DetId.h:18

Member Data Documentation

HcalCalibrations HcalCalibrationsSet::dummy
private

Definition at line 34 of file HcalCalibrationsSet.h.

std::unordered_map<uint32_t,CalibSetObject> HcalCalibrationsSet::mItems
private

Definition at line 35 of file HcalCalibrationsSet.h.

Referenced by clear(), getAllChannels(), getCalibrations(), and setCalibrations().