ATLAS Offline Software
Loading...
Searching...
No Matches
L1Board.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7#include <stdexcept>
8#define BOOST_BIND_GLOBAL_PLACEHOLDERS // Needed to silence Boost pragma message
9#include <boost/property_tree/json_parser.hpp>
10
11using namespace std;
12
15
16TrigConf::L1Board::L1Board(const std::string & boardName, const boost::property_tree::ptree & data)
18{
19 m_name = boardName;
21}
22
23std::string
25 return "L1Board";
26}
27
28void
30{
31 if(! isInitialized() || empty() ) {
32 return;
33 }
34 m_name = getAttribute("name", true, m_name);
35 m_legacy = getAttribute<bool>("legacy", true, false); // if legacy flag doesn't exist, it is considered to be false
36
37 std::string boardType(getAttribute("type"));
38 if( boardType == "MUCTPI" ) {
40 } else if( boardType == "CTPIN" ) {
42 } else if( boardType == "TOPO" ) {
44 } else if( boardType == "MERGER" ) {
46 } else {
47 throw std::runtime_error("Unknown board type " + boardType);
48 }
49
50 // connectors
51 for( auto & conn : getList("connectors") ) {
52 m_connectorNames.push_back(conn.getValue<std::string>());
53 }
54}
55
56
57std::size_t
59{
60 return m_connectorNames.size();
61}
62
65{
66 return m_boardType;
67}
68
69std::string
71{
72 switch( boardType() ) {
74 return "CTPIN";
76 return "MUCTPI";
77 case BoardType::TOPO:
78 return "TOPO";
80 return "MERGER";
81 default:
82 return "";
83 }
84}
85
86bool
88{
89 return m_legacy;
90}
91
92const std::vector<std::string> &
static const Attributes_t empty
std::vector< DataStructure > getList(const std::string &pathToChild, bool ignoreIfMissing=false) const
Access to array structure.
const ptree & data() const
Access to the underlying data, if needed.
DataStructure()
Default constructor, leading to an uninitialized configuration object.
T getAttribute(const std::string &key, bool ignoreIfMissing=false, const T &def=T()) const
Access to simple attribute.
virtual void update() override
Update the internal members.
Definition L1Board.cxx:29
L1Board()
Constructor.
Definition L1Board.cxx:13
bool legacy() const
Accessor to the connector type.
Definition L1Board.cxx:87
std::string type() const
Definition L1Board.cxx:70
BoardType boardType() const
Definition L1Board.cxx:64
virtual std::string className() const override
A string that is the name of the class.
Definition L1Board.cxx:24
std::size_t size() const
Accessor to the number of connectors.
Definition L1Board.cxx:58
std::vector< std::string > m_connectorNames
Definition L1Board.h:65
const std::vector< std::string > & connectorNames() const
Accessor to connector names.
Definition L1Board.cxx:93
BoardType m_boardType
Definition L1Board.h:63
STL namespace.