CMS 3D CMS Logo

SiStripGainFakeESSource.cc

Go to the documentation of this file.
00001 #include "CalibTracker/SiStripESProducers/plugins/fake/SiStripGainFakeESSource.h"
00002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00003 #include "CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h"
00004 
00005 
00006 #include <iostream>
00007 
00008 
00009 SiStripGainFakeESSource::SiStripGainFakeESSource( const edm::ParameterSet& pset ) {
00010 
00011   edm::LogInfo("SiStripGainFakeESSource::SiStripGainFakeESSource");
00012 
00013   setWhatProduced( this );
00014   findingRecord<SiStripApvGainRcd>();
00015 
00016 
00017   fp_ = pset.getParameter<edm::FileInPath>("file");
00018 
00019   //  edm::LogInfo("SiStripGainFakeESSource::SiStripGainFakeESSource - exiting");
00020 
00021 }
00022 
00023 
00024 std::auto_ptr<SiStripApvGain> SiStripGainFakeESSource::produce( const SiStripApvGainRcd& ) { 
00025   
00026   SiStripApvGain * obj = new SiStripApvGain();
00027 
00028   SiStripDetInfoFileReader reader(fp_.fullPath());
00029   //  SiStripDetInfoFileReader reader("");
00030 
00031   const std::vector<uint32_t> DetIds = reader.getAllDetIds();
00032 
00033   for(std::vector<uint32_t>::const_iterator detit=DetIds.begin(); detit!=DetIds.end(); detit++){
00034 
00035     std::vector<float> theSiStripVector;
00036 
00037     const std::pair<unsigned short, double> ApvsAndStripLengths = reader.getNumberOfApvsAndStripLength(*detit);
00038 
00039     for(unsigned short j=0; j<ApvsAndStripLengths.first; j++){
00040       theSiStripVector.push_back(1);
00041     }
00042     
00043     
00044     SiStripApvGain::Range range(theSiStripVector.begin(),theSiStripVector.end());
00045     if ( ! obj->put(*detit, range) )
00046       edm::LogError("SiStripGainFakeESSource::produce ")<<" detid already exists"<<std::endl;
00047 
00048   }
00049   
00050 
00051   return std::auto_ptr<SiStripApvGain>(obj);
00052 
00053 
00054 }
00055 
00056 
00057 void SiStripGainFakeESSource::setIntervalFor( const edm::eventsetup::EventSetupRecordKey&, 
00058                                                 const edm::IOVSyncValue& iosv, 
00059                                                 edm::ValidityInterval& oValidity ) {
00060 
00061   edm::ValidityInterval infinity( iosv.beginOfTime(), iosv.endOfTime() );
00062   oValidity = infinity;
00063   
00064 }
00065 

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