CMS 3D CMS Logo

HcalCoderFactory.cc
Go to the documentation of this file.
4 
5 HcalCoderFactory::HcalCoderFactory(CoderType coderType) : theCoderType(coderType), theDbService(nullptr) {}
6 
7 std::unique_ptr<HcalCoder> HcalCoderFactory::coder(const DetId& id) const {
8  HcalCoder* result = nullptr;
9  if (theCoderType == DB) {
10  assert(theDbService != nullptr);
11  HcalGenericDetId hcalGenDetId(id);
12  const HcalQIECoder* qieCoder = theDbService->getHcalCoder(hcalGenDetId);
13  const HcalQIEShape* qieShape = theDbService->getHcalShape(hcalGenDetId);
14  result = new HcalCoderDb(*qieCoder, *qieShape);
15  } else {
16  result = new HcalNominalCoder();
17  }
18  return std::unique_ptr<HcalCoder>(result);
19 }
const HcalDbService * theDbService
assert(be >=bs)
HcalCoderFactory(CoderType coderType)
Definition: DetId.h:17
const HcalQIEShape * getHcalShape(const HcalGenericDetId &fId) const
const HcalQIECoder * getHcalCoder(const HcalGenericDetId &fId) const
CoderType theCoderType
std::unique_ptr< HcalCoder > coder(const DetId &detId) const
user gets control of the pointer