CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch1/src/CalibTracker/SiStripESProducers/src/SiStripPedestalsGenerator.cc

Go to the documentation of this file.
00001 #include "CalibTracker/SiStripESProducers/interface/SiStripPedestalsGenerator.h"
00002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00003 #include <boost/cstdint.hpp>
00004 #include "CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h"
00005 #include "FWCore/ParameterSet/interface/FileInPath.h"
00006 
00007 SiStripPedestalsGenerator::SiStripPedestalsGenerator(const edm::ParameterSet& iConfig,const edm::ActivityRegistry& aReg):
00008   SiStripCondObjBuilderBase<SiStripPedestals>::SiStripCondObjBuilderBase(iConfig)
00009 {
00010   edm::LogInfo("SiStripPedestalsGenerator") <<  "[SiStripPedestalsGenerator::SiStripPedestalsGenerator]";
00011 }
00012 
00013 
00014 SiStripPedestalsGenerator::~SiStripPedestalsGenerator() { 
00015   edm::LogInfo("SiStripPedestalsGenerator") <<  "[SiStripPedestalsGenerator::~SiStripPedestalsGenerator]";
00016 }
00017 
00018 
00019 void SiStripPedestalsGenerator::createObject(){
00020     
00021   obj_ = new SiStripPedestals();
00022 
00023   uint32_t PedestalValue_ = _pset.getParameter<uint32_t>("PedestalsValue");  
00024   edm::FileInPath fp_ = _pset.getParameter<edm::FileInPath>("file");
00025   uint32_t  printdebug_ = _pset.getUntrackedParameter<uint32_t>("printDebug", 5);
00026   uint32_t count=0;
00027 
00028   SiStripDetInfoFileReader reader(fp_.fullPath());
00029 
00030   const std::map<uint32_t, SiStripDetInfoFileReader::DetInfo > DetInfos  = reader.getAllData();
00031   
00032   for(std::map<uint32_t, SiStripDetInfoFileReader::DetInfo >::const_iterator it = DetInfos.begin(); it != DetInfos.end(); it++){    
00033     //Generate Noises for det detid
00034     SiStripPedestals::InputVector theSiStripVector;
00035     for(unsigned short j=0; j<128*it->second.nApvs; j++){
00036   
00037       if (count<printdebug_) {
00038         edm::LogInfo("SiStripPedestalsFakeESSource::makePedestals(): ") << "detid: " << it->first  << " strip: " << j <<  " ped: " << PedestalValue_  << std::endl;         
00039       }
00040       obj_->setData(PedestalValue_,theSiStripVector);
00041     }
00042     count++;
00043     if ( ! obj_->put(it->first, theSiStripVector) )
00044       edm::LogError("SiStripPedestalsFakeESSource::produce ")<<" detid already exists"<<std::endl;
00045   }
00046 }