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