ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
L1Topo
L1TopoCoreSim
Root
TopoCoreSimResult.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3
*/
4
// TopoCoreSimResult.cxx
5
// L1TopoEvent
6
// @authors
7
// Christian Ohm <cohm@cern.ch>
8
// Joerg Stelzer <stelzer@cern.ch>
9
10
#include "
L1TopoCoreSim/TopoCoreSimResult.h
"
11
#include "
L1TopoCoreSim/DecisionConnector.h
"
12
#include "
L1TopoCoreSim/CountingConnector.h
"
13
#include "
L1TopoConfig/L1TopoMenu.h
"
14
#include "
L1TopoInterfaces/ConfigurableAlg.h
"
15
#include "
L1TopoEvent/DataArray.h
"
16
17
#include "
L1TopoCommon/Exception.h
"
18
19
#include "
TrigConfData/L1Menu.h
"
20
21
#include <algorithm>
22
23
using namespace
std
;
24
using namespace
TCS
;
25
26
TopoCoreSimResult::TopoCoreSimResult
() :
27
TrigConfMessaging
(
"TopoCoreSimResult"
)
28
{}
29
30
TopoCoreSimResult::~TopoCoreSimResult
()
31
{}
32
33
34
bool
35
TopoCoreSimResult::triggerDecision
(
const
std::string & triggerName)
const
{
36
auto
x
=
m_triggerLocationDec
.find(triggerName);
37
if
(
x
== end(
m_triggerLocationDec
) )
38
TCS_EXCEPTION
(
"No trigger with name '"
<< triggerName <<
"' defined"
);
39
return
x
->second->decision(triggerName);
40
}
41
42
const
TCS::TOBArray
*
43
TopoCoreSimResult::triggerOutput
(
const
std::string & triggerName)
const
{
44
auto
x
=
m_triggerLocationDec
.find(triggerName);
45
if
(
x
== end(
m_triggerLocationDec
) )
46
TCS_EXCEPTION
(
"No trigger with name '"
<< triggerName <<
"' defined"
);
47
return
x
->second->output(triggerName);
48
}
49
50
51
52
TCS::StatusCode
53
TopoCoreSimResult::collectResult
(
TCS::DecisionConnector
* outputConn,
TCS::CountingConnector
* countConn) {
54
TCS::StatusCode
sc
=
TCS::StatusCode::SUCCESS
;
55
if
( (outputConn ==
nullptr
) && (countConn ==
nullptr
) ) {
56
sc
=
m_globalOutput
.collectOutput(
m_outputConnectors
,
m_countConnectors
);
57
}
else
if
( !(outputConn ==
nullptr
) && (countConn ==
nullptr
) ){
58
set<DecisionConnector*> c = { outputConn };
59
sc
=
m_globalOutput
.collectOutput(c,
m_countConnectors
);
60
}
else
if
( (outputConn ==
nullptr
) && !(countConn ==
nullptr
) ){
61
set<CountingConnector*> c = { countConn };
62
sc
=
m_globalOutput
.collectOutput(
m_outputConnectors
, c);
63
}
else
{
64
set<DecisionConnector*> c1 = { outputConn };
65
set<CountingConnector*> c2 = { countConn };
66
sc
=
m_globalOutput
.collectOutput(c1, c2);
67
}
68
return
sc
;
69
}
70
71
72
TCS::StatusCode
73
TopoCoreSimResult::reset
() {
74
return
m_globalOutput
.resetOutput();
75
}
76
77
78
TCS::StatusCode
79
TopoCoreSimResult::setupFromMenu
(
const
std::map<std::string, TCS::DecisionConnector*>& outputConnectorMap,
const
std::map<std::string, TCS::CountingConnector*>& countConnectorMap) {
80
81
// Set decision trigger lines
82
83
m_outputConnectorMap
= outputConnectorMap;
84
85
vector<TrigConf::TriggerLine> triggerLinesDec;
86
87
for
(
auto
&
x
:
m_outputConnectorMap
) {
88
// fill the set
89
m_outputConnectors
.insert(
x
.second);
90
91
// fill the trigger line map (trigger name --> (TCS::DecisionConnector*,unsigned int index) )
92
for
(
const
TrigConf::TriggerLine
& trigger :
x
.second->triggers() ) {
93
m_triggerLocationDec
[trigger.name()] =
x
.second;
94
triggerLinesDec.push_back(trigger);
95
}
96
}
97
98
m_globalOutput
.setDecisionTriggerLines(triggerLinesDec);
99
100
// Set multiplicity trigger lines
101
102
m_countConnectorMap
= countConnectorMap;
103
104
vector<TrigConf::TriggerLine> triggerLinesCount;
105
106
for
(
auto
&
x
:
m_countConnectorMap
) {
107
// fill the set
108
m_countConnectors
.insert(
x
.second);
109
110
// fill the trigger line map (trigger name --> (TCS::CountingConnector*,unsigned int index) )
111
for
(
const
TrigConf::TriggerLine
& trigger :
x
.second->triggers() ) {
112
m_triggerLocationCount
[trigger.name()] =
x
.second;
113
triggerLinesCount.push_back(trigger);
114
}
115
}
116
117
m_globalOutput
.setMultiplicityTriggerLines(triggerLinesDec);
118
119
return
TCS::StatusCode::SUCCESS
;
120
}
121
122
123
124
const
std::vector<const TCS::TOBArray*> &
125
TCS::TopoCoreSimResult::output
(
const
std::string & connName)
const
{
126
127
for
(
const
DecisionConnector
* conn :
m_outputConnectors
) {
128
if
( conn->name() != connName )
continue
;
129
return
conn->outputData();
130
}
131
132
// returns first matching connector as there should only be one, otherwise non match, arrive here and throw an exception.
133
TCS_EXCEPTION
(
"No connector with name '"
<< connName <<
"'"
);
134
135
//return (*m_outputConnectors.begin())->outputData();
136
}
137
138
139
140
141
std::ostream&
142
operator<<
(std::ostream& o,
const
TCS::TopoCoreSimResult
& simRes) {
143
144
o << simRes.
globalOutput
();
145
146
for
(
const
DecisionConnector
* conn : simRes.
m_outputConnectors
) {
147
o << conn->name() << endl;
148
// for(const TrigConf::TriggerLine & trigger : conn->triggers()) {
149
// o << " " << trigger << endl;
150
// }
151
for
(
const
TCS::TOBArray
*
output
: conn->outputData())
152
o <<
" output "
<<
output
<< endl;
153
}
154
155
return
o;
156
}
157
158
159
void
160
TopoCoreSimResult::setMsgLevel
(
TrigConf::MSGTC::Level
lvl ) {
161
msg
().
setLevel
( lvl );
162
163
m_globalOutput
.msg().setLevel( lvl );
164
}
ConfigurableAlg.h
CountingConnector.h
DataArray.h
DecisionConnector.h
L1Menu.h
L1TopoMenu.h
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
TopoCoreSimResult.h
Exception.h
TCS_EXCEPTION
#define TCS_EXCEPTION(MSG)
Definition
Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/Exception.h:15
x
#define x
TCS::CountingConnector
Definition
CountingConnector.h:26
TCS::DecisionConnector
Definition
DecisionConnector.h:23
TCS::StatusCode
Definition
Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/StatusCode.h:15
TCS::StatusCode::SUCCESS
@ SUCCESS
Definition
Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/StatusCode.h:17
TCS::TOBArray
Definition
TOBArray.h:24
TCS::TopoCoreSimResult
Definition
TopoCoreSimResult.h:36
TCS::TopoCoreSimResult::m_triggerLocationDec
std::map< std::string, TCS::DecisionConnector * > m_triggerLocationDec
Definition
TopoCoreSimResult.h:66
TCS::TopoCoreSimResult::m_outputConnectorMap
std::map< std::string, TCS::DecisionConnector * > m_outputConnectorMap
Definition
TopoCoreSimResult.h:63
TCS::TopoCoreSimResult::globalOutput
const GlobalOutput & globalOutput() const
Definition
TopoCoreSimResult.h:45
TCS::TopoCoreSimResult::m_globalOutput
GlobalOutput m_globalOutput
Definition
TopoCoreSimResult.h:60
TCS::TopoCoreSimResult::m_triggerLocationCount
std::map< std::string, TCS::CountingConnector * > m_triggerLocationCount
Definition
TopoCoreSimResult.h:74
TCS::TopoCoreSimResult::collectResult
StatusCode collectResult(TCS::DecisionConnector *outputConn=nullptr, TCS::CountingConnector *countConn=nullptr)
Definition
TopoCoreSimResult.cxx:53
TCS::TopoCoreSimResult::~TopoCoreSimResult
~TopoCoreSimResult()
Definition
TopoCoreSimResult.cxx:30
TCS::TopoCoreSimResult::m_countConnectors
std::set< TCS::CountingConnector * > m_countConnectors
Definition
TopoCoreSimResult.h:76
TCS::TopoCoreSimResult::m_outputConnectors
std::set< TCS::DecisionConnector * > m_outputConnectors
Definition
TopoCoreSimResult.h:68
TCS::TopoCoreSimResult::reset
StatusCode reset()
Definition
TopoCoreSimResult.cxx:73
TCS::TopoCoreSimResult::triggerDecision
bool triggerDecision(const std::string &triggerName) const
Definition
TopoCoreSimResult.cxx:35
TCS::TopoCoreSimResult::output
const std::vector< const TCS::TOBArray * > & output(const std::string &connName) const
Definition
TopoCoreSimResult.cxx:125
TCS::TopoCoreSimResult::m_countConnectorMap
std::map< std::string, TCS::CountingConnector * > m_countConnectorMap
Definition
TopoCoreSimResult.h:71
TCS::TopoCoreSimResult::setupFromMenu
StatusCode setupFromMenu(const std::map< std::string, TCS::DecisionConnector * > &outputConnectorMap, const std::map< std::string, TCS::CountingConnector * > &countConnectorMap)
Definition
TopoCoreSimResult.cxx:79
TCS::TopoCoreSimResult::setMsgLevel
void setMsgLevel(TrigConf::MSGTC::Level lvl)
Definition
TopoCoreSimResult.cxx:160
TCS::TopoCoreSimResult::triggerOutput
const TCS::TOBArray * triggerOutput(const std::string &triggerName) const
Definition
TopoCoreSimResult.cxx:43
TCS::TopoCoreSimResult::TopoCoreSimResult
TopoCoreSimResult()
Definition
TopoCoreSimResult.cxx:26
TrigConf::MsgStreamTC::setLevel
void setLevel(MSGTC::Level lvl)
Set message level of stream.
Definition
Trigger/TrigConfiguration/TrigConfBase/Root/MsgStream.cxx:52
TrigConf::TrigConfMessaging::msg
MsgStreamTC & msg() const
The standard message stream.
Definition
TrigConfMessaging.h:86
TrigConf::TrigConfMessaging::TrigConfMessaging
TrigConfMessaging(const std::string &name)
Constructor with parameters.
Definition
TrigConfMessaging.h:34
TrigConf::TriggerLine
a TriggerLine entry describes the location of a threshold multiplicity on a cable (connector)
Definition
L1Connector.h:22
TCS
Definition
AnomalyDetectionBDT.h:18
TCS::operator<<
std::ostream & operator<<(std::ostream &os, const TCS::Bin &bin)
Definition
AnomalyDetectionBDT.cxx:50
TrigConf::MSGTC::Level
Level
Definition
Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
std
STL namespace.
Generated on
for ATLAS Offline Software by
1.17.0