ATLAS Offline Software
Loading...
Searching...
No Matches
BunchGroupSet.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7#include <iostream>
8
9using namespace std;
10using namespace TrigConf;
11
12
14
15BunchGroupSet::BunchGroupSet(const std::vector<BunchGroup>& bgv) :
18 m_BunchGroups(bgv),
19 m_BGpattern(3564)
20{
21 for(const BunchGroup& bg: m_BunchGroups)
22 fillPattern(bg.internalNumber(), bg);
23}
24
25void
27 fillPattern(bg.internalNumber(), bg);
28 m_BunchGroups.push_back(bg);
29}
30
31
32void
33BunchGroupSet::setBGName(uint32_t i, const std::string& name) {
34 if(i<m_BunchGroups.size())
35 m_BunchGroups[i].setName(name);
36}
37
38void
39BunchGroupSet::fillPattern(uint32_t bitpos, const BunchGroup& bg) {
40 if(bitpos>=16)
41 return;
42 uint16_t bit = 0x1 << bitpos;
43 const std::vector<int>& b = bg.bunches();
44 for(size_t i=0; i<b.size(); ++i)
45 m_BGpattern[b[i]] |= bit;
46}
47
48
49void
50BunchGroupSet::print(const std::string& indent, unsigned int detail) const {
51 if(detail>=1) {
52 cout << indent << "BunchGroupSet " << name();
53 if(id()>0 || version()>0)
54 cout << " (id=" << id() << "/v=" << version() << ")";
55 cout << endl;
56 cout << indent << "Number of bunch groups: " << m_BunchGroups.size() << endl;
57 if(detail>=2) {
58 for(const BunchGroup& bg: m_BunchGroups)
59 bg.print(indent + indent, detail);
60 }
61 }
62}
63
64void
65BunchGroupSet::writeXML(std::ostream & xmlfile, int indentLevel, int indentWidth) const {
66 indent(xmlfile,indentLevel, indentWidth)
67 << "<BunchGroupSet name=\"" << name() << "\" menuPartition=\"" << m_MenuPartition << "\">" << endl;
68 for(const BunchGroup& bg: m_BunchGroups)
69 bg.writeXML(xmlfile, indentLevel+1, indentWidth);
70 indent(xmlfile,indentLevel, indentWidth)
71 << "</BunchGroupSet>" << endl;
72}
73
void setBGName(uint32_t, const std::string &)
std::vector< BunchGroup > m_BunchGroups
virtual void print(const std::string &indent="", unsigned int detail=1) const override
void fillPattern(uint32_t bitpos, const BunchGroup &bg)
void addBunchGroup(const BunchGroup &)
std::vector< uint16_t > m_BGpattern
void writeXML(std::ostream &xmlfile, int indentLevel=0, int indentWidth=2) const
unsigned int id() const
std::ostream & indent(std::ostream &o, int lvl, int size) const
const std::string & name() const
unsigned int version() const
static std::vector< std::string > xmlfile
Definition iLumiCalc.h:29
Forward iterator to traverse the main components of the trigger configuration.
Definition Config.h:22
STL namespace.