CMS 3D CMS Logo

CastorCoderFactory.cc
Go to the documentation of this file.
4 
5 CastorCoderFactory::CastorCoderFactory(CoderType coderType) : theCoderType(coderType), theDbService(nullptr) {}
6 
7 std::unique_ptr<CastorCoder> CastorCoderFactory::coder(const DetId &id) const {
8  CastorCoder *result = nullptr;
9  if (theCoderType == DB) {
10  assert(theDbService != nullptr);
11  HcalGenericDetId hcalGenDetId(id);
12  const CastorQIECoder *qieCoder = theDbService->getCastorCoder(hcalGenDetId);
13  const CastorQIEShape *qieShape = theDbService->getCastorShape();
14  result = new CastorCoderDb(*qieCoder, *qieShape);
15  }
16 
17  else {
18  result = new CastorNominalCoder();
19  }
20  return std::unique_ptr<CastorCoder>(result);
21 }
std::unique_ptr< CastorCoder > coder(const DetId &detId) const
user gets control of the pointer
const CastorDbService * theDbService
#define nullptr
const CastorQIEShape * getCastorShape() const
Definition: DetId.h:18
CastorCoderFactory(CoderType coderType)
const CastorQIECoder * getCastorCoder(const HcalGenericDetId &fId) const