File indexing completed on 2024-04-06 12:03:15
0001 #include <string>
0002 #include <map>
0003 #include <vector>
0004
0005 #include "FWCore/Framework/interface/EventSetup.h"
0006 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0007 #include "FWCore/Framework/interface/MakerMacros.h"
0008 #include "FWCore/Framework/interface/Event.h"
0009 #include "CondTools/RPC/interface/RPCDBSimSetUp.h"
0010 #include "DataFormats/MuonDetId/interface/RPCDetId.h"
0011 #include "CondFormats/RPCObjects/interface/RPCObCond.h"
0012 #include "CondFormats/DataRecord/interface/RPCObCondRcd.h"
0013 #include "CondTools/RPC/interface/RPCFw.h"
0014 #include "CoralBase/TimeStamp.h"
0015 #include "CondCore/DBOutputService/interface/PoolDBOutputService.h"
0016 #include "FWCore/ServiceRegistry/interface/Service.h"
0017
0018 class CondReader : public edm::one::EDAnalyzer<> {
0019 public:
0020 CondReader(const edm::ParameterSet& iConfig);
0021
0022 ~CondReader() override;
0023 void analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) override;
0024
0025 private:
0026 unsigned long long since;
0027 unsigned long long till;
0028 edm::ESGetToken<RPCObImon, RPCObImonRcd> condRcd_token_;
0029 };
0030
0031 CondReader::CondReader(const edm::ParameterSet& iConfig)
0032 : since(iConfig.getUntrackedParameter<unsigned long long>("since", 0)),
0033 till(iConfig.getUntrackedParameter<unsigned long long>("till", 0)),
0034 condRcd_token_(esConsumes()) {}
0035
0036 CondReader::~CondReader() {}
0037
0038 void CondReader::analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) {
0039 edm::Service<cond::service::PoolDBOutputService> mydbservice;
0040
0041 const RPCObImon* cond = &evtSetup.getData(condRcd_token_);
0042 edm::LogInfo("CondReader") << "[CondReader::analyze] End Reading Cond" << std::endl;
0043
0044 std::cout << "Run start: " << since << " - Run stop: " << till << std::endl;
0045
0046 RPCFw time("", "", "");
0047 coral::TimeStamp sTime = time.UTtoT(since);
0048 coral::TimeStamp tTime = time.UTtoT(till);
0049 int ndateS = (sTime.day() * 10000) + (sTime.month() * 100) + (sTime.year() - 2000);
0050 int ntimeS = (sTime.hour() * 10000) + (sTime.minute() * 100) + sTime.second();
0051 int ndateT = (tTime.day() * 10000) + (tTime.month() * 100) + (tTime.year() - 2000);
0052 int ntimeT = (tTime.hour() * 10000) + (tTime.minute() * 100) + tTime.second();
0053 std::cout << "Run start: " << ndateS << " " << ntimeS << " - Run stop: " << ndateT << " " << ntimeT << std::endl;
0054
0055 std::vector<RPCObImon::I_Item> mycond = cond->ObImon_rpc;
0056 std::vector<RPCObImon::I_Item>::iterator icond;
0057
0058 std::cout << "************************************" << std::endl;
0059 for (icond = mycond.begin(); icond < mycond.end(); ++icond) {
0060 if (icond->day >= ndateS && icond->time >= ntimeS && icond->day <= ndateT && icond->time <= ntimeT)
0061 std::cout << "dpid = " << icond->dpid << " - value = " << icond->value << " - day = " << icond->day
0062 << " - time = " << icond->time << std::endl;
0063 }
0064 }
0065
0066
0067 DEFINE_FWK_MODULE(CondReader);