ATLAS Offline Software
Loading...
Searching...
No Matches
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
16
18
19#include "TrigConfData/L1Menu.h"
20
21#include <algorithm>
22
23using namespace std;
24using namespace TCS;
25
29
32
33
34bool
35TopoCoreSimResult::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
42const TCS::TOBArray*
43TopoCoreSimResult::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
55 if ( (outputConn == nullptr ) && (countConn == nullptr) ) {
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
74 return m_globalOutput.resetOutput();
75}
76
77
79TopoCoreSimResult::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
120}
121
122
123
124const std::vector<const TCS::TOBArray*> &
125TCS::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
141std::ostream&
142operator<<(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
159void
161 msg().setLevel( lvl );
162
163 m_globalOutput.msg().setLevel( lvl );
164}
static Double_t sc
#define x
std::map< std::string, TCS::DecisionConnector * > m_triggerLocationDec
std::map< std::string, TCS::DecisionConnector * > m_outputConnectorMap
const GlobalOutput & globalOutput() const
std::map< std::string, TCS::CountingConnector * > m_triggerLocationCount
StatusCode collectResult(TCS::DecisionConnector *outputConn=nullptr, TCS::CountingConnector *countConn=nullptr)
std::set< TCS::CountingConnector * > m_countConnectors
std::set< TCS::DecisionConnector * > m_outputConnectors
bool triggerDecision(const std::string &triggerName) const
const std::vector< const TCS::TOBArray * > & output(const std::string &connName) const
std::map< std::string, TCS::CountingConnector * > m_countConnectorMap
StatusCode setupFromMenu(const std::map< std::string, TCS::DecisionConnector * > &outputConnectorMap, const std::map< std::string, TCS::CountingConnector * > &countConnectorMap)
void setMsgLevel(TrigConf::MSGTC::Level lvl)
const TCS::TOBArray * triggerOutput(const std::string &triggerName) const
void setLevel(MSGTC::Level lvl)
Set message level of stream.
MsgStreamTC & msg() const
The standard message stream.
TrigConfMessaging(const std::string &name)
Constructor with parameters.
a TriggerLine entry describes the location of a threshold multiplicity on a cable (connector)
Definition L1Connector.h:21
std::ostream & operator<<(std::ostream &os, const TCS::Bin &bin)
STL namespace.