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

164  {
165  if (rhs.fillNumber() != lhs.fillNumber() || rhs.delivLumi() != lhs.delivLumi() || rhs.recLumi() != lhs.recLumi() ||
166  rhs.instLumi() != lhs.instLumi() || rhs.instLumiError() != lhs.instLumiError() ||
167  rhs.lhcState() != lhs.lhcState() || rhs.lhcComment() != lhs.lhcComment() ||
168  rhs.ctppsStatus() != lhs.ctppsStatus()) {
169  return false;
170  }
171  return true;
172  }
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  auto beamDumpTime = row.get<boost::posix_time::ptime>("end_time");
102  auto injectionScheme = row.get<std::string>("injection_scheme");
103  targetPayload = std::make_unique<LHCInfoPerFill>();
104  targetPayload->setFillNumber(currentFill);
105  targetPayload->setBunchesInBeam1(bunches1);
106  targetPayload->setBunchesInBeam2(bunches2);
107  targetPayload->setCollidingBunches(collidingBunches);
108  targetPayload->setTargetBunches(targetBunches);
109  targetPayload->setFillType(fillType);
110  targetPayload->setParticleTypeForBeam1(particleType1);
111  targetPayload->setParticleTypeForBeam2(particleType2);
112  targetPayload->setIntensityForBeam1(intensityBeam1);
113  targetPayload->setIntensityForBeam2(intensityBeam2);
114  targetPayload->setEnergy(energy);
115  targetPayload->setCreationTime(cond::time::from_boost(creationTime));
116  targetPayload->setBeginTime(cond::time::from_boost(stableBeamStartTime));
117  targetPayload->setEndTime(cond::time::from_boost(beamDumpTime));
118  targetPayload->setInjectionScheme(injectionScheme);
119  ret = true;
120  }
121  return ret;
122  }
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 128 of file LHCInfoPerFillPopConAnalyzer.cc.

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

Referenced by LHCInfoPerFillPopConSourceHandler::getEcalData().

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

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

Referenced by setElementData().