#include <CalibTracker/SiPixelESProducer/src/SiPixelFakeGainForHLTESSource.cc>
Public Member Functions | |
virtual std::auto_ptr < SiPixelGainCalibrationForHLT > | produce (const SiPixelGainCalibrationForHLTRcd &) |
SiPixelFakeGainForHLTESSource (const edm::ParameterSet &) | |
~SiPixelFakeGainForHLTESSource () | |
Protected Member Functions | |
virtual void | setIntervalFor (const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) |
Private Attributes | |
edm::FileInPath | fp_ |
Implementation: <Notes on="" implementation>="">
Definition at line 37 of file SiPixelFakeGainForHLTESSource.h.
SiPixelFakeGainForHLTESSource::SiPixelFakeGainForHLTESSource | ( | const edm::ParameterSet & | conf_ | ) |
Definition at line 30 of file SiPixelFakeGainForHLTESSource.cc.
References edm::ESProducer::setWhatProduced().
00030 : 00031 fp_(conf_.getParameter<edm::FileInPath>("file")) 00032 { 00033 edm::LogInfo("SiPixelFakeGainForHLTESSource::SiPixelFakeGainForHLTESSource"); 00034 //the following line is needed to tell the framework what 00035 // data is being produced 00036 setWhatProduced(this); 00037 findingRecord<SiPixelGainCalibrationForHLTRcd>(); 00038 }
SiPixelFakeGainForHLTESSource::~SiPixelFakeGainForHLTESSource | ( | ) |
Definition at line 40 of file SiPixelFakeGainForHLTESSource.cc.
00041 { 00042 00043 // do anything here that needs to be done at desctruction time 00044 // (e.g. close files, deallocate resources etc.) 00045 00046 }
std::auto_ptr< SiPixelGainCalibrationForHLT > SiPixelFakeGainForHLTESSource::produce | ( | const SiPixelGainCalibrationForHLTRcd & | ) | [virtual] |
Definition at line 48 of file SiPixelFakeGainForHLTESSource.cc.
References lat::endl(), fp_, edm::FileInPath::fullPath(), i, j, VarParsing::obj, SiPixelGainCalibrationForHLT::put(), range, and SiPixelGainCalibrationForHLT::setData().
00049 { 00050 00051 using namespace edm::es; 00052 unsigned int nmodules = 0; 00053 uint32_t nchannels = 0; 00054 SiPixelGainCalibrationForHLT * obj = new SiPixelGainCalibrationForHLT(25.,30., 2.,3.); 00055 SiPixelDetInfoFileReader reader(fp_.fullPath()); 00056 const std::vector<uint32_t> DetIds = reader.getAllDetIds(); 00057 00058 // Loop over detectors 00059 for(std::vector<uint32_t>::const_iterator detit=DetIds.begin(); detit!=DetIds.end(); detit++) { 00060 nmodules++; 00061 std::vector<char> theSiPixelGainCalibration; 00062 const std::pair<int, int> & detUnitDimensions = reader.getDetUnitDimensions(*detit); 00063 00064 // Loop over columns and rows 00065 00066 for(int i=0; i<detUnitDimensions.first; i++) { 00067 float totalGain = 0.0; 00068 float totalPed = 0.0; 00069 float totalEntries=0.0; 00070 for(int j=0; j<detUnitDimensions.second; j++) { 00071 nchannels++; 00072 totalGain += 2.8; 00073 totalPed += 28.2; 00074 totalEntries ++; 00075 if((j+1)%80==0){ 00076 float gain = totalGain/totalEntries; 00077 float ped = totalPed/totalEntries; 00078 00079 obj->setData(ped,gain, theSiPixelGainCalibration); 00080 totalGain=0.; 00081 totalPed=0.; 00082 totalEntries=0.; 00083 } 00084 } 00085 } 00086 00087 //std::cout << "detid " << (*detit) << std::endl; 00088 00089 SiPixelGainCalibrationForHLT::Range range(theSiPixelGainCalibration.begin(),theSiPixelGainCalibration.end()); 00090 int nCols = detUnitDimensions.first; 00091 if( !obj->put(*detit,range,nCols) ) 00092 edm::LogError("SiPixelFakeGainForHLTESSource")<<"[SiPixelFakeGainForHLTESSource::produce] detid already exists"<<std::endl; 00093 } 00094 00095 //std::cout << "Modules = " << nmodules << " Channels " << nchannels << std::endl; 00096 00097 00098 // 00099 return std::auto_ptr<SiPixelGainCalibrationForHLT>(obj); 00100 00101 00102 }
void SiPixelFakeGainForHLTESSource::setIntervalFor | ( | const edm::eventsetup::EventSetupRecordKey & | , | |
const edm::IOVSyncValue & | iosv, | |||
edm::ValidityInterval & | oValidity | |||
) | [protected, virtual] |
Implements edm::EventSetupRecordIntervalFinder.
Definition at line 104 of file SiPixelFakeGainForHLTESSource.cc.
References edm::IOVSyncValue::beginOfTime(), edm::IOVSyncValue::endOfTime(), and infinity.
00106 { 00107 edm::ValidityInterval infinity( iosv.beginOfTime(), iosv.endOfTime() ); 00108 oValidity = infinity; 00109 }