00001 #include "CalibTracker/SiStripESProducers/plugins/fake/SiStripPedestalsFakeESSource.h" 00002 #include "FWCore/MessageLogger/interface/MessageLogger.h" 00003 #include "CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h" 00004 00005 00006 #include <iostream> 00007 00008 00009 SiStripPedestalsFakeESSource::SiStripPedestalsFakeESSource( const edm::ParameterSet& pset ) : SiStripPedestalsESSource(pset) { 00010 00011 edm::LogInfo("SiStripPedestalsFakeESSource::SiStripPedestalsFakeESSource"); 00012 00013 PedestalValue_ = pset.getParameter<uint32_t>("PedestalsValue"); 00014 LowThValue_ = pset.getParameter<double>("LowThValue"); 00015 HighThValue_ = pset.getParameter<double>("HighThValue"); 00016 00017 fp_ = pset.getParameter<edm::FileInPath>("file"); 00018 00019 printdebug_ = pset.getUntrackedParameter<bool>("printDebug", false); 00020 00021 } 00022 00023 00024 SiStripPedestals * SiStripPedestalsFakeESSource::makePedestals() { 00025 00026 SiStripPedestals * obj = new SiStripPedestals(); 00027 00028 SiStripDetInfoFileReader reader(fp_.fullPath()); 00029 00030 const std::vector<uint32_t> DetIds = reader.getAllDetIds(); 00031 00032 bool firstdet=true; 00033 00034 for(std::vector<uint32_t>::const_iterator detit=DetIds.begin(); detit!=DetIds.end(); ++detit){ 00035 00036 SiStripPedestals::InputVector theSiStripVector; 00037 00038 const std::pair<unsigned short, double> ApvsAndStripLengths = reader.getNumberOfApvsAndStripLength(*detit); 00039 00040 for(unsigned short j=0; j<ApvsAndStripLengths.first; ++j){ 00041 00042 for(int strip=0; strip<128; ++strip){ 00043 00044 if (printdebug_ && firstdet) { 00045 00046 edm::LogInfo("SiStripPedestalsFakeESSource::makePedestals(): ") << "detid: " << *detit << " strip: " << j*128+strip << " ped: " << PedestalValue_ << " LowThValue: " << LowThValue_ << " HighThValue: " << HighThValue_ << std::endl; 00047 00048 } 00049 00050 obj->setData(PedestalValue_,theSiStripVector); 00051 } 00052 00053 } 00054 00055 firstdet=false; 00056 00057 if ( ! obj->put(*detit, theSiStripVector) ) 00058 edm::LogError("SiStripPedestalsFakeESSource::produce ")<<" detid already exists"<<std::endl; 00059 00060 } 00061 00062 00063 return obj; 00064 } 00065