CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/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), theDbService(0) { }
00009 
00010 
00011 std::auto_ptr<HcalCoder> HcalCoderFactory::coder(const DetId & id) const {
00012   HcalCoder * result = 0;
00013   if (theCoderType == DB || theCoderType == UPGRADE) {
00014     assert(theDbService != 0);
00015     HcalGenericDetId hcalGenDetId(id);
00016     const HcalQIECoder * qieCoder = theDbService->getHcalCoder(hcalGenDetId );
00017     const HcalQIEShape * qieShape = theDbService->getHcalShape(hcalGenDetId);
00018     result = new HcalCoderDb(*qieCoder, *qieShape);
00019   } else {
00020     result = new HcalNominalCoder();
00021   }
00022   return std::auto_ptr<HcalCoder>(result);
00023 }
00024