CMS 3D CMS Logo

SiStripThresholdFakeESSource.cc

Go to the documentation of this file.
00001 #include "CalibTracker/SiStripESProducers/plugins/fake/SiStripThresholdFakeESSource.h"
00002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00003 #include "CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h"
00004 
00005 
00006 #include <iostream>
00007 
00008 
00009 SiStripThresholdFakeESSource::SiStripThresholdFakeESSource( const edm::ParameterSet& pset ):
00010   fp_(pset.getParameter<edm::FileInPath>("file")),
00011   lTh_(pset.getParameter<double>("LowTh")),
00012   hTh_(pset.getParameter<double>("HighTh")){
00013 
00014   edm::LogInfo("SiStripThresholdFakeESSource::SiStripThresholdFakeESSource");
00015 
00016   setWhatProduced( this );
00017   findingRecord<SiStripThresholdRcd>();
00018 }
00019 
00020 
00021 std::auto_ptr<SiStripThreshold> SiStripThresholdFakeESSource::produce( const SiStripThresholdRcd& ) { 
00022   
00023   SiStripThreshold * obj = new SiStripThreshold();
00024 
00025   SiStripDetInfoFileReader reader(fp_.fullPath());
00026  
00027   const std::map<uint32_t, SiStripDetInfoFileReader::DetInfo > DetInfos  = reader.getAllData();
00028   
00029   for(std::map<uint32_t, SiStripDetInfoFileReader::DetInfo >::const_iterator it = DetInfos.begin(); it != DetInfos.end(); it++){    
00030     //Generate Thresholds for det detid
00031     SiStripThreshold::Container theSiStripVector;   
00032     uint16_t strip=0;
00033     float lTh = lTh_;
00034     float hTh = hTh_;
00035 
00036     obj->setData(strip,lTh,hTh,theSiStripVector);
00037     LogDebug("SiStripThresholdFakeESSource::produce") <<"detid: "  << it->first << " \t"
00038                                                           << "firstStrip: " << strip << " \t" << theSiStripVector.back().getFirstStrip() << " \t"
00039                                                           << "lTh: " << lTh       << " \t" << theSiStripVector.back().getLth() << " \t"
00040                                                           << "hTh: " << hTh       << " \t" << theSiStripVector.back().getHth() << " \t"
00041                                                           << "FirstStrip_and_Hth: " << theSiStripVector.back().FirstStrip_and_Hth << " \t"
00042                                                           << std::endl;             
00043     
00044     if ( ! obj->put(it->first,theSiStripVector) )
00045       edm::LogError("SiStripThresholdFakeESSource::produce ")<<" detid already exists"<<std::endl;
00046   }
00047   
00048   return std::auto_ptr<SiStripThreshold>(obj);
00049 
00050 }
00051 
00052 
00053 void SiStripThresholdFakeESSource::setIntervalFor( const edm::eventsetup::EventSetupRecordKey&, 
00054                                                 const edm::IOVSyncValue& iosv, 
00055                                                 edm::ValidityInterval& oValidity ) {
00056 
00057   edm::ValidityInterval infinity( iosv.beginOfTime(), iosv.endOfTime() );
00058   oValidity = infinity;
00059   
00060 }
00061 

Generated on Tue Jun 9 17:25:50 2009 for CMSSW by  doxygen 1.5.4