CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch2/src/CalibTracker/SiStripESProducers/src/SiStripLatencyGenerator.cc

Go to the documentation of this file.
00001 #include "CalibTracker/SiStripESProducers/interface/SiStripLatencyGenerator.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 #include "CLHEP/Random/RandFlat.h"
00008 #include "CLHEP/Random/RandGauss.h"
00009 
00010 SiStripLatencyGenerator::SiStripLatencyGenerator(const edm::ParameterSet& iConfig,const edm::ActivityRegistry& aReg):
00011   SiStripCondObjBuilderBase<SiStripLatency>::SiStripCondObjBuilderBase(iConfig)
00012 {
00013   edm::LogInfo("SiStripLatencyGenerator") << "[SiStripLatencyGenerator::SiStripLatencyGenerator]";
00014 }
00015 
00016 SiStripLatencyGenerator::~SiStripLatencyGenerator()
00017 {
00018   edm::LogInfo("SiStripLatencyGenerator") << "[SiStripLatencyGenerator::~SiStripLatencyGenerator]";
00019 }
00020 
00021 void SiStripLatencyGenerator::createObject()
00022 {
00023   obj_ = new SiStripLatency();
00024 
00025   // Read the full list of detIds
00026   edm::FileInPath fp_ = _pset.getParameter<edm::FileInPath>("file");
00027   SiStripDetInfoFileReader reader(fp_.fullPath());
00028   const std::map<uint32_t, SiStripDetInfoFileReader::DetInfo > detInfos = reader.getAllData();
00029   // Take the last detId. Since the map is sorted it will be the biggest value
00030   if( !detInfos.empty() ) {
00031     // Set the apv number as 6, the highest possible
00032     edm::LogInfo("SiStripLatencyGenerator") << "detId = " << detInfos.rbegin()->first << " apv = " << 6
00033                                             << " latency = " << _pset.getParameter<uint32_t>("latency")
00034                                             << " mode = " << _pset.getParameter<uint32_t>("mode") << std::endl;
00035     obj_->put(detInfos.rbegin()->first, 6, _pset.getParameter<uint32_t>("latency"), _pset.getParameter<uint32_t>("mode") );
00036 
00037     // Call this method to collapse all consecutive detIdAndApvs with the same latency and mode to a single entry
00038     obj_->compress();
00039   }
00040   else {
00041     edm::LogError("SiStripLatencyGenerator") << "Error: detInfo map is empty. Cannot get the last detId." << std::endl;
00042   }
00043 }