CMS 3D CMS Logo

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:
20  CondReader(const edm::ParameterSet& iConfig);
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
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
#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
~CondReader() override
Definition: CondReader.cc:36
bool getData(T &iHolder) const
Definition: EventSetup.h:122
Log< level::Info, false > LogInfo
unsigned long long since
Definition: CondReader.cc:26
Definition: plugin.cc:23
void analyze(const edm::Event &evt, const edm::EventSetup &evtSetup) override
Definition: CondReader.cc:38