00001 #include "SimCalorimetry/CastorSim/src/CastorCoderFactory.h" 00002 #include "CalibFormats/CastorObjects/interface/CastorCoderDb.h" 00003 #include "CalibFormats/CastorObjects/interface/CastorNominalCoder.h" 00004 00005 00006 00007 CastorCoderFactory::CastorCoderFactory(CoderType coderType) 00008 : theCoderType(coderType), 00009 theDbService(0) 00010 { 00011 } 00012 00013 00014 std::auto_ptr<CastorCoder> CastorCoderFactory::coder(const DetId & id) const { 00015 CastorCoder * result = 0; 00016 if(theCoderType == DB) { 00017 assert(theDbService != 0); 00018 HcalGenericDetId hcalGenDetId(id); 00019 const CastorQIECoder * qieCoder = theDbService->getCastorCoder(hcalGenDetId ); 00020 const CastorQIEShape * qieShape = theDbService->getCastorShape(); 00021 result = new CastorCoderDb(*qieCoder, *qieShape); 00022 } 00023 00024 else { 00025 result = new CastorNominalCoder(); 00026 } 00027 return std::auto_ptr<CastorCoder>(result); 00028 } 00029