CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CondReader.cc
Go to the documentation of this file.
1 #include <string>
2 #include <map>
3 #include <vector>
4 
14 #include "CoralBase/TimeStamp.h"
17 
18 class CondReader : public edm::one::EDAnalyzer<> {
19 public:
21 
22  ~CondReader() override;
23  void analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) override;
24 
25 private:
26  unsigned long long since;
27  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  condRcd_token_(esConsumes()) {}
35 
37 
38 void CondReader::analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) {
40 
41  const RPCObImon* cond = &evtSetup.getData(condRcd_token_);
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  std::vector<RPCObImon::I_Item> mycond = cond->ObImon_rpc;
56  std::vector<RPCObImon::I_Item>::iterator icond;
57 
58  std::cout << "************************************" << std::endl;
59  for (icond = mycond.begin(); icond < mycond.end(); ++icond) {
60  if (icond->day >= ndateS && icond->time >= ntimeS && icond->day <= ndateT && icond->time <= ntimeT)
61  std::cout << "dpid = " << icond->dpid << " - value = " << icond->value << " - day = " << icond->day
62  << " - time = " << icond->time << std::endl;
63  }
64 }
65 
66 //define this as a plug-in
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
CondReader(const edm::ParameterSet &iConfig)
Definition: CondReader.cc:31
Definition: RPCFw.h:29
unsigned long long till
Definition: CondReader.cc:27
edm::ESGetToken< RPCObImon, RPCObImonRcd > condRcd_token_
Definition: CondReader.cc:28
bool getData(T &iHolder) const
Definition: EventSetup.h:128
~CondReader() override
Definition: CondReader.cc:36
coral::TimeStamp UTtoT(long long utime)
Definition: RPCFw.cc:1731
Log< level::Info, false > LogInfo
std::vector< I_Item > ObImon_rpc
Definition: RPCObCond.h:27
unsigned long long since
Definition: CondReader.cc:26
void analyze(const edm::Event &evt, const edm::EventSetup &evtSetup) override
Definition: CondReader.cc:38
tuple cout
Definition: gather_cfg.py:144
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283