CMS 3D CMS Logo

Functions | Variables
theLHCInfoPerFillImpl Namespace Reference

Functions

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

Variables

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

Function Documentation

◆ comparePayloads()

bool theLHCInfoPerFillImpl::comparePayloads ( const LHCInfoPerFill rhs,
const LHCInfoPerFill lhs 
)

Definition at line 154 of file LHCInfoPerFillPopConSourceHandler.cc.

References LHCInfoPerFill::ctppsStatus(), LHCInfoPerFill::delivLumi(), LHCInfoPerFill::fillNumber(), LHCInfoPerFill::instLumi(), LHCInfoPerFill::instLumiError(), LHCInfoPerFill::lhcComment(), LHCInfoPerFill::lhcState(), and LHCInfoPerFill::recLumi().

Referenced by LHCInfoPerFillPopConSourceHandler::getNewObjects(), and transferPayloads().

154  {
155  if (rhs.fillNumber() != lhs.fillNumber() || rhs.delivLumi() != lhs.delivLumi() || rhs.recLumi() != lhs.recLumi() ||
156  rhs.instLumi() != lhs.instLumi() || rhs.instLumiError() != lhs.instLumiError() ||
157  rhs.lhcState() != lhs.lhcState() || rhs.lhcComment() != lhs.lhcComment() ||
158  rhs.ctppsStatus() != lhs.ctppsStatus()) {
159  return false;
160  }
161  return true;
162  }
float const delivLumi() const
float const recLumi() const
std::string const & lhcState() const
std::string const & ctppsStatus() const
std::string const & lhcComment() const
unsigned short const fillNumber() const
float const instLumi() const
float const instLumiError() const

◆ makeFillPayload()

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

Definition at line 72 of file LHCInfoPerFillPopConSourceHandler.cc.

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

Referenced by LHCInfoPerFillPopConSourceHandler::getNewObjects().

72  {
73  bool ret = false;
74  if (!queryResult.empty()) {
75  auto row = *queryResult.begin();
76  auto currentFill = row.get<unsigned short>("fill_number");
77  auto bunches1 = row.get<unsigned short>("bunches_beam1");
78  auto bunches2 = row.get<unsigned short>("bunches_beam2");
79  auto collidingBunches = row.get<unsigned short>("bunches_colliding");
80  auto targetBunches = row.get<unsigned short>("bunches_target");
81  auto fillType = row.get<LHCInfoPerFill::FillType>("fill_type_runtime");
82  auto particleType1 = row.get<LHCInfoPerFill::ParticleType>("fill_type_party1");
83  auto particleType2 = row.get<LHCInfoPerFill::ParticleType>("fill_type_party2");
84  auto intensityBeam1 = row.get<float>("intensity_beam1");
85  auto intensityBeam2 = row.get<float>("intensity_beam2");
86  auto energy = row.get<float>("energy");
87  auto creationTime = row.get<boost::posix_time::ptime>("start_time");
88  auto stableBeamStartTime = row.get<boost::posix_time::ptime>("start_stable_beam");
89  std::string endTimeStr = row.get<std::string>("end_time");
90  auto beamDumpTime =
91  (endTimeStr == "null") ? 0 : cond::time::from_boost(row.get<boost::posix_time::ptime>("end_time"));
92  auto injectionScheme = row.get<std::string>("injection_scheme");
93  targetPayload = std::make_unique<LHCInfoPerFill>();
94  targetPayload->setFillNumber(currentFill);
95  targetPayload->setBunchesInBeam1(bunches1);
96  targetPayload->setBunchesInBeam2(bunches2);
97  targetPayload->setCollidingBunches(collidingBunches);
98  targetPayload->setTargetBunches(targetBunches);
99  targetPayload->setFillType(fillType);
100  targetPayload->setParticleTypeForBeam1(particleType1);
101  targetPayload->setParticleTypeForBeam2(particleType2);
102  targetPayload->setIntensityForBeam1(intensityBeam1);
103  targetPayload->setIntensityForBeam2(intensityBeam2);
104  targetPayload->setEnergy(energy);
105  targetPayload->setCreationTime(cond::time::from_boost(creationTime));
106  targetPayload->setBeginTime(cond::time::from_boost(stableBeamStartTime));
107  targetPayload->setEndTime(beamDumpTime);
108  targetPayload->setInjectionScheme(injectionScheme);
109  ret = true;
110  }
111  return ret;
112  }
ret
prodAgent to be discontinued
bool empty() const
Definition: OMSAccess.cc:69
Time_t from_boost(boost::posix_time::ptime bt)
OMSServiceResultIterator begin() const
Definition: OMSAccess.cc:32

◆ setElementData()

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

Definition at line 118 of file LHCInfoPerFillPopConSourceHandler.cc.

References LHCInfoPerFill::bunchSlots, jetsAK4_Puppi_cff::payload, SiStripO2O_cfg_template::since, relativeConstraints::value, and vecMap.

Referenced by LHCInfoPerFillPopConSourceHandler::getEcalData().

123  {
124  if (initList.find(since) == initList.end()) {
125  payload.beam1VC().resize(LHCInfoPerFill::bunchSlots, 0.);
126  payload.beam2VC().resize(LHCInfoPerFill::bunchSlots, 0.);
127  payload.beam1RF().resize(LHCInfoPerFill::bunchSlots, 0.);
128  payload.beam2RF().resize(LHCInfoPerFill::bunchSlots, 0.);
129  initList.insert(since);
130  }
131  // set the current values to all of the payloads of the lumi section samples after the current since
132  if (elementNr < LHCInfoPerFill::bunchSlots) {
133  switch (vecMap.at(dipVal)) {
134  case 1:
135  payload.beam1VC()[elementNr] = value;
136  break;
137  case 2:
138  payload.beam2VC()[elementNr] = value;
139  break;
140  case 3:
141  payload.beam1RF()[elementNr] = value;
142  break;
143  case 4:
144  payload.beam2RF()[elementNr] = value;
145  break;
146  default:
147  break;
148  }
149  }
150  }
static size_t const bunchSlots
static const std::map< std::string, int > vecMap

◆ transferPayloads()

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

Definition at line 164 of file LHCInfoPerFillPopConSourceHandler.cc.

References PVValHelper::add(), edmScanValgrind::buffer, comparePayloads(), jetsAK4_Puppi_cff::payload, SiStripO2O_cfg_template::since, and cond::time::to_boost().

Referenced by LHCInfoPerFillPopConSourceHandler::getNewObjects().

166  {
167  size_t niovs = 0;
168  std::stringstream condIovs;
169  std::stringstream formattedIovs;
170  for (auto& iov : buffer) {
171  bool add = false;
172  auto payload = iov.second;
173  cond::Time_t since = iov.first;
174  if (iovsToTransfer.empty()) {
175  add = true;
176  } else {
177  LHCInfoPerFill& lastAdded = *iovsToTransfer.rbegin()->second;
178  if (!comparePayloads(lastAdded, *payload)) {
179  add = true;
180  }
181  }
182  if (add) {
183  niovs++;
184  condIovs << since << " ";
185  formattedIovs << boost::posix_time::to_iso_extended_string(cond::time::to_boost(since)) << " ";
186  iovsToTransfer.insert(make_pair(since, payload));
187  prevPayload = iov.second;
188  }
189  }
190  edm::LogInfo("transferPayloads") << "TRANSFERED IOVS: " << condIovs.str();
191  edm::LogInfo("transferPayloads") << "FORMATTED TRANSFERED IOVS: " << formattedIovs.str();
192  return niovs;
193  }
unsigned long long Time_t
Definition: Time.h:14
bool comparePayloads(const LHCInfoPerFill &rhs, const LHCInfoPerFill &lhs)
Log< level::Info, false > LogInfo
void add(std::map< std::string, TH1 *> &h, TH1 *hist)
boost::posix_time::ptime to_boost(Time_t iValue)

Variable Documentation

◆ vecMap

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

Definition at line 116 of file LHCInfoPerFillPopConSourceHandler.cc.

Referenced by setElementData().