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 
31 
33  since(iConfig.getUntrackedParameter<unsigned long long>("since",0)),
34  till(iConfig.getUntrackedParameter<unsigned long long>("till",0))
35 {}
36 
38 
39 void CondReader::analyze(const edm::Event& evt, const edm::EventSetup& evtSetup)
40 {
41 
43 
45  evtSetup.get<RPCObImonRcd>().get(condRcd);
46  edm::LogInfo("CondReader") << "[CondReader::analyze] End Reading Cond" << std::endl;
47 
48  std::cout << "Run start: " << since << " - Run stop: " << till << std::endl;
49 
50  RPCFw time ("", "", "");
51  coral::TimeStamp sTime = time.UTtoT(since);
52  coral::TimeStamp tTime = time.UTtoT(till);
53  int ndateS = (sTime.day() * 10000) + (sTime.month() * 100) + (sTime.year()-2000);
54  int ntimeS = (sTime.hour() * 10000) + (sTime.minute() * 100) + sTime.second();
55  int ndateT = (tTime.day() * 10000) + (tTime.month() * 100) + (tTime.year()-2000);
56  int ntimeT = (tTime.hour() * 10000) + (tTime.minute() * 100) + tTime.second();
57  std::cout << "Run start: " << ndateS << " " << ntimeS << " - Run stop: " << ndateT << " " << ntimeT << std::endl;
58 
59  const RPCObImon* cond = condRcd.product();
60  std::vector<RPCObImon::I_Item> mycond = cond->ObImon_rpc;
61  std::vector<RPCObImon::I_Item>::iterator icond;
62 
63  std::cout << "************************************" << std::endl;
64  for(icond = mycond.begin(); icond < mycond.end(); ++icond){
65 
66  if (icond->day >= ndateS && icond->time >= ntimeS && icond->day <= ndateT && icond->time <= ntimeT)
67  std::cout<<"dpid = " << icond->dpid << " - value = " << icond->value << " - day = " << icond->day << " - time = " << icond->time << std::endl;
68  }
69 
70 }
71 
72 //define this as a plug-in
74 
CondReader(const edm::ParameterSet &iConfig)
Definition: CondReader.cc:32
Definition: RPCFw.h:32
unsigned long long till
Definition: CondReader.cc:28
~CondReader() override
Definition: CondReader.cc:37
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
coral::TimeStamp UTtoT(long long utime)
Definition: RPCFw.cc:1487
std::vector< I_Item > ObImon_rpc
Definition: RPCObCond.h:27
unsigned long long since
Definition: CondReader.cc:27
Definition: plugin.cc:24
void analyze(const edm::Event &evt, const edm::EventSetup &evtSetup) override
Definition: CondReader.cc:39
T get() const
Definition: EventSetup.h:71
T const * product() const
Definition: ESHandle.h:86