CMS 3D CMS Logo

SiStripThresholdBuilder.cc
Go to the documentation of this file.
3 #include <iostream>
4 #include <fstream>
5 
7  : fp_(iConfig.getUntrackedParameter<edm::FileInPath>("file",
9  printdebug_(iConfig.getUntrackedParameter<uint32_t>("printDebug", 3)) {}
10 
12  unsigned int run = evt.id().run();
13 
14  edm::LogInfo("SiStripThresholdBuilder")
15  << "... creating dummy SiStripThreshold Data for Run " << run << "\n " << std::endl;
16 
18 
19  int count = -1;
20  for (const auto& it : SiStripDetInfoFileReader::read(fp_.fullPath()).getAllData()) {
21  count++;
22  //Generate Pedestal for det detid
23  SiStripThreshold::Container theSiStripVector;
24  uint16_t strip = 0;
25  while (strip < 128 * it.second.nApvs) {
26  float lTh = (CLHEP::RandFlat::shoot(1.) * 64) / 5;
27  float hTh = (CLHEP::RandFlat::shoot(1.) * 64) / 5;
28  if (hTh < lTh) {
29  float tmp = hTh;
30  hTh = lTh;
31  lTh = tmp;
32  }
33  float cTh = (CLHEP::RandFlat::shoot(1.) * 30.);
34 
35  obj->setData(strip, lTh, hTh, cTh, theSiStripVector);
36  if (count < (int)printdebug_) {
37  std::stringstream ss;
38  theSiStripVector.back().print(ss);
39  edm::LogInfo("SiStripThresholdBuilder")
40  << "detid: " << it.first << " \n"
41  << "firstStrip: " << strip << " \t"
42  << "lTh: " << lTh << " \t"
43  << "hTh: " << hTh << " \t"
44  << "cTh: " << cTh << " \t"
45  << "FirstStrip_and_Hth: " << theSiStripVector.back().FirstStrip_and_Hth << " \n"
46  << ss.str() << std::endl;
47  }
48  obj->setData(strip + 1, lTh, hTh, theSiStripVector);
49  strip = (uint16_t)(CLHEP::RandFlat::shoot(strip + 2, 128 * it.second.nApvs));
50  }
51  if (!obj->put(it.first, theSiStripVector))
52  edm::LogError("SiStripThresholdBuilder")
53  << "[SiStripThresholdBuilder::analyze] detid already exists" << std::endl;
54  }
55 
56  //End now write sistrippedestals data in DB
58 
59  if (mydbservice.isAvailable()) {
60  if (mydbservice->isNewTagRequest("SiStripThresholdRcd")) {
61  mydbservice->createNewIOV<SiStripThreshold>(
62  obj, mydbservice->beginOfTime(), mydbservice->endOfTime(), "SiStripThresholdRcd");
63  } else {
64  mydbservice->appendSinceTime<SiStripThreshold>(obj, mydbservice->currentTime(), "SiStripThresholdRcd");
65  }
66  } else {
67  edm::LogError("SiStripThresholdBuilder") << "Service is unavailable" << std::endl;
68  }
69 }
SiStripThresholdBuilder::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: SiStripThresholdBuilder.cc:11
cond::service::PoolDBOutputService::beginOfTime
cond::Time_t beginOfTime() const
Definition: PoolDBOutputService.cc:215
edm
HLT enums.
Definition: AlignableModifier.h:19
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
cond::service::PoolDBOutputService::appendSinceTime
void appendSinceTime(const T *payloadObj, cond::Time_t sinceTime, const std::string &recordName)
Definition: PoolDBOutputService.h:141
SiStripDetInfoFileReader
Definition: SiStripDetInfoFileReader.h:7
SiStripThreshold::Container
std::vector< Data > Container
Definition: SiStripThreshold.h:104
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
SiStripDetInfoFileReader::read
SiStripDetInfo read(std::string filePath)
Definition: SiStripDetInfoFileReader.cc:11
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
cond::service::PoolDBOutputService::createNewIOV
void createNewIOV(const T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t, const std::string &recordName)
Definition: PoolDBOutputService.h:116
SiStripThresholdBuilder.h
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
SiStripDetInfoFileReader.h
edm::EventID::run
RunNumber_t run() const
Definition: EventID.h:38
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
edm::ParameterSet
Definition: ParameterSet.h:47
edm::Service< cond::service::PoolDBOutputService >
SiStripThresholdBuilder::SiStripThresholdBuilder
SiStripThresholdBuilder(const edm::ParameterSet &iConfig)
Definition: SiStripThresholdBuilder.cc:6
edm::EventSetup
Definition: EventSetup.h:58
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
cond::service::PoolDBOutputService::endOfTime
cond::Time_t endOfTime() const
Definition: PoolDBOutputService.cc:213
SiStripThreshold
Definition: __init__.py:1
writedatasetfile.run
run
Definition: writedatasetfile.py:27
SiStripDetInfoFileReader::kDefaultFile
constexpr static char const *const kDefaultFile
Definition: SiStripDetInfoFileReader.h:10
SiStripThresholdBuilder::fp_
edm::FileInPath fp_
Definition: SiStripThresholdBuilder.h:25
edm::EventBase::id
edm::EventID id() const
Definition: EventBase.h:59
cond::service::PoolDBOutputService::isNewTagRequest
bool isNewTagRequest(const std::string &recordName)
Definition: PoolDBOutputService.cc:128
edm::Event
Definition: Event.h:73
edm::Log
Definition: MessageLogger.h:70
SiStripThresholdBuilder::printdebug_
uint32_t printdebug_
Definition: SiStripThresholdBuilder.h:26
cond::service::PoolDBOutputService::currentTime
cond::Time_t currentTime() const
Definition: PoolDBOutputService.cc:217
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:161