CMS 3D CMS Logo

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

#include <HcalCalibrationWidthsSet.h>

Classes

struct  CalibWidthSetObject
 

Public Member Functions

void clear ()
 
std::vector< DetIdgetAllChannels () const
 
const HcalCalibrationWidthsgetCalibrationWidths (const DetId id) const
 
 HcalCalibrationWidthsSet ()
 
void setCalibrationWidths (const DetId id, const HcalCalibrationWidths &ca)
 

Private Types

typedef CalibWidthSetObject Item
 

Private Attributes

HcalCalibrationWidths dummy
 
std::unordered_map< uint32_t, CalibWidthSetObjectmItems
 

Detailed Description

Author
R.Ofierzynski

Definition at line 16 of file HcalCalibrationWidthsSet.h.

Member Typedef Documentation

Definition at line 33 of file HcalCalibrationWidthsSet.h.

Constructor & Destructor Documentation

HcalCalibrationWidthsSet::HcalCalibrationWidthsSet ( )

Definition at line 8 of file HcalCalibrationWidthsSet.cc.

9 {}

Member Function Documentation

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

Definition at line 34 of file HcalCalibrationWidthsSet.cc.

References mItems, and tmp.

Referenced by HcalDbASCIIIO::createObject< HcalSiPMCharacteristics >().

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, CalibWidthSetObject > mItems
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
const HcalCalibrationWidths & HcalCalibrationWidthsSet::getCalibrationWidths ( const DetId  id) const

Definition at line 11 of file HcalCalibrationWidthsSet.cc.

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

Referenced by HcalDbASCIIIO::createObject< HcalSiPMCharacteristics >().

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 HcalCalibrationWidths for cell " << HcalGenericDetId(fId);
16  return cell->second.calib;
17 }
bool hcalEqualDetId(Item *cell, const DetId &fId)
DetId hcalTransformedId(const DetId &aid)
std::unordered_map< uint32_t, CalibWidthSetObject > mItems
Definition: DetId.h:18
void HcalCalibrationWidthsSet::setCalibrationWidths ( const DetId  id,
const HcalCalibrationWidths ca 
)

Definition at line 19 of file HcalCalibrationWidthsSet.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 }
DetId hcalTransformedId(const DetId &aid)
std::unordered_map< uint32_t, CalibWidthSetObject > mItems
Definition: DetId.h:18

Member Data Documentation

HcalCalibrationWidths HcalCalibrationWidthsSet::dummy
private

Definition at line 34 of file HcalCalibrationWidthsSet.h.

std::unordered_map<uint32_t,CalibWidthSetObject> HcalCalibrationWidthsSet::mItems
private