CMS 3D CMS Logo

LHCInfoPerLSPopConAnalyzer.cc
Go to the documentation of this file.
9 #include "CoralBase/Attribute.h"
10 #include "CoralBase/AttributeList.h"
11 #include "CoralBase/AttributeSpecification.h"
12 #include "CoralBase/TimeStamp.h"
17 #include "RelationalAccess/ICursor.h"
18 #include "RelationalAccess/IQuery.h"
19 #include "RelationalAccess/ISchema.h"
20 #include "RelationalAccess/ISessionProxy.h"
21 #include <cmath>
22 #include <iostream>
23 #include <memory>
24 #include <sstream>
25 #include <sstream>
26 #include <string>
27 #include <utility>
28 #include <vector>
29 
31 
33 //define this as a plug-in
35 
37 
39  LumiSectionFilter(const std::vector<std::pair<cond::Time_t, std::shared_ptr<LHCInfoPerLS>>>& samples)
40  : currLow(samples.begin()), currUp(samples.begin()), end(samples.end()) {
41  currUp++;
42  }
43 
44  void reset(const std::vector<std::pair<cond::Time_t, std::shared_ptr<LHCInfoPerLS>>>& samples) {
45  currLow = samples.begin();
46  currUp = samples.begin();
47  currUp++;
48  end = samples.end();
49  currentDipTime = 0;
50  }
51 
52  bool process(cond::Time_t dipTime) {
53  if (currLow == end)
54  return false;
55  bool search = false;
56  if (currentDipTime == 0) {
57  search = true;
58  } else {
59  if (dipTime == currentDipTime)
60  return true;
61  else {
63  if (currUp != end)
64  upper = currUp->first;
65  if (dipTime < upper && currentDipTime >= currLow->first)
66  return false;
67  else {
68  search = true;
69  }
70  }
71  }
72  if (search) {
73  while (currUp != end and currUp->first < dipTime) {
74  currLow++;
75  currUp++;
76  }
77  currentDipTime = dipTime;
78  return currLow != end;
79  }
80  return false;
81  }
82 
83  cond::Time_t currentSince() { return currLow->first; }
84  LHCInfoPerLS& currentPayload() { return *currLow->second; }
85 
86  std::vector<std::pair<cond::Time_t, std::shared_ptr<LHCInfoPerLS>>>::const_iterator current() { return currLow; }
87  std::vector<std::pair<cond::Time_t, std::shared_ptr<LHCInfoPerLS>>>::const_iterator currLow;
88  std::vector<std::pair<cond::Time_t, std::shared_ptr<LHCInfoPerLS>>>::const_iterator currUp;
89  std::vector<std::pair<cond::Time_t, std::shared_ptr<LHCInfoPerLS>>>::const_iterator end;
91  };
92 
93  bool comparePayloads(const LHCInfoPerLS& rhs, const LHCInfoPerLS& lhs) {
94  if (rhs.fillNumber() != lhs.fillNumber())
95  return false;
96  if (rhs.runNumber() != lhs.runNumber())
97  return false;
98  if (rhs.crossingAngleX() != lhs.crossingAngleX())
99  return false;
100  if (rhs.crossingAngleY() != lhs.crossingAngleY())
101  return false;
102  if (rhs.betaStarX() != lhs.betaStarX())
103  return false;
104  if (rhs.betaStarY() != lhs.betaStarY())
105  return false;
106  return true;
107  }
108 
109  size_t transferPayloads(const std::vector<std::pair<cond::Time_t, std::shared_ptr<LHCInfoPerLS>>>& buffer,
110  std::map<cond::Time_t, std::shared_ptr<LHCInfoPerLS>>& iovsToTransfer,
111  std::shared_ptr<LHCInfoPerLS>& prevPayload) {
112  size_t niovs = 0;
113  std::stringstream condIovs;
114  for (auto& iov : buffer) {
115  bool add = false;
116  auto payload = iov.second;
117  cond::Time_t since = iov.first;
118  if (iovsToTransfer.empty()) {
119  add = true;
120  } else {
121  LHCInfoPerLS& lastAdded = *iovsToTransfer.rbegin()->second;
122  if (!comparePayloads(lastAdded, *payload)) {
123  add = true;
124  }
125  }
126  if (add) {
127  niovs++;
128  condIovs << since << " ";
129  iovsToTransfer.insert(std::make_pair(since, payload));
130  prevPayload = iov.second;
131  }
132  }
133  edm::LogInfo("transferPayloads") << "TRANSFERED COND IOVS: " << condIovs.str();
134  return niovs;
135  }
136 
137 } // namespace theLHCInfoPerLSImpl
139 public:
141  : m_debug(pset.getUntrackedParameter<bool>("debug", false)),
142  m_startTime(),
143  m_endTime(),
144  m_samplingInterval((unsigned int)pset.getUntrackedParameter<unsigned int>("samplingInterval", 300)),
145  m_endFillMode(pset.getUntrackedParameter<bool>("endFill", true)),
146  m_name(pset.getUntrackedParameter<std::string>("name", "LHCInfoPerLSPopConSourceHandler")),
147  m_connectionString(pset.getUntrackedParameter<std::string>("connectionString", "")),
148  m_dipSchema(pset.getUntrackedParameter<std::string>("DIPSchema", "")),
149  m_authpath(pset.getUntrackedParameter<std::string>("authenticationPath", "")),
150  m_omsBaseUrl(pset.getUntrackedParameter<std::string>("omsBaseUrl", "")),
151  m_fillPayload(),
152  m_prevPayload(),
153  m_tmpBuffer() {
154  if (!pset.getUntrackedParameter<std::string>("startTime").empty()) {
155  m_startTime = boost::posix_time::time_from_string(pset.getUntrackedParameter<std::string>("startTime"));
156  }
157  boost::posix_time::ptime now = boost::posix_time::second_clock::local_time();
158  m_endTime = now;
159  if (!pset.getUntrackedParameter<std::string>("endTime").empty()) {
160  m_endTime = boost::posix_time::time_from_string(pset.getUntrackedParameter<std::string>("endTime"));
161  if (m_endTime > now)
162  m_endTime = now;
163  }
164  }
165  //L1: try with different m_dipSchema
166  //L2: try with different m_name
167  ~LHCInfoPerLSPopConSourceHandler() override = default;
168  void getNewObjects() override {
169  //if a new tag is created, transfer fake fill from 1 to the first fill for the first time
170  if (tagInfo().size == 0) {
171  edm::LogInfo(m_name) << "New tag " << tagInfo().name << "; from " << m_name << "::getNewObjects";
172  } else {
173  //check what is already inside the database
174  edm::LogInfo(m_name) << "got info for tag " << tagInfo().name << ": size " << tagInfo().size
175  << ", last object valid since " << tagInfo().lastInterval.since << " ( "
176  << boost::posix_time::to_iso_extended_string(
177  cond::time::to_boost(tagInfo().lastInterval.since))
178  << " ); from " << m_name << "::getNewObjects";
179  }
180 
181  cond::Time_t lastSince = tagInfo().lastInterval.since;
182  if (tagInfo().isEmpty()) {
183  // for a new or empty tag, an empty payload should be added on top with since=1
184  addEmptyPayload(1);
185  lastSince = 1;
186  } else {
187  edm::LogInfo(m_name) << "The last Iov in tag " << tagInfo().name << " valid since " << lastSince << "from "
188  << m_name << "::getNewObjects";
189  }
190 
191  boost::posix_time::ptime executionTime = boost::posix_time::second_clock::local_time();
192  cond::Time_t targetSince = 0;
193  cond::Time_t executionTimeIov = cond::time::from_boost(executionTime);
194  if (!m_startTime.is_not_a_date_time()) {
195  targetSince = cond::time::from_boost(m_startTime);
196  }
197  if (lastSince > targetSince)
198  targetSince = lastSince;
199 
200  edm::LogInfo(m_name) << "Starting sampling at "
201  << boost::posix_time::to_simple_string(cond::time::to_boost(targetSince));
202 
203  //retrieve the data from the relational database source
205  //configure the connection
206  if (m_debug) {
207  connection.setMessageVerbosity(coral::Debug);
208  } else {
209  connection.setMessageVerbosity(coral::Error);
210  }
211  connection.setAuthenticationPath(m_authpath);
212  connection.configure();
213  //create the sessions
214  cond::persistency::Session session = connection.createSession(m_connectionString, false);
215  // fetch last payload when available
216  if (!tagInfo().lastInterval.payloadId.empty()) {
218  session3.transaction().start(true);
220  session3.transaction().commit();
221 
222  // find startFillTime and endFillTime of the most recent fill already saved in the tag
223  if (m_prevPayload->fillNumber() != 0) {
224  cond::OMSService oms;
225  oms.connect(m_omsBaseUrl);
226  auto query = oms.query("fills");
227  query->addOutputVar("end_time");
228  query->filterEQ("fill_number", m_prevPayload->fillNumber());
229  bool foundFill = query->execute();
230  if (foundFill) {
231  auto result = query->result();
232 
233  if (!result.empty()) {
234  auto endFillTime = (*result.begin()).get<boost::posix_time::ptime>("end_time");
236  auto startFillTime = (*result.begin()).get<boost::posix_time::ptime>("start_time");
238  } else {
239  foundFill = false;
240  }
241  }
242  if (!foundFill) {
243  edm::LogError(m_name) << "Could not find end time of fill #" << m_prevPayload->fillNumber();
244  }
245  } else {
246  m_prevEndFillTime = 0;
248  }
249  }
250 
251  while (true) {
252  if (targetSince >= executionTimeIov) {
253  edm::LogInfo(m_name) << "Sampling ended at the time "
254  << boost::posix_time::to_simple_string(cond::time::to_boost(executionTimeIov));
255  break;
256  }
257  boost::posix_time::ptime targetTime = cond::time::to_boost(targetSince);
258  boost::posix_time::ptime startSampleTime;
259  boost::posix_time::ptime endSampleTime;
260 
261  cond::OMSService oms;
262  oms.connect(m_omsBaseUrl);
263  auto query = oms.query("fills");
264 
265  if (!m_endFillMode and m_prevPayload->fillNumber() and m_prevEndFillTime == 0ULL) {
266  // continue processing unfinished fill with some payloads already in the tag
267  edm::LogInfo(m_name) << "Searching started fill #" << m_prevPayload->fillNumber();
268  query->filterEQ("fill_number", m_prevPayload->fillNumber());
269  bool foundFill = query->execute();
270  if (foundFill)
271  foundFill = makeFillPayload(m_fillPayload, query->result());
272  if (!foundFill) {
273  edm::LogError(m_name) << "Could not find fill #" << m_prevPayload->fillNumber();
274  break;
275  }
276  startSampleTime = cond::time::to_boost(lastSince);
277  } else {
278  edm::LogInfo(m_name) << "Searching new fill after " << boost::posix_time::to_simple_string(targetTime);
279  query->filterNotNull("start_stable_beam").filterNotNull("fill_number");
280  if (targetTime > cond::time::to_boost(m_prevStartFillTime)) {
281  query->filterGE("start_time", targetTime);
282  } else {
283  query->filterGT("start_time", targetTime);
284  }
285 
286  query->filterLT("start_time", m_endTime);
287  if (m_endFillMode)
288  query->filterNotNull("end_time");
289  bool foundFill = query->execute();
290  if (foundFill)
291  foundFill = makeFillPayload(m_fillPayload, query->result());
292  if (!foundFill) {
293  edm::LogInfo(m_name) << "No fill found - END of job.";
294  break;
295  }
296  startSampleTime = cond::time::to_boost(m_startFillTime);
297  }
298 
299  unsigned short lhcFill = m_fillPayload->fillNumber();
300  bool ongoingFill = m_endFillTime == 0ULL;
301  if (ongoingFill) {
302  edm::LogInfo(m_name) << "Found ongoing fill " << lhcFill << " created at "
304  endSampleTime = executionTime;
305  targetSince = executionTimeIov;
306  } else {
307  edm::LogInfo(m_name) << "Found fill " << lhcFill << " created at " << cond::time::to_boost(m_startFillTime)
308  << " ending at " << cond::time::to_boost(m_endFillTime);
309  endSampleTime = cond::time::to_boost(m_endFillTime);
310  targetSince = m_endFillTime;
311  }
312 
313  if (m_endFillMode || ongoingFill) {
314  getLumiData(oms, lhcFill, startSampleTime, endSampleTime);
315 
316  if (!m_tmpBuffer.empty()) {
317  boost::posix_time::ptime flumiStart = cond::time::to_boost(m_tmpBuffer.front().first);
318  boost::posix_time::ptime flumiStop = cond::time::to_boost(m_tmpBuffer.back().first);
319  edm::LogInfo(m_name) << "First buffered lumi starts at " << flumiStart << " last lumi starts at "
320  << flumiStop;
321  session.transaction().start(true);
322  getCTTPSData(session, startSampleTime, endSampleTime);
323  session.transaction().commit();
324  }
325  }
326 
328  edm::LogInfo(m_name) << "Added " << niovs << " iovs within the Fill time";
329  if (niovs) {
332  }
333  m_tmpBuffer.clear();
334  if (m_prevPayload->fillNumber() and !ongoingFill)
336  }
337  }
338  std::string id() const override { return m_name; }
339 
340  static constexpr unsigned int kLumisectionsQueryLimit = 4000;
341 
342 private:
344  bool add = false;
345  if (m_iovs.empty()) {
346  if (!m_lastPayloadEmpty)
347  add = true;
348  } else {
349  auto lastAdded = m_iovs.rbegin()->second;
350  if (lastAdded->fillNumber() != 0) {
351  add = true;
352  }
353  }
354  if (add) {
355  auto newPayload = std::make_shared<LHCInfoPerLS>();
356  m_iovs.insert(std::make_pair(iov, newPayload));
357  m_prevPayload = newPayload;
358  m_prevEndFillTime = 0;
360  edm::LogInfo(m_name) << "Added empty payload with IOV" << iov << " ( "
361  << boost::posix_time::to_iso_extended_string(cond::time::to_boost(iov)) << " )";
362  }
363  }
364 
365  bool makeFillPayload(std::unique_ptr<LHCInfoPerLS>& targetPayload, const cond::OMSServiceResult& queryResult) {
366  bool ret = false;
367  if (!queryResult.empty()) {
368  auto row = *queryResult.begin();
369  auto currentFill = row.get<unsigned short>("fill_number");
370  m_startFillTime = cond::time::from_boost(row.get<boost::posix_time::ptime>("start_time"));
371  m_endFillTime = cond::time::from_boost(row.get<boost::posix_time::ptime>("end_time"));
372  targetPayload = std::make_unique<LHCInfoPerLS>();
373  targetPayload->setFillNumber(currentFill);
374  ret = true;
375  }
376  return ret;
377  }
378 
380  auto lumiTime = row.get<boost::posix_time::ptime>("start_time");
381  LHCInfoPerLS* thisLumiSectionInfo = new LHCInfoPerLS(*m_fillPayload);
382  m_tmpBuffer.emplace_back(std::make_pair(cond::time::from_boost(lumiTime), thisLumiSectionInfo));
383  }
384 
385  size_t bufferAllLS(const cond::OMSServiceResult& queryResult) {
386  for (auto r : queryResult) {
388  }
389  return queryResult.size();
390  }
391 
392  size_t bufferFirstStableBeamLS(const cond::OMSServiceResult& queryResult) {
393  for (auto r : queryResult) {
394  if (r.get<std::string>("beams_stable") == "true") {
396  edm::LogInfo(m_name) << "Buffered first lumisection of stable beam: LS: "
397  << r.get<std::string>("lumisection_number")
398  << " run: " << r.get<std::string>("run_number");
399  return 1;
400  }
401  }
402  return 0;
403  }
404 
405  size_t getLumiData(const cond::OMSService& oms,
406  unsigned short fillId,
407  const boost::posix_time::ptime& beginFillTime,
408  const boost::posix_time::ptime& endFillTime) {
409  auto query = oms.query("lumisections");
410  query->addOutputVars({"start_time", "run_number", "beams_stable", "lumisection_number"});
411  query->filterEQ("fill_number", fillId);
412  query->filterGT("start_time", beginFillTime).filterLT("start_time", endFillTime);
414  size_t nlumi = 0;
415  if (query->execute()) {
416  auto queryResult = query->result();
417  if (m_endFillMode) {
418  nlumi = bufferAllLS(queryResult);
419  } else if (!queryResult.empty()) {
420  auto newestPayload = queryResult.back();
421  if (newestPayload.get<std::string>("beams_stable") == "true") {
422  addPayloadToBuffer(newestPayload);
423  nlumi = 1;
424  edm::LogInfo(m_name) << "Buffered most recent lumisection:"
425  << " LS: " << newestPayload.get<std::string>("lumisection_number")
426  << " run: " << newestPayload.get<std::string>("run_number");
427  }
428  }
429  edm::LogInfo(m_name) << "Found " << queryResult.size() << " lumisections during the fill " << fillId;
430  } else {
431  edm::LogInfo(m_name) << "OMS query for lumisections of fill " << fillId << "failed, status:" << query->status();
432  }
433  return nlumi;
434  }
436  const boost::posix_time::ptime& beginFillTime,
437  const boost::posix_time::ptime& endFillTime) {
438  //run the fifth query against the CTPPS schema
439  //Initializing the CMS_CTP_CTPPS_COND schema.
440  coral::ISchema& CTPPS = session.coralSession().schema("CMS_PPS_SPECT_COND");
441  //execute query for CTPPS Data
442  std::unique_ptr<coral::IQuery> CTPPSDataQuery(CTPPS.newQuery());
443  //FROM clause
444  CTPPSDataQuery->addToTableList(std::string("PPS_LHC_MACHINE_PARAMS"));
445  //SELECT clause
446  CTPPSDataQuery->addToOutputList(std::string("DIP_UPDATE_TIME"));
447  CTPPSDataQuery->addToOutputList(std::string("LUMI_SECTION"));
448  CTPPSDataQuery->addToOutputList(std::string("RUN_NUMBER"));
449  CTPPSDataQuery->addToOutputList(std::string("XING_ANGLE_P5_X_URAD"));
450  CTPPSDataQuery->addToOutputList(std::string("XING_ANGLE_P5_Y_URAD"));
451  CTPPSDataQuery->addToOutputList(std::string("BETA_STAR_P5_X_M"));
452  CTPPSDataQuery->addToOutputList(std::string("BETA_STAR_P5_Y_M"));
453  //WHERE CLAUSE
454  coral::AttributeList CTPPSDataBindVariables;
455  CTPPSDataBindVariables.extend<coral::TimeStamp>(std::string("beginFillTime"));
456  CTPPSDataBindVariables.extend<coral::TimeStamp>(std::string("endFillTime"));
457  CTPPSDataBindVariables[std::string("beginFillTime")].data<coral::TimeStamp>() = coral::TimeStamp(beginFillTime);
458  CTPPSDataBindVariables[std::string("endFillTime")].data<coral::TimeStamp>() = coral::TimeStamp(endFillTime);
459  std::string conditionStr = std::string("DIP_UPDATE_TIME>= :beginFillTime and DIP_UPDATE_TIME< :endFillTime");
460  CTPPSDataQuery->setCondition(conditionStr, CTPPSDataBindVariables);
461  //ORDER BY clause
462  CTPPSDataQuery->addToOrderList(std::string("DIP_UPDATE_TIME"));
463  //define query output
464  coral::AttributeList CTPPSDataOutput;
465  CTPPSDataOutput.extend<coral::TimeStamp>(std::string("DIP_UPDATE_TIME"));
466  CTPPSDataOutput.extend<int>(std::string("LUMI_SECTION"));
467  CTPPSDataOutput.extend<int>(std::string("RUN_NUMBER"));
468  CTPPSDataOutput.extend<float>(std::string("XING_ANGLE_P5_X_URAD"));
469  CTPPSDataOutput.extend<float>(std::string("XING_ANGLE_P5_Y_URAD"));
470  CTPPSDataOutput.extend<float>(std::string("BETA_STAR_P5_X_M"));
471  CTPPSDataOutput.extend<float>(std::string("BETA_STAR_P5_Y_M"));
472  CTPPSDataQuery->defineOutput(CTPPSDataOutput);
473  //execute the query
474  coral::ICursor& CTPPSDataCursor = CTPPSDataQuery->execute();
475  cond::Time_t dipTime = 0;
476  unsigned int lumiSection = 0;
478  float crossingAngleX = 0., betaStarX = 0.;
479  float crossingAngleY = 0., betaStarY = 0.;
480 
481  bool ret = false;
483  while (CTPPSDataCursor.next()) {
484  if (m_debug) {
485  std::ostringstream CTPPS;
486  CTPPSDataCursor.currentRow().toOutputStream(CTPPS);
487  }
488  coral::Attribute const& dipTimeAttribute = CTPPSDataCursor.currentRow()[std::string("DIP_UPDATE_TIME")];
489  if (!dipTimeAttribute.isNull()) {
490  dipTime = cond::time::from_boost(dipTimeAttribute.data<coral::TimeStamp>().time());
491  if (filter.process(dipTime)) {
492  ret = true;
493  coral::Attribute const& lumiSectionAttribute = CTPPSDataCursor.currentRow()[std::string("LUMI_SECTION")];
494  if (!lumiSectionAttribute.isNull()) {
495  lumiSection = lumiSectionAttribute.data<int>();
496  }
497  coral::Attribute const& runNumberAttribute = CTPPSDataCursor.currentRow()[std::string("RUN_NUMBER")];
498  if (!runNumberAttribute.isNull()) {
499  runNumber = runNumberAttribute.data<int>();
500  }
501  coral::Attribute const& crossingAngleXAttribute =
502  CTPPSDataCursor.currentRow()[std::string("XING_ANGLE_P5_X_URAD")];
503  if (!crossingAngleXAttribute.isNull()) {
504  crossingAngleX = crossingAngleXAttribute.data<float>();
505  }
506  coral::Attribute const& crossingAngleYAttribute =
507  CTPPSDataCursor.currentRow()[std::string("XING_ANGLE_P5_Y_URAD")];
508  if (!crossingAngleYAttribute.isNull()) {
509  crossingAngleY = crossingAngleYAttribute.data<float>();
510  }
511  coral::Attribute const& betaStarXAttribute = CTPPSDataCursor.currentRow()[std::string("BETA_STAR_P5_X_M")];
512  if (!betaStarXAttribute.isNull()) {
513  betaStarX = betaStarXAttribute.data<float>();
514  }
515  coral::Attribute const& betaStarYAttribute = CTPPSDataCursor.currentRow()[std::string("BETA_STAR_P5_Y_M")];
516  if (!betaStarYAttribute.isNull()) {
517  betaStarY = betaStarYAttribute.data<float>();
518  }
519  for (auto it = filter.current(); it != m_tmpBuffer.end(); it++) {
520  // set the current values to all of the payloads of the lumi section samples after the current since
521  LHCInfoPerLS& payload = *(it->second);
522  payload.setCrossingAngleX(crossingAngleX);
523  payload.setCrossingAngleY(crossingAngleY);
524  payload.setBetaStarX(betaStarX);
525  payload.setBetaStarY(betaStarY);
526  payload.setLumiSection(lumiSection);
527  payload.setRunNumber(runNumber);
528  }
529  }
530  }
531  }
532  return ret;
533  }
534 
535 private:
536  bool m_debug;
537  // starting date for sampling
538  boost::posix_time::ptime m_startTime;
539  boost::posix_time::ptime m_endTime;
540  // sampling interval in seconds
541  unsigned int m_samplingInterval;
542  bool m_endFillMode = true;
544  //for reading from relational database source
548  std::unique_ptr<LHCInfoPerLS> m_fillPayload;
549  std::shared_ptr<LHCInfoPerLS> m_prevPayload;
554  std::vector<std::pair<cond::Time_t, std::shared_ptr<LHCInfoPerLS>>> m_tmpBuffer;
555  bool m_lastPayloadEmpty = false;
556 };
size
Write out results.
edm::ErrorSummaryEntry Error
bool makeFillPayload(std::unique_ptr< LHCInfoPerLS > &targetPayload, const cond::OMSServiceResult &queryResult)
cond::Time_t runNumber() const
Definition: LHCInfoPerLS.cc:23
std::vector< std::pair< cond::Time_t, std::shared_ptr< LHCInfoPerLS > > >::const_iterator currLow
Iov_t lastInterval
Definition: Types.h:73
std::unique_ptr< OMSServiceQuery > query(const std::string &function) const
Definition: OMSAccess.cc:129
T get(const std::string &attributeName)
Definition: OMSAccess.h:114
std::shared_ptr< LHCInfoPerLS > m_prevPayload
ret
prodAgent to be discontinued
std::vector< T >::const_iterator search(const cond::Time_t &val, const std::vector< T > &container)
Definition: IOVProxy.cc:21
void start(bool readOnly=true)
Definition: Session.cc:18
bool empty() const
Definition: OMSAccess.cc:69
~LHCInfoPerLSPopConSourceHandler() override=default
Time_t since
Definition: Types.h:53
size_t bufferFirstStableBeamLS(const cond::OMSServiceResult &queryResult)
LHCInfoPerLSPopConSourceHandler(edm::ParameterSet const &pset)
size_t size
Definition: Types.h:74
std::unique_ptr< T > fetchPayload(const cond::Hash &payloadHash)
Definition: Session.h:213
std::vector< std::pair< cond::Time_t, std::shared_ptr< LHCInfoPerLS > > > m_tmpBuffer
Log< level::Error, false > LogError
Transaction & transaction()
Definition: Session.cc:52
float const betaStarY() const
Definition: LHCInfoPerLS.cc:21
std::string name
Definition: Types.h:72
Definition: query.py:1
LumiSectionFilter(const std::vector< std::pair< cond::Time_t, std::shared_ptr< LHCInfoPerLS >>> &samples)
cond::TagInfo_t const & tagInfo() const
popcon::PopConAnalyzer< LHCInfoPerLSPopConSourceHandler > LHCInfoPerLSPopConAnalyzer
float const crossingAngleX() const
Definition: LHCInfoPerLS.cc:15
bool getCTTPSData(cond::persistency::Session &session, const boost::posix_time::ptime &beginFillTime, const boost::posix_time::ptime &endFillTime)
unsigned long long Time_t
Definition: Time.h:14
Time_t lumiTime(unsigned int run, unsigned int lumiId)
Definition: Time.cc:66
size_t bufferAllLS(const cond::OMSServiceResult &queryResult)
std::vector< std::pair< cond::Time_t, std::shared_ptr< LHCInfoPerLS > > >::const_iterator end
size_t transferPayloads(const std::vector< std::pair< cond::Time_t, std::shared_ptr< LHCInfoPerLS >>> &buffer, std::map< cond::Time_t, std::shared_ptr< LHCInfoPerLS >> &iovsToTransfer, std::shared_ptr< LHCInfoPerLS > &prevPayload)
Hash payloadId
Definition: Types.h:55
Session createSession(const std::string &connectionString, bool writeCapable=false)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void addPayloadToBuffer(cond::OMSServiceResultRef &row)
void setMessageVerbosity(coral::MsgLevel level)
Time_t from_boost(boost::posix_time::ptime bt)
float const crossingAngleY() const
Definition: LHCInfoPerLS.cc:17
Log< level::Info, false > LogInfo
std::vector< std::pair< cond::Time_t, std::shared_ptr< LHCInfoPerLS > > >::const_iterator current()
void reset(const std::vector< std::pair< cond::Time_t, std::shared_ptr< LHCInfoPerLS >>> &samples)
std::vector< std::pair< cond::Time_t, std::shared_ptr< LHCInfoPerLS > > >::const_iterator currUp
cond::persistency::Session & dbSession() const
coral::ISessionProxy & coralSession()
Definition: Session.cc:218
void add(std::map< std::string, TH1 *> &h, TH1 *hist)
std::unique_ptr< LHCInfoPerLS > m_fillPayload
static constexpr unsigned int kLumisectionsQueryLimit
void connect(const std::string &baseUrl)
Definition: OMSAccess.cc:128
OMSServiceResultIterator begin() const
Definition: OMSAccess.cc:32
unsigned short const fillNumber() const
Definition: LHCInfoPerLS.cc:11
float const betaStarX() const
Definition: LHCInfoPerLS.cc:19
void setAuthenticationPath(const std::string &p)
const bool Debug
const Time_t MAX_VAL(std::numeric_limits< Time_t >::max())
boost::posix_time::ptime to_boost(Time_t iValue)
bool comparePayloads(const LHCInfoPerLS &rhs, const LHCInfoPerLS &lhs)
size_t getLumiData(const cond::OMSService &oms, unsigned short fillId, const boost::posix_time::ptime &beginFillTime, const boost::posix_time::ptime &endFillTime)