CMS 3D CMS Logo

SiStripNoisesBuilder.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 
11 void SiStripNoisesBuilder::analyze(const edm::Event& evt, const edm::EventSetup& iSetup) {
12  unsigned int run = evt.id().run();
13 
14  edm::LogInfo("SiStripNoisesBuilder") << "... creating dummy SiStripNoises Data for Run " << run << "\n " << std::endl;
15 
17 
19 
20  const std::map<uint32_t, SiStripDetInfoFileReader::DetInfo>& DetInfos = reader.getAllData();
21 
22  int count = -1;
23  for (std::map<uint32_t, SiStripDetInfoFileReader::DetInfo>::const_iterator it = DetInfos.begin();
24  it != DetInfos.end();
25  it++) {
26  count++;
27  //Generate Noise for det detid
28  SiStripNoises::InputVector theSiStripVector;
29  for (int strip = 0; strip < 128 * it->second.nApvs; ++strip) {
30  float MeanNoise = 5;
31  float RmsNoise = 1;
32  float noise = CLHEP::RandGauss::shoot(MeanNoise, RmsNoise);
33 
34  //double badStripProb = .5;
35  //bool disable = (CLHEP::RandFlat::shoot(1.) < badStripProb ? true:false);
36 
37  obj->setData(noise, theSiStripVector);
38  if (count < static_cast<int>(printdebug_))
39  edm::LogInfo("SiStripNoisesBuilder")
40  << "detid " << it->first << " \t"
41  << " strip " << strip << " \t" << noise << " \t" << theSiStripVector.back() / 10 << " \t" << std::endl;
42  }
43 
44  if (!obj->put(it->first, theSiStripVector))
45  edm::LogError("SiStripNoisesBuilder") << "[SiStripNoisesBuilder::analyze] detid already exists" << std::endl;
46  }
47 
48  //End now write sistripnoises data in DB
50 
51  if (mydbservice.isAvailable()) {
52  if (mydbservice->isNewTagRequest("SiStripNoisesRcd")) {
53  mydbservice->createNewIOV<SiStripNoises>(
54  obj, mydbservice->beginOfTime(), mydbservice->endOfTime(), "SiStripNoisesRcd");
55  } else {
56  //mydbservice->createNewIOV<SiStripNoises>(obj,mydbservice->currentTime(),"SiStripNoisesRcd");
57  mydbservice->appendSinceTime<SiStripNoises>(obj, mydbservice->currentTime(), "SiStripNoisesRcd");
58  }
59  } else {
60  edm::LogError("SiStripNoisesBuilder") << "Service is unavailable" << std::endl;
61  }
62 }
cond::service::PoolDBOutputService::beginOfTime
cond::Time_t beginOfTime() const
Definition: PoolDBOutputService.cc:215
SiStripNoises
Definition: SiStripNoises.h:25
SiStripNoisesBuilder::printdebug_
uint32_t printdebug_
Definition: SiStripNoisesBuilder.h:25
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
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
SiStripNoisesBuilder::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: SiStripNoisesBuilder.cc:11
cond::service::PoolDBOutputService::createNewIOV
void createNewIOV(const T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t, const std::string &recordName)
Definition: PoolDBOutputService.h:116
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
SiStripNoisesBuilder::fp_
edm::FileInPath fp_
Definition: SiStripNoisesBuilder.h:24
edm::ParameterSet
Definition: ParameterSet.h:47
hgcalDigitizer_cfi.noise
noise
Definition: hgcalDigitizer_cfi.py:155
edm::Service< cond::service::PoolDBOutputService >
edm::EventSetup
Definition: EventSetup.h:57
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
cond::service::PoolDBOutputService::endOfTime
cond::Time_t endOfTime() const
Definition: PoolDBOutputService.cc:213
writedatasetfile.run
run
Definition: writedatasetfile.py:27
SiStripNoisesBuilder::SiStripNoisesBuilder
SiStripNoisesBuilder(const edm::ParameterSet &iConfig)
Definition: SiStripNoisesBuilder.cc:6
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
SiStripNoises::InputVector
std::vector< uint16_t > InputVector
Definition: SiStripNoises.h:50
edm::Event
Definition: Event.h:73
edm::Log
Definition: MessageLogger.h:70
cond::service::PoolDBOutputService::currentTime
cond::Time_t currentTime() const
Definition: PoolDBOutputService.cc:217
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:163
SiStripNoisesBuilder.h