ATLAS Offline Software
Loading...
Searching...
No Matches
L1CTP.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 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 for(size_t slot = 7; slot<=9; ++slot) {
21 for(size_t conn=0; conn<4; ++conn) {
22 m_ctpin[slot-7][conn] = inputs.get_optional<std::string>("ctpin.slot" + std::to_string(slot) + ".connector" + std::to_string(conn)).get_value_or("");
23 }
24 }
25 const auto & electrical = inputs.get_child("electrical");
26 for(size_t i=0; i<3; ++i) {
27 m_electrical[i] = electrical.get_optional<std::string>("connector" + std::to_string(i)).get_value_or("");
28 }
29 if(auto optical = inputs.get_child_optional("optical")) {
30 for(size_t i=0; i<12; ++i) {
31 m_optical[i] = optical->get_optional<std::string>("connector" + std::to_string(i)).get_value_or("");
32 }
33 }
34 for( auto & mon : data().get_child("monitoring.ctpmon") ) {
35 std::string monName = mon.first;
36 size_t multiplicity = mon.second.get_child("multiplicity").get_value<size_t>();
37 std::string thr = mon.second.get_child("thr").get_value<std::string>();
38 m_ctpmon.emplace( std::piecewise_construct,
39 std::forward_as_tuple(monName),
40 std::forward_as_tuple(multiplicity, thr)
41 );
42 }
43 auto ctpinMon = data().get_child_optional("monitoring.ctpin");
44 if(ctpinMon) {
45 for( auto & mon : *ctpinMon ) {
46 std::string monName = mon.first;
47 size_t multiplicity = mon.second.get_child("multiplicity").get_value<size_t>();
48 std::string thr = mon.second.get_child("thr").get_value<std::string>();
49 m_ctpinMon.emplace( std::piecewise_construct,
50 std::forward_as_tuple(monName),
51 std::forward_as_tuple(multiplicity, thr)
52 );
53 }
54 }
55}
56
57void
59{
60 m_ctpmon.clear();
61}
62
63const std::string &
64TrigConf::L1CTP::ctpin(size_t slot, size_t conn) const
65{
66 if(slot<7 or slot>9) {
67 throw std::runtime_error("CTPIN slot must be between 7 and 9, but " + std::to_string(slot) + "was specified");
68 }
69 if(conn>3) {
70 throw std::runtime_error("CTPIN connector must be between 0 and 3, but " + std::to_string(conn) + "was specified");
71 }
72 return m_ctpin[slot-7][conn];
73}
74
75
76const std::string &
77TrigConf::L1CTP::electrical(size_t conn) const {
78 if(conn>2) {
79 throw std::runtime_error("Electrical connector must be between 0 and 2, but " + std::to_string(conn) + "was specified");
80 }
81 return m_electrical[conn];
82}
83
84const std::string &
85TrigConf::L1CTP::optical(size_t conn) const {
86 if(conn>11) {
87 throw std::runtime_error("Optical connector must be between 0 and 11, but " + std::to_string(conn) + "was specified");
88 }
89 return m_optical[conn];
90}
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
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:58
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:77
const std::string & optical(size_t conn) const
Definition L1CTP.cxx:85
const std::string & ctpin(size_t slot, size_t conn) const
name of ctpin connector
Definition L1CTP.cxx:64
L1CTP()=default