ATLAS Offline Software
Loading...
Searching...
No Matches
L1TopoConfigOutputList.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3*/
4
7
8#include <iostream>
9#include <iomanip>
10#include <algorithm>
11#include <set>
12
13using namespace std;
14using namespace TXC;
15
16
17void
19 //m_counter = 64 * m_module + 16 * m_fpga + 32 * m_clock + m_bit;
20 m_counter = 2 * (32 * m_module + 16 * m_fpga + m_bit) + m_clock;
21 if(m_counter>191) {
22 TCS_EXCEPTION("Trigger line '" << *this << "' has illegal counter " << m_counter);
23 }
24}
25
26
27void
31
32
33void
35
36 auto insname = m_triggernames.insert(trigger.name());
37 if(!insname.second)
38 TCS_EXCEPTION("Trigger line '" << trigger.name() << "' has been defined more than once");
39
40 auto inscount = m_triggercounters.insert(trigger.counter());
41 if(!inscount.second) {
42 string triggerWithSameCounter("");
43 for(auto & tl : m_triggerlines)
44 if(tl.counter() == trigger.counter())
45 triggerWithSameCounter = tl.name();
46 TCS_EXCEPTION("Trigger line '" << trigger.name() << "' is on the same output line (" << trigger.counter() << ") as trigger line '" << triggerWithSameCounter << "'");
47 }
48
49 m_triggerlines.push_back(trigger);
50
51}
52
53bool
54L1TopoConfigOutputList::hasTrigger(const std::string & trigger) const {
55 for(const TriggerLine & t : m_triggerlines)
56 if(t.name() == trigger) return true;
57 return false;
58}
59
60
61const TriggerLine &
62L1TopoConfigOutputList::getTrigger(const std::string & trigger) const {
63 for(const TriggerLine & t : m_triggerlines)
64 if(t.name() == trigger) return t;
65 return m_undef;
66}
67
68namespace {
69 bool comp(const TriggerLine & x, const TriggerLine & y) { return x.counter() < y.counter(); }
70}
71
72void
76
77
78namespace TXC {
79
80std::ostream & operator<<(std::ostream &o, const L1TopoConfigOutputList &outputlist) {
81
82 o << "Trigger lines (sorted by connectors):" << endl;
83 for(const TXC::TriggerLine& trigger: outputlist.getTriggerLines()) {
84 if(trigger.counter() % 32 == 0) {
85 //modIdx = trigger.counter() / 100;
86 o << endl << "Module=" << trigger.module() << ", FPGA=" << trigger.fpga() << endl;
87 o << "----------------" << endl;
88 }
89 o << " " << setiosflags(ios::left) << setw(30) << trigger.name() << " (algorithm " << trigger.algoname() << " (id=" << trigger.algoid() << "))"
90 << " on line " << trigger.bit() << " and clock " << trigger.clock() << endl;
91 }
92 return o;
93}
94
95std::ostream & operator<<(std::ostream &o, const TriggerLine &trigger) {
96 o << trigger.counter() << " : " << trigger.name() << " [" << trigger.module() << "/" << trigger.fpga() << "/" << trigger.clock() << "/" << trigger.bit() << "]";
97 return o;
98}
99
100
101} // namespace TXC
#define y
#define x
const TXC::TriggerLine & getTrigger(const std::string &trigger) const
bool hasTrigger(const std::string &trigger) const
std::unordered_set< unsigned int > m_triggercounters
std::unordered_set< std::string > m_triggernames
std::vector< OutputListElement > m_outputListElements
void addTriggerLine(const TriggerLine &trigger)
std::vector< TriggerLine > m_triggerlines
void addOutputListElement(const OutputListElement &output)
unsigned int fpga() const
unsigned int counter() const
unsigned int module() const
const std::string & name() const
unsigned int bit() const
unsigned int clock() const
std::ostream & operator<<(std::ostream &, const TXC::L1TopoConfigAlg &)
STL namespace.
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.