CMS 3D CMS Logo

CondReader.cc
Go to the documentation of this file.
1 #include <string>
2 #include <map>
3 #include <vector>
4 
15 #include "CoralBase/TimeStamp.h"
18 
19 class CondReader : public edm::EDAnalyzer {
20 public:
21  CondReader(const edm::ParameterSet& iConfig);
22 
23  ~CondReader() override;
24  void analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) override;
25 
26 private:
27  unsigned long long since;
28  unsigned long long till;
29 };
30 
32  : since(iConfig.getUntrackedParameter<unsigned long long>("since", 0)),
33  till(iConfig.getUntrackedParameter<unsigned long long>("till", 0)) {}
34 
36 
37 void CondReader::analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) {
39 
41  evtSetup.get<RPCObImonRcd>().get(condRcd);
42  edm::LogInfo("CondReader") << "[CondReader::analyze] End Reading Cond" << std::endl;
43 
44  std::cout << "Run start: " << since << " - Run stop: " << till << std::endl;
45 
46  RPCFw time("", "", "");
47  coral::TimeStamp sTime = time.UTtoT(since);
48  coral::TimeStamp tTime = time.UTtoT(till);
49  int ndateS = (sTime.day() * 10000) + (sTime.month() * 100) + (sTime.year() - 2000);
50  int ntimeS = (sTime.hour() * 10000) + (sTime.minute() * 100) + sTime.second();
51  int ndateT = (tTime.day() * 10000) + (tTime.month() * 100) + (tTime.year() - 2000);
52  int ntimeT = (tTime.hour() * 10000) + (tTime.minute() * 100) + tTime.second();
53  std::cout << "Run start: " << ndateS << " " << ntimeS << " - Run stop: " << ndateT << " " << ntimeT << std::endl;
54 
55  const RPCObImon* cond = condRcd.product();
56  std::vector<RPCObImon::I_Item> mycond = cond->ObImon_rpc;
57  std::vector<RPCObImon::I_Item>::iterator icond;
58 
59  std::cout << "************************************" << std::endl;
60  for (icond = mycond.begin(); icond < mycond.end(); ++icond) {
61  if (icond->day >= ndateS && icond->time >= ntimeS && icond->day <= ndateT && icond->time <= ntimeT)
62  std::cout << "dpid = " << icond->dpid << " - value = " << icond->value << " - day = " << icond->day
63  << " - time = " << icond->time << std::endl;
64  }
65 }
66 
67 //define this as a plug-in
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
ESHandle.h
RPCDBSimSetUp.h
RPCObImon
Definition: RPCObCond.h:15
RPCObCondRcd.h
gather_cfg.cout
cout
Definition: gather_cfg.py:144
edm::LogInfo
Definition: MessageLogger.h:254
EDAnalyzer.h
edm::EDAnalyzer
Definition: EDAnalyzer.h:29
CondReader::analyze
void analyze(const edm::Event &evt, const edm::EventSetup &evtSetup) override
Definition: CondReader.cc:37
MakerMacros.h
RPCObImonRcd
Definition: RPCObCondRcd.h:24
PoolDBOutputService.h
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Service.h
CondReader::since
unsigned long long since
Definition: CondReader.cc:27
edm::ESHandle
Definition: DTSurvey.h:22
writeEcalDQMStatus.since
since
Definition: writeEcalDQMStatus.py:53
ntuplemaker.till
till
Definition: ntuplemaker.py:198
RPCDetId.h
cond
Definition: plugin.cc:23
edm::ParameterSet
Definition: ParameterSet.h:36
RPCFw
Definition: RPCFw.h:29
Event.h
CondReader::CondReader
CondReader(const edm::ParameterSet &iConfig)
Definition: CondReader.cc:31
edm::Service< cond::service::PoolDBOutputService >
CondReader
Definition: CondReader.cc:19
edm::EventSetup
Definition: EventSetup.h:57
get
#define get
RPCFw.h
CondReader::till
unsigned long long till
Definition: CondReader.cc:28
CondReader::~CondReader
~CondReader() override
Definition: CondReader.cc:35
EventSetup.h
RPCObCond.h
ntuplemaker.time
time
Definition: ntuplemaker.py:310
edm::Event
Definition: Event.h:73