CMS 3D CMS Logo

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