Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:28:39

0001 #include "SimCalorimetry/HcalSimAlgos/interface/HcalCoderFactory.h"
0002 #include "CalibFormats/HcalObjects/interface/HcalCoderDb.h"
0003 #include "CalibFormats/HcalObjects/interface/HcalNominalCoder.h"
0004 
0005 HcalCoderFactory::HcalCoderFactory(CoderType coderType) : theCoderType(coderType), theDbService(nullptr) {}
0006 
0007 std::unique_ptr<HcalCoder> HcalCoderFactory::coder(const DetId& id) const {
0008   HcalCoder* result = nullptr;
0009   if (theCoderType == DB) {
0010     assert(theDbService != nullptr);
0011     HcalGenericDetId hcalGenDetId(id);
0012     const HcalQIECoder* qieCoder = theDbService->getHcalCoder(hcalGenDetId);
0013     const HcalQIEShape* qieShape = theDbService->getHcalShape(hcalGenDetId);
0014     result = new HcalCoderDb(*qieCoder, *qieShape);
0015   } else {
0016     result = new HcalNominalCoder();
0017   }
0018   return std::unique_ptr<HcalCoder>(result);
0019 }