#include <CondTools/SiStrip/plugins/SiStripNoisesBuilder.h>
Public Member Functions | |
virtual void | analyze (const edm::Event &, const edm::EventSetup &) |
SiStripNoisesBuilder (const edm::ParameterSet &iConfig) | |
~SiStripNoisesBuilder () | |
Private Attributes | |
edm::FileInPath | fp_ |
uint32_t | printdebug_ |
Definition at line 16 of file SiStripNoisesBuilder.h.
SiStripNoisesBuilder::SiStripNoisesBuilder | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 6 of file SiStripNoisesBuilder.cc.
00006 : 00007 fp_(iConfig.getUntrackedParameter<edm::FileInPath>("file",edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"))), 00008 printdebug_(iConfig.getUntrackedParameter<uint32_t>("printDebug",1)){}
SiStripNoisesBuilder::~SiStripNoisesBuilder | ( | ) | [inline] |
void SiStripNoisesBuilder::analyze | ( | const edm::Event & | evt, | |
const edm::EventSetup & | iSetup | |||
) | [virtual] |
Implements edm::EDAnalyzer.
Definition at line 11 of file SiStripNoisesBuilder.cc.
References count, lat::endl(), fp_, edm::FileInPath::fullPath(), edm::Event::id(), edm::Service< T >::isAvailable(), it, VarParsing::obj, printdebug_, SiStripNoises::put(), mergeAndRegister_online::run, SiStripNoises::setData(), and strip().
00011 { 00012 00013 unsigned int run=evt.id().run(); 00014 00015 edm::LogInfo("SiStripNoisesBuilder") << "... creating dummy SiStripNoises Data for Run " << run << "\n " << std::endl; 00016 00017 SiStripNoises* obj = new SiStripNoises(); 00018 00019 SiStripDetInfoFileReader reader(fp_.fullPath()); 00020 00021 const std::map<uint32_t, SiStripDetInfoFileReader::DetInfo > DetInfos = reader.getAllData(); 00022 00023 int count=-1; 00024 for(std::map<uint32_t, SiStripDetInfoFileReader::DetInfo >::const_iterator it = DetInfos.begin(); it != DetInfos.end(); it++){ 00025 count++; 00026 //Generate Noise for det detid 00027 SiStripNoises::InputVector theSiStripVector; 00028 for(int strip=0; strip<128*it->second.nApvs; ++strip){ 00029 00030 float MeanNoise = 5; 00031 float RmsNoise = 1; 00032 00033 float noise = RandGauss::shoot(MeanNoise,RmsNoise); 00034 00035 //double badStripProb = .5; 00036 //bool disable = (RandFlat::shoot(1.) < badStripProb ? true:false); 00037 00038 obj->setData(noise,theSiStripVector); 00039 if (count<printdebug_) 00040 edm::LogInfo("SiStripNoisesBuilder") << "detid " << it->first << " \t" 00041 << " strip " << strip << " \t" 00042 << noise << " \t" 00043 << theSiStripVector.back()/10 << " \t" 00044 << std::endl; 00045 } 00046 00047 if ( ! obj->put(it->first,theSiStripVector) ) 00048 edm::LogError("SiStripNoisesBuilder")<<"[SiStripNoisesBuilder::analyze] detid already exists"<<std::endl; 00049 } 00050 00051 00052 //End now write sistripnoises data in DB 00053 edm::Service<cond::service::PoolDBOutputService> mydbservice; 00054 00055 if( mydbservice.isAvailable() ){ 00056 if ( mydbservice->isNewTagRequest("SiStripNoisesRcd") ){ 00057 mydbservice->createNewIOV<SiStripNoises>(obj,mydbservice->beginOfTime(),mydbservice->endOfTime(),"SiStripNoisesRcd"); 00058 } else { 00059 //mydbservice->createNewIOV<SiStripNoises>(obj,mydbservice->currentTime(),"SiStripNoisesRcd"); 00060 mydbservice->appendSinceTime<SiStripNoises>(obj,mydbservice->currentTime(),"SiStripNoisesRcd"); 00061 } 00062 }else{ 00063 edm::LogError("SiStripNoisesBuilder")<<"Service is unavailable"<<std::endl; 00064 } 00065 }
edm::FileInPath SiStripNoisesBuilder::fp_ [private] |
uint32_t SiStripNoisesBuilder::printdebug_ [private] |