ATLAS Offline Software
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 
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
plotting.yearwise_luminosity_vs_mu.comp
comp
Definition: yearwise_luminosity_vs_mu.py:23
PFHLTConfig.outputlist
list outputlist
Definition: PFHLTConfig.py:385
TXC::TriggerLine::name
const std::string & name() const
Definition: L1TopoConfigOutputList.h:34
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
x
#define x
TXC::L1TopoConfigOutputList
Definition: L1TopoConfigOutputList.h:89
TXC::TriggerLine::fpga
unsigned int fpga() const
Definition: L1TopoConfigOutputList.h:38
TXC::TriggerLine::bit
unsigned int bit() const
Definition: L1TopoConfigOutputList.h:40
TXC::OutputListElement
Definition: L1TopoConfigOutputList.h:57
TXC::TriggerLine::clock
unsigned int clock() const
Definition: L1TopoConfigOutputList.h:39
TCS_EXCEPTION
#define TCS_EXCEPTION(MSG)
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/Exception.h:14
TXC::TriggerLine::module
unsigned int module() const
Definition: L1TopoConfigOutputList.h:37
merge.output
output
Definition: merge.py:17
TXC
Definition: IL1TopoMenuLoader.h:10
operator<<
std::ostream & operator<<(std::ostream &lhs, const TestGaudiProperty &rhs)
Definition: TestGaudiProperty.cxx:69
TXC::TriggerLine
Definition: L1TopoConfigOutputList.h:15
L1TopoConfigOutputList.h
TXC::TriggerLine::counter
unsigned int counter() const
Definition: L1TopoConfigOutputList.h:41
y
#define y
std::sort
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
Definition: DVL_algorithms.h:623
dqt_zlumi_alleff_HIST.tl
tl
Definition: dqt_zlumi_alleff_HIST.py:73
Exception.h