File indexing completed on 2023-03-17 10:47:27
0001 #include "CondFormats/RunInfo/interface/LHCInfo.h"
0002 #include "CondFormats/Common/interface/TimeConversions.h"
0003 #include <algorithm>
0004 #include <iterator>
0005 #include <vector>
0006 #include <stdexcept>
0007
0008
0009 static std::vector<unsigned short> bitsetToVector(std::bitset<LHCInfo::bunchSlots + 1> const& bs) {
0010 std::vector<unsigned short> vec;
0011
0012 vec.reserve(bs.count());
0013 for (size_t i = 0; i < bs.size(); ++i) {
0014 if (bs.test(i))
0015 vec.push_back((unsigned short)i);
0016 }
0017 return vec;
0018 }
0019
0020
0021 static std::string fillTypeToString(LHCInfo::FillTypeId const& fillType) {
0022 std::string s_fillType("UNKNOWN");
0023 switch (fillType) {
0024 case LHCInfo::UNKNOWN:
0025 s_fillType = std::string("UNKNOWN");
0026 break;
0027 case LHCInfo::PROTONS:
0028 s_fillType = std::string("PROTONS");
0029 break;
0030 case LHCInfo::IONS:
0031 s_fillType = std::string("IONS");
0032 break;
0033 case LHCInfo::COSMICS:
0034 s_fillType = std::string("COSMICS");
0035 break;
0036 case LHCInfo::GAP:
0037 s_fillType = std::string("GAP");
0038 break;
0039 default:
0040 s_fillType = std::string("UNKNOWN");
0041 }
0042 return s_fillType;
0043 }
0044
0045
0046 static std::string particleTypeToString(LHCInfo::ParticleTypeId const& particleType) {
0047 std::string s_particleType("NONE");
0048 switch (particleType) {
0049 case LHCInfo::NONE:
0050 s_particleType = std::string("NONE");
0051 break;
0052 case LHCInfo::PROTON:
0053 s_particleType = std::string("PROTON");
0054 break;
0055 case LHCInfo::PB82:
0056 s_particleType = std::string("PB82");
0057 break;
0058 case LHCInfo::AR18:
0059 s_particleType = std::string("AR18");
0060 break;
0061 case LHCInfo::D:
0062 s_particleType = std::string("D");
0063 break;
0064 case LHCInfo::XE54:
0065 s_particleType = std::string("XE54");
0066 break;
0067 default:
0068 s_particleType = std::string("NONE");
0069 }
0070 return s_particleType;
0071 }
0072
0073 LHCInfo::LHCInfo() {
0074 m_intParams.resize(ISIZE, std::vector<unsigned int>(1, 0));
0075 m_floatParams.resize(FSIZE, std::vector<float>(1, 0.));
0076 m_floatParams[LUMI_PER_B] = std::vector<float>();
0077 m_floatParams[BEAM1_VC] = std::vector<float>();
0078 m_floatParams[BEAM2_VC] = std::vector<float>();
0079 m_floatParams[BEAM1_RF] = std::vector<float>();
0080 m_floatParams[BEAM2_RF] = std::vector<float>();
0081 m_timeParams.resize(TSIZE, std::vector<unsigned long long>(1, 0ULL));
0082 m_stringParams.resize(SSIZE, std::vector<std::string>(1, ""));
0083 m_stringParams[INJECTION_SCHEME].push_back(std::string("None"));
0084 }
0085
0086 LHCInfo::LHCInfo(const LHCInfo& rhs)
0087 : m_intParams(rhs.m_intParams),
0088 m_floatParams(rhs.m_floatParams),
0089 m_timeParams(rhs.m_timeParams),
0090 m_stringParams(rhs.m_stringParams),
0091 m_bunchConfiguration1(rhs.m_bunchConfiguration1),
0092 m_bunchConfiguration2(rhs.m_bunchConfiguration2) {}
0093
0094 LHCInfo::~LHCInfo() {}
0095
0096 LHCInfo* LHCInfo::cloneFill() const {
0097 LHCInfo* ret = new LHCInfo();
0098 ret->m_isData = m_isData;
0099 if (!m_intParams[0].empty()) {
0100 for (size_t i = 0; i < LUMI_SECTION; i++)
0101 ret->m_intParams[i] = m_intParams[i];
0102 for (size_t i = 0; i < DELIV_LUMI; i++)
0103 ret->m_floatParams[i] = m_floatParams[i];
0104 ret->m_floatParams[LUMI_PER_B] = m_floatParams[LUMI_PER_B];
0105 for (size_t i = 0; i < TSIZE; i++)
0106 ret->m_timeParams[i] = m_timeParams[i];
0107 for (size_t i = 0; i < LHC_STATE; i++)
0108 ret->m_stringParams[i] = m_stringParams[i];
0109 ret->m_bunchConfiguration1 = m_bunchConfiguration1;
0110 ret->m_bunchConfiguration2 = m_bunchConfiguration2;
0111 }
0112 return ret;
0113 }
0114
0115 namespace LHCInfoImpl {
0116 template <typename T>
0117 const T& getParams(const std::vector<T>& params, size_t index) {
0118 if (index >= params.size())
0119 throw std::out_of_range("Parameter with index " + std::to_string(index) + " is out of range.");
0120 return params[index];
0121 }
0122
0123 template <typename T>
0124 T& accessParams(std::vector<T>& params, size_t index) {
0125 if (index >= params.size())
0126 throw std::out_of_range("Parameter with index " + std::to_string(index) + " is out of range.");
0127 return params[index];
0128 }
0129
0130 template <typename T>
0131 const T& getOneParam(const std::vector<std::vector<T> >& params, size_t index) {
0132 if (index >= params.size())
0133 throw std::out_of_range("Parameter with index " + std::to_string(index) + " is out of range.");
0134 const std::vector<T>& inner = params[index];
0135 if (inner.empty())
0136 throw std::out_of_range("Parameter with index " + std::to_string(index) + " type=" + typeid(T).name() +
0137 " has no value stored.");
0138 return inner[0];
0139 }
0140
0141 template <typename T>
0142 void setOneParam(std::vector<std::vector<T> >& params, size_t index, const T& value) {
0143 if (index >= params.size())
0144 throw std::out_of_range("Parameter with index " + std::to_string(index) + " is out of range.");
0145 params[index] = std::vector<T>(1, value);
0146 }
0147
0148 template <typename T>
0149 void setParams(std::vector<T>& params, size_t index, const T& value) {
0150 if (index >= params.size())
0151 throw std::out_of_range("Parameter with index " + std::to_string(index) + " is out of range.");
0152 params[index] = value;
0153 }
0154
0155 }
0156
0157
0158 unsigned short const LHCInfo::fillNumber() const { return LHCInfoImpl::getOneParam(m_intParams, LHC_FILL); }
0159
0160 unsigned short const LHCInfo::bunchesInBeam1() const { return LHCInfoImpl::getOneParam(m_intParams, BUNCHES_1); }
0161
0162 unsigned short const LHCInfo::bunchesInBeam2() const { return LHCInfoImpl::getOneParam(m_intParams, BUNCHES_2); }
0163
0164 unsigned short const LHCInfo::collidingBunches() const {
0165 return LHCInfoImpl::getOneParam(m_intParams, COLLIDING_BUNCHES);
0166 }
0167
0168 unsigned short const LHCInfo::targetBunches() const { return LHCInfoImpl::getOneParam(m_intParams, TARGET_BUNCHES); }
0169
0170 LHCInfo::FillTypeId const LHCInfo::fillType() const {
0171 return static_cast<FillTypeId>(LHCInfoImpl::getOneParam(m_intParams, FILL_TYPE));
0172 }
0173
0174 LHCInfo::ParticleTypeId const LHCInfo::particleTypeForBeam1() const {
0175 return static_cast<ParticleTypeId>(LHCInfoImpl::getOneParam(m_intParams, PARTICLES_1));
0176 }
0177
0178 LHCInfo::ParticleTypeId const LHCInfo::particleTypeForBeam2() const {
0179 return static_cast<ParticleTypeId>(LHCInfoImpl::getOneParam(m_intParams, PARTICLES_2));
0180 }
0181
0182 float const LHCInfo::crossingAngle() const { return LHCInfoImpl::getOneParam(m_floatParams, CROSSING_ANGLE); }
0183
0184 float const LHCInfo::betaStar() const { return LHCInfoImpl::getOneParam(m_floatParams, BETA_STAR); }
0185
0186 float const LHCInfo::intensityForBeam1() const { return LHCInfoImpl::getOneParam(m_floatParams, INTENSITY_1); }
0187
0188 float const LHCInfo::intensityForBeam2() const { return LHCInfoImpl::getOneParam(m_floatParams, INTENSITY_2); }
0189
0190 float const LHCInfo::energy() const { return LHCInfoImpl::getOneParam(m_floatParams, ENERGY); }
0191
0192 float const LHCInfo::delivLumi() const { return LHCInfoImpl::getOneParam(m_floatParams, DELIV_LUMI); }
0193
0194 float const LHCInfo::recLumi() const { return LHCInfoImpl::getOneParam(m_floatParams, REC_LUMI); }
0195
0196 float const LHCInfo::instLumi() const { return LHCInfoImpl::getOneParam(m_floatParams, INST_LUMI); }
0197
0198 float const LHCInfo::instLumiError() const { return LHCInfoImpl::getOneParam(m_floatParams, INST_LUMI_ERR); }
0199
0200 cond::Time_t const LHCInfo::createTime() const { return LHCInfoImpl::getOneParam(m_timeParams, CREATE_TIME); }
0201
0202 cond::Time_t const LHCInfo::beginTime() const { return LHCInfoImpl::getOneParam(m_timeParams, BEGIN_TIME); }
0203
0204 cond::Time_t const LHCInfo::endTime() const { return LHCInfoImpl::getOneParam(m_timeParams, END_TIME); }
0205
0206 std::string const& LHCInfo::injectionScheme() const {
0207 return LHCInfoImpl::getOneParam(m_stringParams, INJECTION_SCHEME);
0208 }
0209
0210 std::vector<float> const& LHCInfo::lumiPerBX() const { return LHCInfoImpl::getParams(m_floatParams, LUMI_PER_B); }
0211
0212 std::string const& LHCInfo::lhcState() const { return LHCInfoImpl::getOneParam(m_stringParams, LHC_STATE); }
0213
0214 std::string const& LHCInfo::lhcComment() const { return LHCInfoImpl::getOneParam(m_stringParams, LHC_COMMENT); }
0215
0216 std::string const& LHCInfo::ctppsStatus() const { return LHCInfoImpl::getOneParam(m_stringParams, CTPPS_STATUS); }
0217
0218 unsigned int const& LHCInfo::lumiSection() const { return LHCInfoImpl::getOneParam(m_intParams, LUMI_SECTION); }
0219
0220 std::vector<float> const& LHCInfo::beam1VC() const { return LHCInfoImpl::getParams(m_floatParams, BEAM1_VC); }
0221
0222 std::vector<float> const& LHCInfo::beam2VC() const { return LHCInfoImpl::getParams(m_floatParams, BEAM2_VC); }
0223
0224 std::vector<float> const& LHCInfo::beam1RF() const { return LHCInfoImpl::getParams(m_floatParams, BEAM1_RF); }
0225
0226 std::vector<float> const& LHCInfo::beam2RF() const { return LHCInfoImpl::getParams(m_floatParams, BEAM2_RF); }
0227
0228 std::vector<float>& LHCInfo::beam1VC() { return LHCInfoImpl::accessParams(m_floatParams, BEAM1_VC); }
0229
0230 std::vector<float>& LHCInfo::beam2VC() { return LHCInfoImpl::accessParams(m_floatParams, BEAM2_VC); }
0231
0232 std::vector<float>& LHCInfo::beam1RF() { return LHCInfoImpl::accessParams(m_floatParams, BEAM1_RF); }
0233
0234 std::vector<float>& LHCInfo::beam2RF() { return LHCInfoImpl::accessParams(m_floatParams, BEAM2_RF); }
0235
0236
0237
0238 bool LHCInfo::is25nsBunchSpacing() const {
0239 const std::string prefix("25ns");
0240 return std::equal(prefix.begin(), prefix.end(), injectionScheme().begin());
0241 }
0242
0243
0244 bool LHCInfo::isBunchInBeam1(size_t const& bunch) const {
0245 if (bunch == 0)
0246 throw std::out_of_range("0 not allowed");
0247 return m_bunchConfiguration1.test(bunch);
0248 }
0249
0250 bool LHCInfo::isBunchInBeam2(size_t const& bunch) const {
0251 if (bunch == 0)
0252 throw std::out_of_range("0 not allowed");
0253 return m_bunchConfiguration2.test(bunch);
0254 }
0255
0256
0257 std::vector<unsigned short> LHCInfo::bunchConfigurationForBeam1() const {
0258 return bitsetToVector(m_bunchConfiguration1);
0259 }
0260
0261 std::vector<unsigned short> LHCInfo::bunchConfigurationForBeam2() const {
0262 return bitsetToVector(m_bunchConfiguration2);
0263 }
0264
0265 void LHCInfo::setFillNumber(unsigned short lhcFill) {
0266 LHCInfoImpl::setOneParam(m_intParams, LHC_FILL, static_cast<unsigned int>(lhcFill));
0267 }
0268
0269
0270 void LHCInfo::setBunchesInBeam1(unsigned short const& bunches) {
0271 LHCInfoImpl::setOneParam(m_intParams, BUNCHES_1, static_cast<unsigned int>(bunches));
0272 }
0273
0274 void LHCInfo::setBunchesInBeam2(unsigned short const& bunches) {
0275 LHCInfoImpl::setOneParam(m_intParams, BUNCHES_2, static_cast<unsigned int>(bunches));
0276 }
0277
0278 void LHCInfo::setCollidingBunches(unsigned short const& collidingBunches) {
0279 LHCInfoImpl::setOneParam(m_intParams, COLLIDING_BUNCHES, static_cast<unsigned int>(collidingBunches));
0280 }
0281
0282 void LHCInfo::setTargetBunches(unsigned short const& targetBunches) {
0283 LHCInfoImpl::setOneParam(m_intParams, TARGET_BUNCHES, static_cast<unsigned int>(targetBunches));
0284 }
0285
0286 void LHCInfo::setFillType(LHCInfo::FillTypeId const& fillType) {
0287 LHCInfoImpl::setOneParam(m_intParams, FILL_TYPE, static_cast<unsigned int>(fillType));
0288 }
0289
0290 void LHCInfo::setParticleTypeForBeam1(LHCInfo::ParticleTypeId const& particleType) {
0291 LHCInfoImpl::setOneParam(m_intParams, PARTICLES_1, static_cast<unsigned int>(particleType));
0292 }
0293
0294 void LHCInfo::setParticleTypeForBeam2(LHCInfo::ParticleTypeId const& particleType) {
0295 LHCInfoImpl::setOneParam(m_intParams, PARTICLES_2, static_cast<unsigned int>(particleType));
0296 }
0297
0298 void LHCInfo::setCrossingAngle(float const& angle) { LHCInfoImpl::setOneParam(m_floatParams, CROSSING_ANGLE, angle); }
0299
0300 void LHCInfo::setBetaStar(float const& betaStar) { LHCInfoImpl::setOneParam(m_floatParams, BETA_STAR, betaStar); }
0301
0302 void LHCInfo::setIntensityForBeam1(float const& intensity) {
0303 LHCInfoImpl::setOneParam(m_floatParams, INTENSITY_1, intensity);
0304 }
0305
0306 void LHCInfo::setIntensityForBeam2(float const& intensity) {
0307 LHCInfoImpl::setOneParam(m_floatParams, INTENSITY_2, intensity);
0308 }
0309
0310 void LHCInfo::setEnergy(float const& energy) { LHCInfoImpl::setOneParam(m_floatParams, ENERGY, energy); }
0311
0312 void LHCInfo::setDelivLumi(float const& delivLumi) { LHCInfoImpl::setOneParam(m_floatParams, DELIV_LUMI, delivLumi); }
0313
0314 void LHCInfo::setRecLumi(float const& recLumi) { LHCInfoImpl::setOneParam(m_floatParams, REC_LUMI, recLumi); }
0315
0316 void LHCInfo::setInstLumi(float const& instLumi) { LHCInfoImpl::setOneParam(m_floatParams, INST_LUMI, instLumi); }
0317
0318 void LHCInfo::setInstLumiError(float const& instLumiError) {
0319 LHCInfoImpl::setOneParam(m_floatParams, INST_LUMI_ERR, instLumiError);
0320 }
0321
0322 void LHCInfo::setCreationTime(cond::Time_t const& createTime) {
0323 LHCInfoImpl::setOneParam(m_timeParams, CREATE_TIME, createTime);
0324 }
0325
0326 void LHCInfo::setBeginTime(cond::Time_t const& beginTime) {
0327 LHCInfoImpl::setOneParam(m_timeParams, BEGIN_TIME, beginTime);
0328 }
0329
0330 void LHCInfo::setEndTime(cond::Time_t const& endTime) { LHCInfoImpl::setOneParam(m_timeParams, END_TIME, endTime); }
0331
0332 void LHCInfo::setInjectionScheme(std::string const& injectionScheme) {
0333 LHCInfoImpl::setOneParam(m_stringParams, INJECTION_SCHEME, injectionScheme);
0334 }
0335
0336 void LHCInfo::setLumiPerBX(std::vector<float> const& lumiPerBX) {
0337 LHCInfoImpl::setParams(m_floatParams, LUMI_PER_B, lumiPerBX);
0338 }
0339
0340 void LHCInfo::setLhcState(std::string const& lhcState) {
0341 LHCInfoImpl::setOneParam(m_stringParams, LHC_STATE, lhcState);
0342 }
0343
0344 void LHCInfo::setLhcComment(std::string const& lhcComment) {
0345 LHCInfoImpl::setOneParam(m_stringParams, LHC_COMMENT, lhcComment);
0346 }
0347
0348 void LHCInfo::setCtppsStatus(std::string const& ctppsStatus) {
0349 LHCInfoImpl::setOneParam(m_stringParams, CTPPS_STATUS, ctppsStatus);
0350 }
0351
0352 void LHCInfo::setLumiSection(unsigned int const& lumiSection) {
0353 LHCInfoImpl::setOneParam(m_intParams, LUMI_SECTION, lumiSection);
0354 }
0355
0356 void LHCInfo::setBeam1VC(std::vector<float> const& beam1VC) {
0357 LHCInfoImpl::setParams(m_floatParams, BEAM1_VC, beam1VC);
0358 }
0359
0360 void LHCInfo::setBeam2VC(std::vector<float> const& beam2VC) {
0361 LHCInfoImpl::setParams(m_floatParams, BEAM2_VC, beam2VC);
0362 }
0363
0364 void LHCInfo::setBeam1RF(std::vector<float> const& beam1RF) {
0365 LHCInfoImpl::setParams(m_floatParams, BEAM1_RF, beam1RF);
0366 }
0367
0368 void LHCInfo::setBeam2RF(std::vector<float> const& beam2RF) {
0369 LHCInfoImpl::setParams(m_floatParams, BEAM2_RF, beam2RF);
0370 }
0371
0372
0373 void LHCInfo::setInfo(unsigned short const& bunches1,
0374 unsigned short const& bunches2,
0375 unsigned short const& collidingBunches,
0376 unsigned short const& targetBunches,
0377 FillTypeId const& fillType,
0378 ParticleTypeId const& particleType1,
0379 ParticleTypeId const& particleType2,
0380 float const& angle,
0381 float const& beta,
0382 float const& intensity1,
0383 float const& intensity2,
0384 float const& energy,
0385 float const& delivLumi,
0386 float const& recLumi,
0387 float const& instLumi,
0388 float const& instLumiError,
0389 cond::Time_t const& createTime,
0390 cond::Time_t const& beginTime,
0391 cond::Time_t const& endTime,
0392 std::string const& scheme,
0393 std::vector<float> const& lumiPerBX,
0394 std::string const& lhcState,
0395 std::string const& lhcComment,
0396 std::string const& ctppsStatus,
0397 unsigned int const& lumiSection,
0398 std::vector<float> const& beam1VC,
0399 std::vector<float> const& beam2VC,
0400 std::vector<float> const& beam1RF,
0401 std::vector<float> const& beam2RF,
0402 std::bitset<bunchSlots + 1> const& bunchConf1,
0403 std::bitset<bunchSlots + 1> const& bunchConf2) {
0404 this->setBunchesInBeam1(bunches1);
0405 this->setBunchesInBeam2(bunches2);
0406 this->setCollidingBunches(collidingBunches);
0407 this->setTargetBunches(targetBunches);
0408 this->setFillType(fillType);
0409 this->setParticleTypeForBeam1(particleType1);
0410 this->setParticleTypeForBeam2(particleType2);
0411 this->setCrossingAngle(angle);
0412 this->setBetaStar(beta);
0413 this->setIntensityForBeam1(intensity1);
0414 this->setIntensityForBeam2(intensity2);
0415 this->setEnergy(energy);
0416 this->setDelivLumi(delivLumi);
0417 this->setRecLumi(recLumi);
0418 this->setInstLumi(instLumi);
0419 this->setInstLumiError(instLumiError);
0420 this->setCreationTime(createTime);
0421 this->setBeginTime(beginTime);
0422 this->setEndTime(endTime);
0423 this->setInjectionScheme(scheme);
0424 this->setLumiPerBX(lumiPerBX);
0425 this->setLhcState(lhcState);
0426 this->setLhcComment(lhcComment);
0427 this->setCtppsStatus(ctppsStatus);
0428 this->setLumiSection(lumiSection);
0429 this->setBeam1VC(beam1VC);
0430 this->setBeam2VC(beam2VC);
0431 this->setBeam1RF(beam1RF);
0432 this->setBeam2RF(beam2RF);
0433 this->setBunchBitsetForBeam1(bunchConf1);
0434 this->setBunchBitsetForBeam2(bunchConf2);
0435 }
0436
0437 void LHCInfo::print(std::stringstream& ss) const {
0438 ss << "LHC fill: " << this->fillNumber() << std::endl
0439 << "Bunches in Beam 1: " << this->bunchesInBeam1() << std::endl
0440 << "Bunches in Beam 2: " << this->bunchesInBeam2() << std::endl
0441 << "Colliding bunches at IP5: " << this->collidingBunches() << std::endl
0442 << "Target bunches at IP5: " << this->targetBunches() << std::endl
0443 << "Fill type: " << fillTypeToString(static_cast<FillTypeId>(this->fillType())) << std::endl
0444 << "Particle type for Beam 1: " << particleTypeToString(static_cast<ParticleTypeId>(this->particleTypeForBeam1()))
0445 << std::endl
0446 << "Particle type for Beam 2: " << particleTypeToString(static_cast<ParticleTypeId>(this->particleTypeForBeam2()))
0447 << std::endl
0448 << "Crossing angle (urad): " << this->crossingAngle() << std::endl
0449 << "Beta star (cm): " << this->betaStar() << std::endl
0450 << "Average Intensity for Beam 1 (number of charges): " << this->intensityForBeam1() << std::endl
0451 << "Average Intensity for Beam 2 (number of charges): " << this->intensityForBeam2() << std::endl
0452 << "Energy (GeV): " << this->energy() << std::endl
0453 << "Delivered Luminosity (max): " << this->delivLumi() << std::endl
0454 << "Recorded Luminosity (max): " << this->recLumi() << std::endl
0455 << "Instantaneous Luminosity: " << this->instLumi() << std::endl
0456 << "Instantaneous Luminosity Error: " << this->instLumiError() << std::endl
0457 << "Creation time of the fill: "
0458 << boost::posix_time::to_iso_extended_string(cond::time::to_boost(this->createTime())) << std::endl
0459 << "Begin time of Stable Beam flag: "
0460 << boost::posix_time::to_iso_extended_string(cond::time::to_boost(this->beginTime())) << std::endl
0461 << "End time of the fill: " << boost::posix_time::to_iso_extended_string(cond::time::to_boost(this->endTime()))
0462 << std::endl
0463 << "Injection scheme as given by LPC: " << this->injectionScheme() << std::endl
0464 << "LHC State: " << this->lhcState() << std::endl
0465 << "LHC Comments: " << this->lhcComment() << std::endl
0466 << "CTPPS Status: " << this->ctppsStatus() << std::endl
0467 << "Lumi section: " << this->lumiSection() << std::endl;
0468
0469 ss << "Luminosity per bunch (total " << this->lumiPerBX().size() << "): ";
0470 std::copy(this->lumiPerBX().begin(), this->lumiPerBX().end(), std::ostream_iterator<float>(ss, ", "));
0471 ss << std::endl;
0472
0473 ss << "Beam 1 VC (total " << this->beam1VC().size() << "): ";
0474 std::copy(this->beam1VC().begin(), this->beam1VC().end(), std::ostream_iterator<float>(ss, "\t"));
0475 ss << std::endl;
0476
0477 ss << "Beam 2 VC (total " << beam2VC().size() << "): ";
0478 std::copy(beam2VC().begin(), beam2VC().end(), std::ostream_iterator<float>(ss, "\t"));
0479 ss << std::endl;
0480
0481 ss << "Beam 1 RF (total " << beam1RF().size() << "): ";
0482 std::copy(beam1RF().begin(), beam1RF().end(), std::ostream_iterator<float>(ss, "\t"));
0483 ss << std::endl;
0484
0485 ss << "Beam 2 RF (total " << beam2RF().size() << "): ";
0486 std::copy(beam2RF().begin(), beam2RF().end(), std::ostream_iterator<float>(ss, "\t"));
0487 ss << std::endl;
0488
0489 std::vector<unsigned short> bunchVector1 = this->bunchConfigurationForBeam1();
0490 std::vector<unsigned short> bunchVector2 = this->bunchConfigurationForBeam2();
0491 ss << "Bunches filled for Beam 1 (total " << bunchVector1.size() << "): ";
0492 std::copy(bunchVector1.begin(), bunchVector1.end(), std::ostream_iterator<unsigned short>(ss, ", "));
0493 ss << std::endl;
0494 ss << "Bunches filled for Beam 2 (total " << bunchVector2.size() << "): ";
0495 std::copy(bunchVector2.begin(), bunchVector2.end(), std::ostream_iterator<unsigned short>(ss, ", "));
0496 ss << std::endl;
0497 }
0498
0499
0500 std::bitset<LHCInfo::bunchSlots + 1> const& LHCInfo::bunchBitsetForBeam1() const { return m_bunchConfiguration1; }
0501
0502 std::bitset<LHCInfo::bunchSlots + 1> const& LHCInfo::bunchBitsetForBeam2() const { return m_bunchConfiguration2; }
0503
0504
0505 void LHCInfo::setBunchBitsetForBeam1(std::bitset<LHCInfo::bunchSlots + 1> const& bunchConfiguration) {
0506 m_bunchConfiguration1 = bunchConfiguration;
0507 }
0508
0509 void LHCInfo::setBunchBitsetForBeam2(std::bitset<LHCInfo::bunchSlots + 1> const& bunchConfiguration) {
0510 m_bunchConfiguration2 = bunchConfiguration;
0511 }
0512
0513 std::ostream& operator<<(std::ostream& os, LHCInfo beamInfo) {
0514 std::stringstream ss;
0515 beamInfo.print(ss);
0516 os << ss.str();
0517 return os;
0518 }
0519
0520 bool LHCInfo::equals(const LHCInfo& rhs) const {
0521 if (m_isData != rhs.m_isData)
0522 return false;
0523 if (m_intParams != rhs.m_intParams)
0524 return false;
0525 if (m_floatParams != rhs.m_floatParams)
0526 return false;
0527 if (m_timeParams != rhs.m_timeParams)
0528 return false;
0529 if (m_stringParams != rhs.m_stringParams)
0530 return false;
0531 if (m_bunchConfiguration1 != rhs.m_bunchConfiguration1)
0532 return false;
0533 if (m_bunchConfiguration2 != rhs.m_bunchConfiguration2)
0534 return false;
0535 return true;
0536 }
0537
0538 bool LHCInfo::empty() const { return m_intParams[0].empty(); }