10 if (str_id.size() == 0) {
13 for (
const auto &num :
split(str_id,
'_')) {
14 parts.emplace_back(std::stol(num));
21 if (!this->
parts.empty()) {
22 ss << this->
parts.at(0);
23 for (
size_t i = 1; i < this->
parts.size(); i++) {
24 ss <<
'_' << this->
parts.at(i);
30LhaID::operator long()
const {
31 if (this->parts.size() > 1) {
32 LOG_WARN(
"Casting nontrivial LhaID to int discards information.");
33 for (
auto& part : this->parts){
34 std::cout << part<< std::endl;
38 return this->parts.at(0);
std::ostream & operator<<(std::ostream &os, const LhaID &id)
Lightweight representation of LHAPDF / SLHA-style identifiers.
#define LOG_WARN(...)
Macro for logging warning messages.
std::vector< std::string > split(const std::string &s, char delimiter)
Splits a string into parts using a single-character delimiter.
Represents an identifier of a LHA element, possibly containing several sub-ids.
std::vector< long > parts
LhaID(Args... sub_ids)
Constructs an LhaID from a list of integral sub-ids.
std::string to_string() const
Returns the canonical string representation of this LhaID.