#include <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.
: fp_(iConfig.getUntrackedParameter<edm::FileInPath>("file",edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"))), printdebug_(iConfig.getUntrackedParameter<uint32_t>("printDebug",3)){}
SiStripThresholdBuilder::~SiStripThresholdBuilder | ( | ) | [inline] |
Definition at line 23 of file SiStripThresholdBuilder.h.
{};
void SiStripThresholdBuilder::analyze | ( | const edm::Event & | evt, |
const edm::EventSetup & | iSetup | ||
) | [virtual] |
Implements edm::EDAnalyzer.
Definition at line 11 of file SiStripThresholdBuilder.cc.
References prof2calltree::count, fp_, edm::FileInPath::fullPath(), SiStripDetInfoFileReader::getAllData(), edm::EventBase::id(), edm::Service< T >::isAvailable(), VarParsing::obj, printdebug_, SiStripThreshold::put(), edm::EventID::run(), DTTTrigCorrFirst::run, edm::second(), SiStripThreshold::setData(), strip(), and tmp.
{ unsigned int run=evt.id().run(); edm::LogInfo("SiStripThresholdBuilder") << "... creating dummy SiStripThreshold Data for Run " << run << "\n " << std::endl; SiStripThreshold* obj = new SiStripThreshold(); SiStripDetInfoFileReader reader(fp_.fullPath()); const std::map<uint32_t, SiStripDetInfoFileReader::DetInfo > DetInfos = reader.getAllData(); int count=-1; for(std::map<uint32_t, SiStripDetInfoFileReader::DetInfo >::const_iterator it = DetInfos.begin(); it != DetInfos.end(); it++){ count++; //Generate Pedestal for det detid SiStripThreshold::Container theSiStripVector; uint16_t strip=0; while(strip<128*it->second.nApvs){ float lTh = (CLHEP::RandFlat::shoot(1.) * 64)/5; float hTh = (CLHEP::RandFlat::shoot(1.) * 64)/5; if (hTh < lTh){ float tmp = hTh; hTh = lTh; lTh = tmp; } float cTh = (CLHEP::RandFlat::shoot(1.) * 30.); obj->setData(strip,lTh,hTh,cTh,theSiStripVector); if (count<(int)printdebug_){ std::stringstream ss; theSiStripVector.back().print(ss); edm::LogInfo("SiStripThresholdBuilder") <<"detid: " << it->first << " \n" << "firstStrip: " << strip << " \t" << "lTh: " << lTh << " \t" << "hTh: " << hTh << " \t" << "cTh: " << cTh << " \t" << "FirstStrip_and_Hth: " << theSiStripVector.back().FirstStrip_and_Hth << " \n" << ss.str() << std::endl; } obj->setData(strip+1,lTh,hTh,theSiStripVector); strip=(uint16_t) (CLHEP::RandFlat::shoot(strip+2,128*it->second.nApvs)); } if ( ! obj->put(it->first,theSiStripVector) ) edm::LogError("SiStripThresholdBuilder")<<"[SiStripThresholdBuilder::analyze] detid already exists"<<std::endl; } //End now write sistrippedestals data in DB edm::Service<cond::service::PoolDBOutputService> mydbservice; if( mydbservice.isAvailable() ){ if ( mydbservice->isNewTagRequest("SiStripThresholdRcd") ){ mydbservice->createNewIOV<SiStripThreshold>(obj,mydbservice->beginOfTime(),mydbservice->endOfTime(),"SiStripThresholdRcd"); } else { mydbservice->appendSinceTime<SiStripThreshold>(obj,mydbservice->currentTime(),"SiStripThresholdRcd"); } }else{ edm::LogError("SiStripThresholdBuilder")<<"Service is unavailable"<<std::endl; } }
edm::FileInPath SiStripThresholdBuilder::fp_ [private] |
Definition at line 28 of file SiStripThresholdBuilder.h.
Referenced by analyze().
uint32_t SiStripThresholdBuilder::printdebug_ [private] |
Definition at line 29 of file SiStripThresholdBuilder.h.
Referenced by analyze().