ATLAS Offline Software
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 
5 #include "TrigConfData/L1Board.h"
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 
11 using namespace std;
12 
14 {}
15 
16 TrigConf::L1Board::L1Board(const std::string & boardName, const boost::property_tree::ptree & data)
18 {
19  m_name = boardName;
21 }
22 
23 std::string
25  return "L1Board";
26 }
27 
28 void
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" ) {
39  m_boardType = BoardType::MUCTPI;
40  } else if( boardType == "CTPIN" ) {
41  m_boardType = BoardType::CTPIN;
42  } else if( boardType == "TOPO" ) {
43  m_boardType = BoardType::TOPO;
44  } else if( boardType == "MERGER" ) {
45  m_boardType = 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 
57 std::size_t
59 {
60  return m_connectorNames.size();
61 }
62 
65 {
66  return m_boardType;
67 }
68 
69 std::string
71 {
72  switch( boardType() ) {
73  case BoardType::CTPIN:
74  return "CTPIN";
75  case BoardType::MUCTPI:
76  return "MUCTPI";
77  case BoardType::TOPO:
78  return "TOPO";
79  case BoardType::MERGER:
80  return "MERGER";
81  }
82  return "";
83 }
84 
85 bool
87 {
88  return m_legacy;
89 }
90 
91 const std::vector<std::string> &
93 {
94  return m_connectorNames;
95 }
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
checkCorrelInHIST.conn
conn
Definition: checkCorrelInHIST.py:25
TrigConf::L1Board::boardType
BoardType boardType() const
Definition: L1Board.cxx:64
TrigConf::L1Board::legacy
bool legacy() const
Accessor to the connector type.
Definition: L1Board.cxx:86
L1Board.h
TrigConf::L1Board::BoardType
BoardType
Definition: L1Board.h:26
TrigConf::L1Board::L1Board
L1Board()
Constructor.
Definition: L1Board.cxx:13
TrigConf::DataStructure::m_name
std::string m_name
Definition: DataStructure.h:259
empty
bool empty(TH1 *h)
Definition: computils.cxx:295
TrigConf::L1Board::connectorNames
const std::vector< std::string > & connectorNames() const
Accessor to connector names.
Definition: L1Board.cxx:92
TrigConf::L1Board::update
virtual void update() override
Update the internal members.
Definition: L1Board.cxx:29
TrigConf::L1Board::className
virtual std::string className() const override
A string that is the name of the class.
Definition: L1Board.cxx:24
TrigConf::L1Board::size
std::size_t size() const
Accessor to the number of connectors.
Definition: L1Board.cxx:58
ptree
boost::property_tree::ptree ptree
Definition: JsonFileLoader.cxx:16
TrigConf::DataStructure
Base class for Trigger configuration data and wrapper around underlying representation.
Definition: DataStructure.h:37
TrigConf::L1Board::type
std::string type() const
Definition: L1Board.cxx:70