ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
L1Topo
L1TopoConfig
Root
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
5
#include "
L1TopoConfig/L1TopoConfigOutputList.h
"
6
#include "
L1TopoCommon/Exception.h
"
7
8
#include <iostream>
9
#include <iomanip>
10
#include <algorithm>
11
#include <set>
12
13
using namespace
std
;
14
using namespace
TXC
;
15
16
17
void
18
TriggerLine::calcCounter
() {
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
27
void
28
L1TopoConfigOutputList::addOutputListElement
(
const
OutputListElement
& output) {
29
m_outputListElements
.push_back(output);
30
}
31
32
33
void
34
L1TopoConfigOutputList::addTriggerLine
(
const
TriggerLine
& trigger) {
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
53
bool
54
L1TopoConfigOutputList::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
61
const
TriggerLine
&
62
L1TopoConfigOutputList::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
68
namespace
{
69
bool
comp(
const
TriggerLine
&
x
,
const
TriggerLine
&
y
) {
return
x
.counter() <
y
.counter(); }
70
}
71
72
void
73
L1TopoConfigOutputList::sort
() {
74
std::sort
(
m_triggerlines
.begin(),
m_triggerlines
.end(), comp);
75
}
76
77
78
namespace
TXC
{
79
80
std::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
95
std::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
L1TopoConfigOutputList.h
Exception.h
TCS_EXCEPTION
#define TCS_EXCEPTION(MSG)
Definition
Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/Exception.h:15
y
#define y
x
#define x
TXC::L1TopoConfigOutputList
Definition
L1TopoConfigOutputList.h:89
TXC::L1TopoConfigOutputList::getTrigger
const TXC::TriggerLine & getTrigger(const std::string &trigger) const
Definition
L1TopoConfigOutputList.cxx:62
TXC::L1TopoConfigOutputList::hasTrigger
bool hasTrigger(const std::string &trigger) const
Definition
L1TopoConfigOutputList.cxx:54
TXC::L1TopoConfigOutputList::m_triggercounters
std::unordered_set< unsigned int > m_triggercounters
Definition
L1TopoConfigOutputList.h:126
TXC::L1TopoConfigOutputList::m_triggernames
std::unordered_set< std::string > m_triggernames
Definition
L1TopoConfigOutputList.h:125
TXC::L1TopoConfigOutputList::m_undef
TXC::TriggerLine m_undef
Definition
L1TopoConfigOutputList.h:123
TXC::L1TopoConfigOutputList::m_outputListElements
std::vector< OutputListElement > m_outputListElements
Definition
L1TopoConfigOutputList.h:119
TXC::L1TopoConfigOutputList::addTriggerLine
void addTriggerLine(const TriggerLine &trigger)
Definition
L1TopoConfigOutputList.cxx:34
TXC::L1TopoConfigOutputList::m_triggerlines
std::vector< TriggerLine > m_triggerlines
Definition
L1TopoConfigOutputList.h:121
TXC::L1TopoConfigOutputList::sort
void sort()
Definition
L1TopoConfigOutputList.cxx:73
TXC::L1TopoConfigOutputList::addOutputListElement
void addOutputListElement(const OutputListElement &output)
Definition
L1TopoConfigOutputList.cxx:28
TXC::OutputListElement
Definition
L1TopoConfigOutputList.h:57
TXC::TriggerLine
Definition
L1TopoConfigOutputList.h:15
TXC::TriggerLine::m_counter
unsigned int m_counter
Definition
L1TopoConfigOutputList.h:51
TXC::TriggerLine::fpga
unsigned int fpga() const
Definition
L1TopoConfigOutputList.h:38
TXC::TriggerLine::m_fpga
unsigned int m_fpga
Definition
L1TopoConfigOutputList.h:48
TXC::TriggerLine::m_bit
unsigned int m_bit
Definition
L1TopoConfigOutputList.h:50
TXC::TriggerLine::counter
unsigned int counter() const
Definition
L1TopoConfigOutputList.h:41
TXC::TriggerLine::m_clock
unsigned int m_clock
Definition
L1TopoConfigOutputList.h:49
TXC::TriggerLine::module
unsigned int module() const
Definition
L1TopoConfigOutputList.h:37
TXC::TriggerLine::m_module
unsigned int m_module
Definition
L1TopoConfigOutputList.h:47
TXC::TriggerLine::name
const std::string & name() const
Definition
L1TopoConfigOutputList.h:34
TXC::TriggerLine::bit
unsigned int bit() const
Definition
L1TopoConfigOutputList.h:40
TXC::TriggerLine::calcCounter
void calcCounter()
Definition
L1TopoConfigOutputList.cxx:18
TXC::TriggerLine::clock
unsigned int clock() const
Definition
L1TopoConfigOutputList.h:39
TXC
Definition
Run2toRun3ConvertersL1.h:5
TXC::operator<<
std::ostream & operator<<(std::ostream &, const TXC::L1TopoConfigAlg &)
Definition
L1TopoConfigAlg.cxx:123
std
STL namespace.
std::sort
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
Definition
DVL_algorithms.h:554
Generated on
for ATLAS Offline Software by
1.17.0