Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-08-23 03:25:35

0001 #include "CalibFormats/CastorObjects/interface/CastorCoderDb.h"
0002 #include "CalibFormats/CastorObjects/interface/CastorNominalCoder.h"
0003 #include "SimCalorimetry/CastorSim/interface/CastorCoderFactory.h"
0004 #include <cassert>
0005 
0006 CastorCoderFactory::CastorCoderFactory(CoderType coderType) : theCoderType(coderType), theDbService(nullptr) {}
0007 
0008 std::unique_ptr<CastorCoder> CastorCoderFactory::coder(const DetId &id) const {
0009   CastorCoder *result = nullptr;
0010   if (theCoderType == DB) {
0011     assert(theDbService != nullptr);
0012     HcalGenericDetId hcalGenDetId(id);
0013     const CastorQIECoder *qieCoder = theDbService->getCastorCoder(hcalGenDetId);
0014     const CastorQIEShape *qieShape = theDbService->getCastorShape();
0015     result = new CastorCoderDb(*qieCoder, *qieShape);
0016   }
0017 
0018   else {
0019     result = new CastorNominalCoder();
0020   }
0021   return std::unique_ptr<CastorCoder>(result);
0022 }