CMS 3D CMS Logo

Classes | Functions | Variables
theLHCInfoImpl Namespace Reference

Classes

struct  IOVComp
 

Functions

bool comparePayloads (const LHCInfo &rhs, const LHCInfo &lhs)
 
bool makeFillPayload (std::unique_ptr< LHCInfo > &targetPayload, const cond::OMSServiceResult &queryResult)
 
std::vector< std::pair< cond::Time_t, std::shared_ptr< LHCInfo > > >::const_iterator search (const cond::Time_t &val, const std::vector< std::pair< cond::Time_t, std::shared_ptr< LHCInfo >>> &container)
 
void setElementData (cond::Time_t since, const std::string &dipVal, unsigned int elementNr, float value, LHCInfo &payload, std::set< cond::Time_t > &initList)
 
size_t transferPayloads (const std::vector< std::pair< cond::Time_t, std::shared_ptr< LHCInfo >>> &buffer, std::map< cond::Time_t, std::shared_ptr< LHCInfo >> &iovsToTransfer, std::shared_ptr< LHCInfo > &prevPayload)
 

Variables

static const std::map< std::string, int > vecMap
 

Function Documentation

◆ comparePayloads()

bool theLHCInfoImpl::comparePayloads ( const LHCInfo rhs,
const LHCInfo lhs 
)

Definition at line 499 of file LHCInfoPopConSourceHandler.cc.

References LHCInfo::betaStar(), LHCInfo::crossingAngle(), LHCInfo::ctppsStatus(), LHCInfo::delivLumi(), LHCInfo::fillNumber(), LHCInfo::instLumi(), LHCInfo::instLumiError(), LHCInfo::lhcComment(), LHCInfo::lhcState(), and LHCInfo::recLumi().

Referenced by transferPayloads().

499  {
500  if (rhs.fillNumber() != lhs.fillNumber() || rhs.delivLumi() != lhs.delivLumi() || rhs.recLumi() != lhs.recLumi() ||
501  rhs.instLumi() != lhs.instLumi() || rhs.instLumiError() != lhs.instLumiError() ||
502  rhs.crossingAngle() != lhs.crossingAngle() || rhs.betaStar() != lhs.betaStar() ||
503  rhs.lhcState() != lhs.lhcState() || rhs.lhcComment() != lhs.lhcComment() ||
504  rhs.ctppsStatus() != lhs.ctppsStatus()) {
505  return false;
506  }
507  return true;
508  }
std::string const & ctppsStatus() const
Definition: LHCInfo.cc:216
float const instLumiError() const
Definition: LHCInfo.cc:198
std::string const & lhcComment() const
Definition: LHCInfo.cc:214
unsigned short const fillNumber() const
Definition: LHCInfo.cc:158
float const recLumi() const
Definition: LHCInfo.cc:194
float const betaStar() const
Definition: LHCInfo.cc:184
float const instLumi() const
Definition: LHCInfo.cc:196
float const crossingAngle() const
Definition: LHCInfo.cc:182
std::string const & lhcState() const
Definition: LHCInfo.cc:212
float const delivLumi() const
Definition: LHCInfo.cc:192

◆ makeFillPayload()

bool theLHCInfoImpl::makeFillPayload ( std::unique_ptr< LHCInfo > &  targetPayload,
const cond::OMSServiceResult queryResult 
)

Definition at line 113 of file LHCInfoPopConSourceHandler.cc.

References cond::OMSServiceResult::begin(), beamSpotPI::creationTime, cond::OMSServiceResult::empty(), hcalRecHitTable_cff::energy, cond::time::from_boost(), runTheMatrix::ret, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by LHCInfoPopConSourceHandler::getNewObjects().

113  {
114  bool ret = false;
115  if (!queryResult.empty()) {
116  auto row = *queryResult.begin();
117  auto currentFill = row.get<unsigned short>("fill_number");
118  auto bunches1 = row.get<unsigned short>("bunches_beam1");
119  auto bunches2 = row.get<unsigned short>("bunches_beam2");
120  auto collidingBunches = row.get<unsigned short>("bunches_colliding");
121  auto targetBunches = row.get<unsigned short>("bunches_target");
122  auto fillType = row.get<LHCInfo::FillType>("fill_type_runtime");
123  auto particleType1 = row.get<LHCInfo::ParticleType>("fill_type_party1");
124  auto particleType2 = row.get<LHCInfo::ParticleType>("fill_type_party2");
125  auto intensityBeam1 = row.get<float>("intensity_beam1");
126  auto intensityBeam2 = row.get<float>("intensity_beam2");
127  auto energy = row.get<float>("energy");
128  auto creationTime = row.get<boost::posix_time::ptime>("start_time");
129  auto stableBeamStartTime = row.get<boost::posix_time::ptime>("start_stable_beam");
130  auto beamDumpTime = row.get<boost::posix_time::ptime>("end_time");
131  auto injectionScheme = row.get<std::string>("injection_scheme");
132  targetPayload = std::make_unique<LHCInfo>();
133  targetPayload->setFillNumber(currentFill);
134  targetPayload->setBunchesInBeam1(bunches1);
135  targetPayload->setBunchesInBeam2(bunches2);
136  targetPayload->setCollidingBunches(collidingBunches);
137  targetPayload->setTargetBunches(targetBunches);
138  targetPayload->setFillType(fillType);
139  targetPayload->setParticleTypeForBeam1(particleType1);
140  targetPayload->setParticleTypeForBeam2(particleType2);
141  targetPayload->setIntensityForBeam1(intensityBeam1);
142  targetPayload->setIntensityForBeam2(intensityBeam2);
143  targetPayload->setEnergy(energy);
144  targetPayload->setCreationTime(cond::time::from_boost(creationTime));
145  targetPayload->setBeginTime(cond::time::from_boost(stableBeamStartTime));
146  targetPayload->setEndTime(cond::time::from_boost(beamDumpTime));
147  targetPayload->setInjectionScheme(injectionScheme);
148  ret = true;
149  }
150  return ret;
151  }
ret
prodAgent to be discontinued
bool empty() const
Definition: OMSAccess.cc:69
Time_t from_boost(boost::posix_time::ptime bt)
ParticleType
Definition: LHCInfo.h:15
OMSServiceResultIterator begin() const
Definition: OMSAccess.cc:32
FillType
Definition: LHCInfo.h:14

◆ search()

std::vector<std::pair<cond::Time_t, std::shared_ptr<LHCInfo> > >::const_iterator theLHCInfoImpl::search ( const cond::Time_t val,
const std::vector< std::pair< cond::Time_t, std::shared_ptr< LHCInfo >>> &  container 
)

Definition at line 105 of file LHCInfoPopConSourceHandler.cc.

References AlCaHLTBitMon_ParallelJobs::p, pfDeepBoostedJetPreprocessParams_cfi::upper_bound, and heppy_batch::val.

106  {
107  if (container.empty())
108  return container.end();
109  auto p = std::upper_bound(container.begin(), container.end(), val, IOVComp());
110  return (p != container.begin()) ? p - 1 : container.end();
111  }

◆ setElementData()

void theLHCInfoImpl::setElementData ( cond::Time_t  since,
const std::string &  dipVal,
unsigned int  elementNr,
float  value,
LHCInfo payload,
std::set< cond::Time_t > &  initList 
)

Definition at line 339 of file LHCInfoPopConSourceHandler.cc.

References LHCInfo::bunchSlots, jetsAK4_Puppi_cff::payload, SiStripBadComponentsDQMServiceTemplate_cfg::since, relativeConstraints::value, and vecMap.

Referenced by LHCInfoPopConSourceHandler::getEcalData().

344  {
345  if (initList.find(since) == initList.end()) {
346  payload.beam1VC().resize(LHCInfo::bunchSlots, 0.);
347  payload.beam2VC().resize(LHCInfo::bunchSlots, 0.);
348  payload.beam1RF().resize(LHCInfo::bunchSlots, 0.);
349  payload.beam2RF().resize(LHCInfo::bunchSlots, 0.);
350  initList.insert(since);
351  }
352  // set the current values to all of the payloads of the lumi section samples after the current since
353  if (elementNr < LHCInfo::bunchSlots) {
354  switch (vecMap.at(dipVal)) {
355  case 1:
356  payload.beam1VC()[elementNr] = value;
357  break;
358  case 2:
359  payload.beam2VC()[elementNr] = value;
360  break;
361  case 3:
362  payload.beam1RF()[elementNr] = value;
363  break;
364  case 4:
365  payload.beam2RF()[elementNr] = value;
366  break;
367  default:
368  break;
369  }
370  }
371  }
static const std::map< std::string, int > vecMap
static size_t const bunchSlots
Definition: LHCInfo.h:58

◆ transferPayloads()

size_t theLHCInfoImpl::transferPayloads ( const std::vector< std::pair< cond::Time_t, std::shared_ptr< LHCInfo >>> &  buffer,
std::map< cond::Time_t, std::shared_ptr< LHCInfo >> &  iovsToTransfer,
std::shared_ptr< LHCInfo > &  prevPayload 
)

Definition at line 510 of file LHCInfoPopConSourceHandler.cc.

References PVValHelper::add(), edmScanValgrind::buffer, comparePayloads(), jetsAK4_Puppi_cff::payload, and SiStripBadComponentsDQMServiceTemplate_cfg::since.

Referenced by LHCInfoPopConSourceHandler::getNewObjects().

512  {
513  size_t niovs = 0;
514  for (auto& iov : buffer) {
515  bool add = false;
516  auto payload = iov.second;
517  cond::Time_t since = iov.first;
518  if (iovsToTransfer.empty()) {
519  add = true;
520  } else {
521  LHCInfo& lastAdded = *iovsToTransfer.rbegin()->second;
522  if (!comparePayloads(lastAdded, *payload)) {
523  add = true;
524  }
525  }
526  if (add) {
527  niovs++;
528  iovsToTransfer.insert(std::make_pair(since, payload));
529  prevPayload = iov.second;
530  }
531  }
532  return niovs;
533  }
bool comparePayloads(const LHCInfo &rhs, const LHCInfo &lhs)
unsigned long long Time_t
Definition: Time.h:14
void add(std::map< std::string, TH1 *> &h, TH1 *hist)

Variable Documentation

◆ vecMap

const std::map<std::string, int> theLHCInfoImpl::vecMap
static
Initial value:
= {
{"Beam1/beamPhaseMean", 1}, {"Beam2/beamPhaseMean", 2}, {"Beam1/cavPhaseMean", 3}, {"Beam2/cavPhaseMean", 4}}

Definition at line 337 of file LHCInfoPopConSourceHandler.cc.

Referenced by setElementData().