CMS 3D CMS Logo

Classes | Functions | Variables
LHCInfoImpl Namespace Reference

Classes

struct  IOVComp
 
struct  LumiSectionFilter
 

Functions

template<typename T >
TaccessParams (std::vector< T > &params, size_t index)
 
bool comparePayloads (const LHCInfo &rhs, const LHCInfo &lhs)
 
template<typename T >
const TgetOneParam (const std::vector< std::vector< T > > &params, size_t index)
 
template<typename T >
const TgetParams (const std::vector< T > &params, size_t index)
 
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)
 
template<typename T >
void setOneParam (std::vector< std::vector< T > > &params, size_t index, const T &value)
 
template<typename T >
void setParams (std::vector< T > &params, size_t index, const T &value)
 
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

◆ accessParams()

template<typename T >
T& LHCInfoImpl::accessParams ( std::vector< T > &  params,
size_t  index 
)

Definition at line 124 of file LHCInfo.cc.

References submitPVValidationJobs::params, and cond::impl::to_string().

Referenced by LHCInfo::beam1RF(), LHCInfo::beam1VC(), LHCInfo::beam2RF(), and LHCInfo::beam2VC().

124  {
125  if (index >= params.size())
126  throw std::out_of_range("Parameter with index " + std::to_string(index) + " is out of range.");
127  return params[index];
128  }
std::string to_string(const V &value)
Definition: OMSAccess.h:71

◆ comparePayloads()

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

Definition at line 548 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().

548  {
549  if (rhs.fillNumber() != lhs.fillNumber())
550  return false;
551  if (rhs.delivLumi() != lhs.delivLumi())
552  return false;
553  if (rhs.recLumi() != lhs.recLumi())
554  return false;
555  if (rhs.instLumi() != lhs.instLumi())
556  return false;
557  if (rhs.instLumiError() != lhs.instLumiError())
558  return false;
559  if (rhs.crossingAngle() != rhs.crossingAngle())
560  return false;
561  if (rhs.betaStar() != rhs.betaStar())
562  return false;
563  if (rhs.lhcState() != rhs.lhcState())
564  return false;
565  if (rhs.lhcComment() != rhs.lhcComment())
566  return false;
567  if (rhs.ctppsStatus() != rhs.ctppsStatus())
568  return false;
569  return true;
570  }
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

◆ getOneParam()

template<typename T >
const T& LHCInfoImpl::getOneParam ( const std::vector< std::vector< T > > &  params,
size_t  index 
)

Definition at line 131 of file LHCInfo.cc.

References SurfaceOrientation::inner, Skims_PA_cff::name, submitPVValidationJobs::params, and cond::impl::to_string().

Referenced by LHCInfo::beginTime(), LHCInfo::betaStar(), LHCInfo::bunchesInBeam1(), LHCInfo::bunchesInBeam2(), LHCInfo::collidingBunches(), LHCInfo::createTime(), LHCInfo::crossingAngle(), LHCInfo::ctppsStatus(), LHCInfo::delivLumi(), LHCInfo::endTime(), LHCInfo::energy(), LHCInfo::fillNumber(), LHCInfo::fillType(), LHCInfo::injectionScheme(), LHCInfo::instLumi(), LHCInfo::instLumiError(), LHCInfo::intensityForBeam1(), LHCInfo::intensityForBeam2(), LHCInfo::lhcComment(), LHCInfo::lhcState(), LHCInfo::lumiSection(), LHCInfo::particleTypeForBeam1(), LHCInfo::particleTypeForBeam2(), LHCInfo::recLumi(), and LHCInfo::targetBunches().

131  {
132  if (index >= params.size())
133  throw std::out_of_range("Parameter with index " + std::to_string(index) + " is out of range.");
134  const std::vector<T>& inner = params[index];
135  if (inner.empty())
136  throw std::out_of_range("Parameter with index " + std::to_string(index) + " type=" + typeid(T).name() +
137  " has no value stored.");
138  return inner[0];
139  }
std::string to_string(const V &value)
Definition: OMSAccess.h:71
long double T

◆ getParams()

template<typename T >
const T& LHCInfoImpl::getParams ( const std::vector< T > &  params,
size_t  index 
)

Definition at line 117 of file LHCInfo.cc.

References submitPVValidationJobs::params, and cond::impl::to_string().

Referenced by LHCInfo::beam1RF(), LHCInfo::beam1VC(), LHCInfo::beam2RF(), LHCInfo::beam2VC(), and LHCInfo::lumiPerBX().

117  {
118  if (index >= params.size())
119  throw std::out_of_range("Parameter with index " + std::to_string(index) + " is out of range.");
120  return params[index];
121  }
std::string to_string(const V &value)
Definition: OMSAccess.h:71

◆ makeFillPayload()

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

Definition at line 111 of file LHCInfoPopConSourceHandler.cc.

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

Referenced by LHCInfoPopConSourceHandler::getNewObjects().

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

Definition at line 103 of file LHCInfoPopConSourceHandler.cc.

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

Referenced by LHCInfoImpl::LumiSectionFilter::process().

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

◆ setElementData()

void LHCInfoImpl::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 388 of file LHCInfoPopConSourceHandler.cc.

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

Referenced by LHCInfoPopConSourceHandler::getEcalData().

393  {
394  if (initList.find(since) == initList.end()) {
395  payload.beam1VC().resize(LHCInfo::bunchSlots, 0.);
396  payload.beam2VC().resize(LHCInfo::bunchSlots, 0.);
397  payload.beam1RF().resize(LHCInfo::bunchSlots, 0.);
398  payload.beam2RF().resize(LHCInfo::bunchSlots, 0.);
399  initList.insert(since);
400  }
401  // set the current values to all of the payloads of the lumi section samples after the current since
402  if (elementNr < LHCInfo::bunchSlots) {
403  switch (vecMap.at(dipVal)) {
404  case 1:
405  payload.beam1VC()[elementNr] = value;
406  break;
407  case 2:
408  payload.beam2VC()[elementNr] = value;
409  break;
410  case 3:
411  payload.beam1RF()[elementNr] = value;
412  break;
413  case 4:
414  payload.beam2RF()[elementNr] = value;
415  break;
416  default:
417  break;
418  }
419  }
420  }
static const std::map< std::string, int > vecMap
static size_t const bunchSlots
Definition: LHCInfo.h:58

◆ setOneParam()

template<typename T >
void LHCInfoImpl::setOneParam ( std::vector< std::vector< T > > &  params,
size_t  index,
const T value 
)

◆ setParams()

template<typename T >
void LHCInfoImpl::setParams ( std::vector< T > &  params,
size_t  index,
const T value 
)

Definition at line 149 of file LHCInfo.cc.

References submitPVValidationJobs::params, cond::impl::to_string(), and relativeConstraints::value.

Referenced by LHCInfo::setBeam1RF(), LHCInfo::setBeam1VC(), LHCInfo::setBeam2RF(), LHCInfo::setBeam2VC(), and LHCInfo::setLumiPerBX().

149  {
150  if (index >= params.size())
151  throw std::out_of_range("Parameter with index " + std::to_string(index) + " is out of range.");
152  params[index] = value;
153  }
std::string to_string(const V &value)
Definition: OMSAccess.h:71

◆ transferPayloads()

size_t LHCInfoImpl::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 572 of file LHCInfoPopConSourceHandler.cc.

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

Referenced by LHCInfoPopConSourceHandler::getNewObjects().

574  {
575  size_t niovs = 0;
576  for (auto& iov : buffer) {
577  bool add = false;
578  auto payload = iov.second;
579  cond::Time_t since = iov.first;
580  if (iovsToTransfer.empty()) {
581  add = true;
582  } else {
583  LHCInfo& lastAdded = *iovsToTransfer.rbegin()->second;
584  if (!comparePayloads(lastAdded, *payload)) {
585  add = true;
586  }
587  }
588  if (add) {
589  niovs++;
590  iovsToTransfer.insert(std::make_pair(since, payload));
591  prevPayload = iov.second;
592  }
593  }
594  return niovs;
595  }
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> LHCInfoImpl::vecMap
static
Initial value:
= {
{"Beam1/beamPhaseMean", 1}, {"Beam2/beamPhaseMean", 2}, {"Beam1/cavPhaseMean", 3}, {"Beam2/cavPhaseMean", 4}}

Definition at line 386 of file LHCInfoPopConSourceHandler.cc.

Referenced by setElementData().