ATLAS Offline Software
Loading...
Searching...
No Matches
L1CTP.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7TrigConf::L1CTP::L1CTP(const std::string & name, const boost::property_tree::ptree & data)
9{
10 load();
11}
12
13void
15{
16 if(! isInitialized() || empty() ) {
17 return;
18 }
19 auto inputs = data().get_child("inputs");
20 const std::string prefix{"ctpin.slot"};
21 const std::string suffix{".connector"};
22 const std::string emptyStr{};
23 for(size_t slot = 7; slot<=9; ++slot) {
24 const std::string slotStr = std::to_string(slot);
25 for(size_t conn=0; conn<4; ++conn) {
26 m_ctpin[slot-7][conn] = inputs.get_optional<std::string>(prefix + slotStr + suffix + std::to_string(conn)).get_value_or(emptyStr);
27 }
28 }
29 const auto & electrical = inputs.get_child("electrical");
30 const std::string connectorStr{"connector"};
31 for(size_t i=0; i<3; ++i) {
32 m_electrical[i] = electrical.get_optional<std::string>(connectorStr + std::to_string(i)).get_value_or(emptyStr);
33 }
34 if(auto optical = inputs.get_child_optional("optical")) {
35 for(size_t i=0; i<12; ++i) {
36 m_optical[i] = optical->get_optional<std::string>(connectorStr + std::to_string(i)).get_value_or(emptyStr);
37 }
38 }
39 const std::string multiplicityStr{"multiplicity"};
40 const std::string thrStr{"thr"};
41 for( auto & mon : data().get_child("monitoring.ctpmon") ) {
42 std::string monName = mon.first;
43 size_t multiplicity = mon.second.get_child(multiplicityStr).get_value<size_t>();
44 std::string thr = mon.second.get_child(thrStr).get_value<std::string>();
45 m_ctpmon.emplace( std::piecewise_construct,
46 std::forward_as_tuple(monName),
47 std::forward_as_tuple(multiplicity, thr)
48 );
49 }
50 auto ctpinMon = data().get_child_optional("monitoring.ctpin");
51 if(ctpinMon) {
52 for( auto & mon : *ctpinMon ) {
53 std::string monName = mon.first;
54 size_t multiplicity = mon.second.get_child(multiplicityStr).get_value<size_t>();
55 std::string thr = mon.second.get_child(thrStr).get_value<std::string>();
56 m_ctpinMon.emplace( std::piecewise_construct,
57 std::forward_as_tuple(monName),
58 std::forward_as_tuple(multiplicity, thr)
59 );
60 }
61 }
62}
63
64void
66{
67 m_ctpmon.clear();
68}
69
70const std::string &
71TrigConf::L1CTP::ctpin(size_t slot, size_t conn) const
72{
73 if(slot<7 or slot>9) {
74 throw std::runtime_error("CTPIN slot must be between 7 and 9, but " + std::to_string(slot) + "was specified");
75 }
76 if(conn>3) {
77 throw std::runtime_error("CTPIN connector must be between 0 and 3, but " + std::to_string(conn) + "was specified");
78 }
79 return m_ctpin[slot-7][conn];
80}
81
82
83const std::string &
84TrigConf::L1CTP::electrical(size_t conn) const {
85 if(conn>2) {
86 throw std::runtime_error("Electrical connector must be between 0 and 2, but " + std::to_string(conn) + "was specified");
87 }
88 return m_electrical[conn];
89}
90
91const std::string &
92TrigConf::L1CTP::optical(size_t conn) const {
93 if(conn>11) {
94 throw std::runtime_error("Optical connector must be between 0 and 11, but " + std::to_string(conn) + "was specified");
95 }
96 return m_optical[conn];
97}
static const Attributes_t empty
virtual const std::string & name() const final
const ptree & data() const
Access to the underlying data, if needed.
DataStructure()
Default constructor, leading to an uninitialized configuration object.
virtual void clear() override
Clearing the configuration data.
Definition L1CTP.cxx:65
std::string m_electrical[3]
Definition L1CTP.h:68
std::map< std::string, std::pair< size_t, std::string > > m_ctpinMon
Definition L1CTP.h:72
std::string m_optical[12]
Definition L1CTP.h:69
std::string m_ctpin[3][4]
Definition L1CTP.h:67
std::map< std::string, std::pair< size_t, std::string > > m_ctpmon
Definition L1CTP.h:71
const std::map< std::string, std::pair< size_t, std::string > > & ctpinMon() const
CTPIN monitors.
Definition L1CTP.h:56
void load()
Definition L1CTP.cxx:14
const std::string & electrical(size_t conn) const
Definition L1CTP.cxx:84
const std::string & optical(size_t conn) const
Definition L1CTP.cxx:92
const std::string & ctpin(size_t slot, size_t conn) const
name of ctpin connector
Definition L1CTP.cxx:71
L1CTP()=default