CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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();
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 
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
CondReader(const edm::ParameterSet &iConfig)
Definition: CondReader.cc:32
Definition: RPCFw.h:32
unsigned long long till
Definition: CondReader.cc:28
coral::TimeStamp UTtoT(long long utime)
Definition: RPCFw.cc:1487
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
std::vector< I_Item > ObImon_rpc
Definition: RPCObCond.h:23
unsigned long long since
Definition: CondReader.cc:27
void analyze(const edm::Event &evt, const edm::EventSetup &evtSetup) override
Definition: CondReader.cc:39
tuple cout
Definition: gather_cfg.py:121