24 if(! isInitialized() || empty() ) {
28 m_id = getAttribute<size_t>(
"id");
29 for(
auto & train : getList(
"bcids") ) {
30 size_t first = train.getAttribute<
size_t>(
"first");
31 size_t length = train.getAttribute<
size_t>(
"length");
39 for (
const auto & train : m_bunchdef ) {
47 for (
const auto & train : m_bunchdef ) {
48 if(
bcid >= train.first and
bcid < train.first+train.second ) {
58 std::vector<uint16_t> bunches;
59 bunches.reserve(
size());
60 for (
const auto &train : m_bunchdef)
65 bunches.push_back(train.first +
i);
95 if(! isInitialized() || empty() ) {
99 m_bunchGroups.resize(s_maxBunchGroups, std::shared_ptr<L1BunchGroup>(
nullptr));
100 for(
auto &
bg :
data().get_child(
"bunchGroups") ) {
101 auto bg_sptr = std::make_shared<L1BunchGroup>(
bg.second);
102 m_bunchGroupsByName.emplace( std::piecewise_construct,
103 std::forward_as_tuple(
bg.first),
104 std::forward_as_tuple(bg_sptr->id()) );
105 m_bunchGroups[bg_sptr->id()] = bg_sptr;
113 m_bunchGroupsByName.clear();
114 m_bunchGroups.clear();
117 const std::shared_ptr<TrigConf::L1BunchGroup> &
119 return m_bunchGroups[ m_bunchGroupsByName.at(
name) ];
122 const std::shared_ptr<TrigConf::L1BunchGroup> &
124 return m_bunchGroups[
id];
129 return std::count_if(m_bunchGroups.begin(), m_bunchGroups.end(), [](
const auto &
bg){return bg!=nullptr;});
134 return std::count_if(m_bunchGroups.begin(), m_bunchGroups.end(), [](
const auto &
bg){return bg->size()!=0;});
140 static_assert(
sizeof(
bgPattern_t)*8 >= s_maxBunchGroups);
143 for (
size_t i = 0;
i < s_maxBunchGroups; ++
i) {
151 std::cout <<
"Name '" <<
name() <<
"'" << std::endl;
152 std::cout <<
"Number of non-empty bunchgroups: " << sizeNonEmpty() << std::endl;
154 for(
const auto &
bg : m_bunchGroups ) {
156 std::cout <<
" " <<
bg->name() <<
" (id " <<
bg->id() <<
") has " <<
bg->size() <<
" bunches" << std::endl;
160 const auto & paired = getBunchGroup(1);
162 std::cout <<
"Bunchgroup " << paired->name() <<
" has " << paired->size() <<
" bunches" << std::endl;