CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/CalibTracker/SiStripESProducers/src/SiStripThresholdGenerator.cc

Go to the documentation of this file.
00001 #include "CalibTracker/SiStripESProducers/interface/SiStripThresholdGenerator.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 SiStripThresholdGenerator::SiStripThresholdGenerator(const edm::ParameterSet& iConfig,const edm::ActivityRegistry& aReg):
00008   SiStripCondObjBuilderBase<SiStripThreshold>::SiStripCondObjBuilderBase(iConfig)
00009 {
00010   edm::LogInfo("SiStripThresholdGenerator") <<  "[SiStripThresholdGenerator::SiStripThresholdGenerator]";
00011 }
00012 
00013 
00014 SiStripThresholdGenerator::~SiStripThresholdGenerator() { 
00015   edm::LogInfo("SiStripThresholdGenerator") <<  "[SiStripThresholdGenerator::~SiStripThresholdGenerator]";
00016 }
00017 
00018 
00019 void SiStripThresholdGenerator::createObject(){
00020     
00021   obj_ = new SiStripThreshold();
00022 
00023   edm::FileInPath fp_ = _pset.getParameter<edm::FileInPath>("file");
00024   float lTh_ = _pset.getParameter<double>("LowTh");
00025   float hTh_ = _pset.getParameter<double>("HighTh");
00026   float cTh_ = _pset.getParameter<double>("ClusTh");
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 Thresholds for det detid
00034     SiStripThreshold::Container theSiStripVector;   
00035     uint16_t strip=0;
00036 
00037     obj_->setData(strip,lTh_,hTh_,cTh_,theSiStripVector);
00038     LogDebug("SiStripThresholdFakeESSource::produce") <<"detid: "  << it->first << " \t"
00039                                                       << "firstStrip: " << strip << " \t" << theSiStripVector.back().getFirstStrip() << " \t"
00040                                                       << "lTh: " << lTh_       << " \t" << theSiStripVector.back().getLth() << " \t"
00041                                                       << "hTh: " << hTh_       << " \t" << theSiStripVector.back().getHth() << " \t"
00042                                                       << "FirstStrip_and_Hth: " << theSiStripVector.back().FirstStrip_and_Hth << " \t"
00043                                                       << std::endl;         
00044     
00045     if ( ! obj_->put(it->first,theSiStripVector) )
00046       edm::LogError("SiStripThresholdFakeESSource::produce ")<<" detid already exists"<<std::endl;
00047   }
00048   
00049   std::stringstream ss;
00050   obj_->printDebug(ss);
00051   LogDebug("SiStripThresholdFakeESSource::produce") <<"printDebug\n" << ss.str() << std::endl;
00052 
00053 }