CMS 3D CMS Logo

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