File indexing completed on 2024-04-06 12:03:19
0001 #include "CondTools/RunInfo/interface/LHCInfoHelper.h"
0002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0003
0004
0005
0006
0007
0008 cond::Time_t cond::lhcInfoHelper::getFillLastLumiIOV(const cond::OMSService& oms, unsigned short fillId) {
0009
0010 auto query = oms.query("lumisections");
0011 query->addOutputVars({"lumisection_number", "run_number"});
0012 query->filterEQ("fill_number", fillId);
0013 query->limit(cond::lhcInfoHelper::kLumisectionsQueryLimit);
0014
0015
0016 if (!query->execute()) {
0017 throw cms::Exception("OMSQueryFailure")
0018 << "OMS query of fill " << fillId << " failed, status:" << query->status() << "\n";
0019 }
0020
0021
0022 auto queryResult = query->result();
0023 if (queryResult.empty()) {
0024 throw cms::Exception("OMSQueryFailure") << "OMS query of fill " << fillId << " returned empty result!\n";
0025 }
0026
0027
0028 auto lastRun = queryResult.back().get<int>("run_number");
0029 auto lastLumi = queryResult.back().get<unsigned short>("lumisection_number");
0030 return cond::time::lumiTime(lastRun, lastLumi);
0031 }