CMS 3D CMS Logo

SiStripSummaryBuilder.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  iConfig_(iConfig) {}
11 
13  unsigned int run = evt.id().run();
14  edm::LogInfo("SiStripSummaryBuilder") << "... creating dummy SiStripSummary Data for Run " << run << "\n "
15  << std::endl;
16 
18  obj->setRunNr(run);
19 
20  //* DISCOVER SET OF HISTOGRAMS & QUANTITIES TO BE UPLOADED*//
21 
22  std::vector<std::string> userDBContent;
23  typedef std::vector<edm::ParameterSet> VParameters;
24  VParameters histoList = iConfig_.getParameter<VParameters>("histoList");
25  VParameters::iterator ithistoList = histoList.begin();
26  VParameters::iterator ithistoListEnd = histoList.end();
27 
28  for (; ithistoList != ithistoListEnd; ++ithistoList) {
29  std::string keyName = ithistoList->getUntrackedParameter<std::string>("keyName");
30  std::vector<std::string> Quantities =
31  ithistoList->getUntrackedParameter<std::vector<std::string> >("quantitiesToExtract");
32  for (size_t i = 0; i < Quantities.size(); ++i) {
33  if (Quantities[i] == "landau") {
34  userDBContent.push_back(keyName + std::string("@") + std::string("landauPeak"));
35  userDBContent.push_back(keyName + std::string("@") + std::string("landauPeakErr"));
36  userDBContent.push_back(keyName + std::string("@") + std::string("landauSFWHM"));
37  userDBContent.push_back(keyName + std::string("@") + std::string("landauChi2NDF"));
38  } else if (Quantities[i] == "gauss") {
39  userDBContent.push_back(keyName + std::string("@") + std::string("gaussMean"));
40  userDBContent.push_back(keyName + std::string("@") + std::string("gaussSigma"));
41  userDBContent.push_back(keyName + std::string("@") + std::string("gaussChi2NDF"));
42  } else if (Quantities[i] == "stat") {
43  userDBContent.push_back(keyName + std::string("@") + std::string("entries"));
44  userDBContent.push_back(keyName + std::string("@") + std::string("mean"));
45  userDBContent.push_back(keyName + std::string("@") + std::string("rms"));
46  } else {
47  edm::LogError("SiStripSummaryBuilder")
48  << "Quantity " << Quantities[i] << " cannot be handled\nAllowed quantities are"
49  << "\n 'stat' that includes: entries, mean, rms"
50  << "\n 'landau' that includes: landauPeak, landauPeakErr, landauSFWHM, landauChi2NDF"
51  << "\n 'gauss' that includes: gaussMean, gaussSigma, gaussChi2NDF" << std::endl;
52  }
53  }
54  }
55  obj->setUserDBContent(userDBContent);
56 
57  std::stringstream ss1;
58  ss1 << "QUANTITIES TO BE INSERTED IN DB :"
59  << " \n";
60  std::vector<std::string> userDBContentA = obj->getUserDBContent();
61  for (size_t i = 0; i < userDBContentA.size(); ++i)
62  ss1 << userDBContentA[i] << std::endl;
63  edm::LogInfo("SiStripSummaryBuilder") << ss1.str();
64 
65  //* Loop over detids and create dummy data for each *//
66 
67  std::stringstream ss2;
68  for (uint32_t detid = 0; detid < 430; detid++) {
70  for (unsigned int i = 0; i < userDBContent.size(); i++)
71  values.push_back((float)CLHEP::RandGauss::shoot(50., 30.));
72 
73  ss2 << "\n\tdetid " << detid;
74  for (size_t j = 0; j < values.size(); ++j)
75  ss2 << "\n\t\t " << userDBContent[j] << " " << values[j];
76 
77  obj->put(detid, values, userDBContent);
78 
79  // See CondFormats/SiStripObjects/SiStripSummary.h for detid definitions
80 
81  if (detid == 4)
82  detid = 10;
83  if (detid == 14)
84  detid = 20;
85  if (detid == 26)
86  detid = 30;
87  if (detid == 32)
88  detid = 40;
89  if (detid == 42)
90  detid = 310;
91  if (detid == 313)
92  detid = 320;
93  if (detid == 323)
94  detid = 410;
95  if (detid == 419)
96  detid = 420;
97  }
98 
99  edm::LogInfo("SiStripSummaryBuilder") << ss2.str();
100 
101  //* Insert summary informations in the DB *//
102 
104 
105  if (mydbservice.isAvailable()) {
106  if (mydbservice->isNewTagRequest("SiStripSummaryRcd")) {
107  mydbservice->createNewIOV<SiStripSummary>(
108  obj, mydbservice->beginOfTime(), mydbservice->endOfTime(), "SiStripSummaryRcd");
109  } else {
110  mydbservice->appendSinceTime<SiStripSummary>(obj, mydbservice->currentTime(), "SiStripSummaryRcd");
111  }
112  } else {
113  edm::LogError("SiStripSummaryBuilder") << "Service is unavailable" << std::endl;
114  }
115 }
mps_fire.i
i
Definition: mps_fire.py:428
SiStripBadComponentsDQMServiceTemplate_cfg.histoList
histoList
Definition: SiStripBadComponentsDQMServiceTemplate_cfg.py:78
cond::service::PoolDBOutputService::beginOfTime
cond::Time_t beginOfTime() const
Definition: PoolDBOutputService.cc:215
SiStripSummaryBuilder::iConfig_
edm::ParameterSet iConfig_
Definition: SiStripSummaryBuilder.h:28
edm
HLT enums.
Definition: AlignableModifier.h:19
SiStripSummaryBuilder::SiStripSummaryBuilder
SiStripSummaryBuilder(const edm::ParameterSet &iConfig)
Definition: SiStripSummaryBuilder.cc:6
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
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:116
contentValuesCheck.values
values
Definition: contentValuesCheck.py:38
SiStripSummary
Definition: SiStripSummary.h:66
SiStripDetInfoFileReader.h
edm::EventID::run
RunNumber_t run() const
Definition: EventID.h:38
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
SiStripSummary::InputVector
std::vector< float > InputVector
Definition: SiStripSummary.h:86
edm::Service< cond::service::PoolDBOutputService >
SiStripSummaryBuilder::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: SiStripSummaryBuilder.cc:12
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
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::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
SiStripSummaryBuilder.h
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::Event
Definition: Event.h:73
cond::service::PoolDBOutputService::currentTime
cond::Time_t currentTime() const
Definition: PoolDBOutputService.cc:217