CMS 3D CMS Logo

SiStripApvGainBuilder.cc
Go to the documentation of this file.
3 #include <iostream>
4 #include <fstream>
5 
7  : fp_(iConfig.getUntrackedParameter<edm::FileInPath>(
8  "file", edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"))),
9  printdebug_(iConfig.getUntrackedParameter<uint32_t>("printDebug", 1)) {}
10 
12  unsigned int run = evt.id().run();
13 
14  edm::LogInfo("SiStripApvGainBuilder") << "... creating dummy SiStripApvGain Data for Run " << run << "\n "
15  << std::endl;
16 
18 
20 
21  const std::map<uint32_t, SiStripDetInfoFileReader::DetInfo>& DetInfos = reader.getAllData();
22 
23  int count = -1;
24  for (std::map<uint32_t, SiStripDetInfoFileReader::DetInfo>::const_iterator it = DetInfos.begin();
25  it != DetInfos.end();
26  it++) {
27  count++;
28  //Generate Gain for det detid
29  std::vector<float> theSiStripVector;
30  for (unsigned short j = 0; j < it->second.nApvs; j++) {
31  float gain = (j + 1) * 1000 + (CLHEP::RandFlat::shoot(1.) * 100);
32  if (count < printdebug_)
33  edm::LogInfo("SiStripApvGainBuilder") << "detid " << it->first << " \t"
34  << " apv " << j << " \t" << gain << " \t" << std::endl;
35  theSiStripVector.push_back(gain);
36  }
37 
38  SiStripApvGain::Range range(theSiStripVector.begin(), theSiStripVector.end());
39  if (!obj->put(it->first, range))
40  edm::LogError("SiStripApvGainBuilder") << "[SiStripApvGainBuilder::analyze] detid already exists" << std::endl;
41  }
42 
43  //End now write sistripnoises data in DB
45 
46  if (mydbservice.isAvailable()) {
47  if (mydbservice->isNewTagRequest("SiStripApvGainRcd")) {
48  mydbservice->createNewIOV<SiStripApvGain>(
49  obj, mydbservice->beginOfTime(), mydbservice->endOfTime(), "SiStripApvGainRcd");
50  } else {
51  mydbservice->appendSinceTime<SiStripApvGain>(obj, mydbservice->currentTime(), "SiStripApvGainRcd");
52  }
53  } else {
54  edm::LogError("SiStripApvGainBuilder") << "Service is unavailable" << std::endl;
55  }
56 }
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
cond::service::PoolDBOutputService::beginOfTime
cond::Time_t beginOfTime() const
Definition: PoolDBOutputService.cc:187
edm
HLT enums.
Definition: AlignableModifier.h:19
cond::service::PoolDBOutputService::appendSinceTime
void appendSinceTime(const T *payloadObj, cond::Time_t sinceTime, const std::string &recordName)
Definition: PoolDBOutputService.h:135
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
SiStripDetInfoFileReader
Definition: SiStripDetInfoFileReader.h:30
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
cond::service::PoolDBOutputService::createNewIOV
void createNewIOV(const T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t, const std::string &recordName)
Definition: PoolDBOutputService.h:110
DQM.reader
reader
Definition: DQM.py:105
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
SiStripApvGainBuilder::fp_
edm::FileInPath fp_
Definition: SiStripApvGainBuilder.h:25
edm::Service< cond::service::PoolDBOutputService >
SiStripApvGainBuilder.h
edm::EventSetup
Definition: EventSetup.h:57
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
PedestalClient_cfi.gain
gain
Definition: PedestalClient_cfi.py:37
cond::service::PoolDBOutputService::endOfTime
cond::Time_t endOfTime() const
Definition: PoolDBOutputService.cc:185
SiStripApvGainBuilder::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: SiStripApvGainBuilder.cc:11
writedatasetfile.run
run
Definition: writedatasetfile.py:27
SiStripApvGainBuilder::SiStripApvGainBuilder
SiStripApvGainBuilder(const edm::ParameterSet &iConfig)
Definition: SiStripApvGainBuilder.cc:6
SiStripApvGain::Range
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripApvGain.h:28
edm::EventBase::id
edm::EventID id() const
Definition: EventBase.h:59
cond::service::PoolDBOutputService::isNewTagRequest
bool isNewTagRequest(const std::string &recordName)
Definition: PoolDBOutputService.cc:100
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::Event
Definition: Event.h:73
SiStripApvGain
Definition: SiStripApvGain.h:25
edm::Log
Definition: MessageLogger.h:70
SiStripApvGainBuilder::printdebug_
bool printdebug_
Definition: SiStripApvGainBuilder.h:26
cond::service::PoolDBOutputService::currentTime
cond::Time_t currentTime() const
Definition: PoolDBOutputService.cc:189
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:163