CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_4/src/SimCalorimetry/HcalSimAlgos/src/HcalCoderFactory.cc

Go to the documentation of this file.
00001 #include "SimCalorimetry/HcalSimAlgos/interface/HcalCoderFactory.h"
00002 #include "CalibFormats/HcalObjects/interface/HcalCoderDb.h"
00003 #include "CalibFormats/HcalObjects/interface/HcalNominalCoder.h"
00004 
00005 
00006 
00007 HcalCoderFactory::HcalCoderFactory(CoderType coderType) 
00008 : theCoderType(coderType),
00009   theDbService(0)
00010 {
00011 }
00012 
00013 
00014 std::auto_ptr<HcalCoder> HcalCoderFactory::coder(const DetId & id) const {
00015   HcalCoder * result = 0;
00016   if(theCoderType == DB) {
00017     assert(theDbService != 0);
00018     HcalGenericDetId hcalGenDetId(id);
00019     const HcalQIECoder * qieCoder = theDbService->getHcalCoder(hcalGenDetId );
00020     const HcalQIEShape * qieShape = theDbService->getHcalShape();
00021     result = new HcalCoderDb(*qieCoder, *qieShape);
00022   }
00023 
00024   else {
00025     result = new HcalNominalCoder();
00026   }
00027   return std::auto_ptr<HcalCoder>(result);
00028 }
00029