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 166 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().

166  {
167  if (rhs.fillNumber() != lhs.fillNumber() || rhs.delivLumi() != lhs.delivLumi() || rhs.recLumi() != lhs.recLumi() ||
168  rhs.instLumi() != lhs.instLumi() || rhs.instLumiError() != lhs.instLumiError() ||
169  rhs.lhcState() != lhs.lhcState() || rhs.lhcComment() != lhs.lhcComment() ||
170  rhs.ctppsStatus() != lhs.ctppsStatus()) {
171  return false;
172  }
173  return true;
174  }
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 84 of file LHCInfoPerFillPopConAnalyzer.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 LHCInfoPerFillPopConSourceHandler::getNewObjects().

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

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

Referenced by LHCInfoPerFillPopConSourceHandler::getEcalData().

135  {
136  if (initList.find(since) == initList.end()) {
137  payload.beam1VC().resize(LHCInfoPerFill::bunchSlots, 0.);
138  payload.beam2VC().resize(LHCInfoPerFill::bunchSlots, 0.);
139  payload.beam1RF().resize(LHCInfoPerFill::bunchSlots, 0.);
140  payload.beam2RF().resize(LHCInfoPerFill::bunchSlots, 0.);
141  initList.insert(since);
142  }
143  // set the current values to all of the payloads of the lumi section samples after the current since
144  if (elementNr < LHCInfoPerFill::bunchSlots) {
145  switch (vecMap.at(dipVal)) {
146  case 1:
147  payload.beam1VC()[elementNr] = value;
148  break;
149  case 2:
150  payload.beam2VC()[elementNr] = value;
151  break;
152  case 3:
153  payload.beam1RF()[elementNr] = value;
154  break;
155  case 4:
156  payload.beam2RF()[elementNr] = value;
157  break;
158  default:
159  break;
160  }
161  }
162  }
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 176 of file LHCInfoPerFillPopConAnalyzer.cc.

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

Referenced by LHCInfoPerFillPopConSourceHandler::getNewObjects().

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

Referenced by setElementData().