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< std::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 160 of file LHCInfoPerFillPopConAnalyzer.cc.

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

Referenced by transferPayloads().

160  {
161  if (rhs.fillNumber() != lhs.fillNumber() || rhs.delivLumi() != lhs.delivLumi() || rhs.recLumi() != lhs.recLumi() ||
162  rhs.instLumi() != lhs.instLumi() || rhs.instLumiError() != lhs.instLumiError() ||
163  rhs.lhcState() != lhs.lhcState() || rhs.lhcComment() != lhs.lhcComment() ||
164  rhs.ctppsStatus() != lhs.ctppsStatus()) {
165  return false;
166  }
167  return true;
168  }
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 78 of file LHCInfoPerFillPopConAnalyzer.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().

78  {
79  bool ret = false;
80  if (!queryResult.empty()) {
81  auto row = *queryResult.begin();
82  auto currentFill = row.get<unsigned short>("fill_number");
83  auto bunches1 = row.get<unsigned short>("bunches_beam1");
84  auto bunches2 = row.get<unsigned short>("bunches_beam2");
85  auto collidingBunches = row.get<unsigned short>("bunches_colliding");
86  auto targetBunches = row.get<unsigned short>("bunches_target");
87  auto fillType = row.get<LHCInfoPerFill::FillType>("fill_type_runtime");
88  auto particleType1 = row.get<LHCInfoPerFill::ParticleType>("fill_type_party1");
89  auto particleType2 = row.get<LHCInfoPerFill::ParticleType>("fill_type_party2");
90  auto intensityBeam1 = row.get<float>("intensity_beam1");
91  auto intensityBeam2 = row.get<float>("intensity_beam2");
92  auto energy = row.get<float>("energy");
93  auto creationTime = row.get<boost::posix_time::ptime>("start_time");
94  auto stableBeamStartTime = row.get<boost::posix_time::ptime>("start_stable_beam");
95  std::string endTimeStr = row.get<std::string>("end_time");
96  auto beamDumpTime =
97  (endTimeStr == "null") ? 0 : cond::time::from_boost(row.get<boost::posix_time::ptime>("end_time"));
98  auto injectionScheme = row.get<std::string>("injection_scheme");
99  targetPayload = std::make_unique<LHCInfoPerFill>();
100  targetPayload->setFillNumber(currentFill);
101  targetPayload->setBunchesInBeam1(bunches1);
102  targetPayload->setBunchesInBeam2(bunches2);
103  targetPayload->setCollidingBunches(collidingBunches);
104  targetPayload->setTargetBunches(targetBunches);
105  targetPayload->setFillType(fillType);
106  targetPayload->setParticleTypeForBeam1(particleType1);
107  targetPayload->setParticleTypeForBeam2(particleType2);
108  targetPayload->setIntensityForBeam1(intensityBeam1);
109  targetPayload->setIntensityForBeam2(intensityBeam2);
110  targetPayload->setEnergy(energy);
111  targetPayload->setCreationTime(cond::time::from_boost(creationTime));
112  targetPayload->setBeginTime(cond::time::from_boost(stableBeamStartTime));
113  targetPayload->setEndTime(beamDumpTime);
114  targetPayload->setInjectionScheme(injectionScheme);
115  ret = true;
116  }
117  return ret;
118  }
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 124 of file LHCInfoPerFillPopConAnalyzer.cc.

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

Referenced by LHCInfoPerFillPopConSourceHandler::getEcalData().

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

◆ transferPayloads()

size_t theLHCInfoPerFillImpl::transferPayloads ( const std::vector< std::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 170 of file LHCInfoPerFillPopConAnalyzer.cc.

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

Referenced by LHCInfoPerFillPopConSourceHandler::getNewObjects().

172  {
173  size_t niovs = 0;
174  std::stringstream condIovs;
175  std::stringstream formattedIovs;
176  for (auto& iov : buffer) {
177  bool add = false;
178  auto payload = iov.second;
179  cond::Time_t since = iov.first;
180  if (iovsToTransfer.empty()) {
181  add = true;
182  } else {
183  LHCInfoPerFill& lastAdded = *iovsToTransfer.rbegin()->second;
184  if (!comparePayloads(lastAdded, *payload)) {
185  add = true;
186  }
187  }
188  if (add) {
189  niovs++;
190  condIovs << since << " ";
191  formattedIovs << boost::posix_time::to_iso_extended_string(cond::time::to_boost(since)) << " ";
192  iovsToTransfer.insert(std::make_pair(since, payload));
193  prevPayload = iov.second;
194  }
195  }
196  edm::LogInfo("transferPayloads") << "TRANSFERED IOVS: " << condIovs.str();
197  edm::LogInfo("transferPayloads") << "FORMATTED TRANSFERED IOVS: " << formattedIovs.str();
198  return niovs;
199  }
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 122 of file LHCInfoPerFillPopConAnalyzer.cc.

Referenced by setElementData().