31 if( connType ==
"electrical" ) {
33 }
else if( connType ==
"optical" ) {
35 }
else if( connType ==
"ctpin" ) {
38 throw std::runtime_error(
"Unknown connector type " + connType);
42 bool oldConfiguration =
hasChild(
"triggerlines.clock0") ||
hasChild(
"triggerlines.fpga0");
45 bool hasMultipleFPGAs = !
hasChild(
"triggerlines.clock0");
51 for(
size_t fpga = 0; fpga <
m_maxFpga; ++fpga ) {
52 for(
size_t clock = 0; clock <
m_maxClock; ++clock ) {
53 std::string path =
"triggerlines";
55 if(hasMultipleFPGAs) {
57 path += std::to_string(fpga);
60 path += std::to_string(clock);
62 const auto & triggerlines =
data().get_child(path);
64 for(
auto & tl : triggerlines ) {
65 const std::string &
name = tl.second.get_child(
"name").data();
67 tl.second.get_child(
"startbit").get_value<
unsigned int>(),
68 tl.second.get_child(
"nbits").get_value<
unsigned int>(),
69 tl.second.get_child(
"startbit").get_value<
unsigned int>(),
78 std::string path =
"triggerlines";
79 int ntl[2][2] = {{0,0},{0,0}};
83 const auto & triggerlines =
data().get_child(path);
84 for(
auto & tl : triggerlines ) {
85 unsigned int fpga = 0;
86 unsigned int clock = 0;
88 if(
m_name.find(
"MuCTPiEl") != std::string::npos ||
m_name.find(
"Topo2El") != std::string::npos ||
m_name.find(
"Topo3El") != std::string::npos ||
m_name.find(
"LegacyTopo0") != std::string::npos ||
m_name.find(
"LegacyTopo1") != std::string::npos){
89 fpga = tl.second.get_child(
"fpga").get_value<
unsigned int>();
92 clock = tl.second.get_child(
"clock").get_value<
unsigned int>();
94 ntl[fpga][clock] += 1;
96 for(
size_t fpga = 0; fpga <
m_maxFpga; ++fpga ) {
97 for(
size_t clock = 0; clock <
m_maxClock; ++clock ) {
101 for(
auto & tl : triggerlines ) {
102 unsigned int fpga = 0;
103 unsigned int clock = 0;
104 unsigned int flatindex = 0;
106 if(
m_maxFpga==2) fpga = tl.second.get_child(
"fpga").get_value<
unsigned int>();
107 clock = tl.second.get_child(
"clock").get_value<
unsigned int>();
109 flatindex = tl.second.get_optional<
unsigned int>(
"flatindex").get_value_or(0);
110 const std::string &
name = tl.second.get_child(
"name").data();
112 tl.second.get_child(
"startbit").get_value<
unsigned int>(),
113 tl.second.get_child(
"nbits").get_value<
unsigned int>(),
114 flatindex, fpga, clock,
m_name);
147 for(
size_t fpga = 0; fpga<
m_maxFpga; ++fpga) {
148 for(
size_t clock = 0; clock<
m_maxClock; ++clock) {
155std::vector<std::string>
158 std::vector<std::string> tln{};
159 for(
size_t fpga = 0; fpga<
m_maxFpga; ++fpga) {
160 for(
size_t clock = 0; clock<
m_maxClock; ++clock) {
162 tln.emplace_back(tl.name());
169const std::vector<TrigConf::TriggerLine> &
char data[hepevt_bytes_allocation_ATLAS]
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.
T getAttribute(const std::string &key, bool ignoreIfMissing=false, const T &def=T()) const
Access to simple attribute.
bool hasChild(const std::string &path) const
Check if child exists.
std::vector< TrigConf::TriggerLine > m_triggerLines[2][2]
bool hasLine(const std::string &lineName) const
ConnectorType connectorType() const
Accessor to the connector type.
virtual std::string className() const override
A string that is the name of the class.
const TrigConf::TriggerLine & triggerLine(const std::string &lineName) const
const std::vector< TrigConf::TriggerLine > & triggerLines(unsigned int fpga=0, unsigned int clock=0) const
Accessor to the triggerlines on the connector.
std::size_t size() const
Accessor to the number of trigger lines.
std::map< std::string, TrigConf::TriggerLine * > m_lineByName
virtual void update() override
Update the internal members.
L1Connector()
Constructor.
std::vector< std::string > triggerLineNames() const
names of all trigger lines
a TriggerLine entry describes the location of a threshold multiplicity on a cable (connector)