ATLAS Offline Software
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 
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 
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 
55  if ( (outputConn == nullptr ) && (countConn == nullptr) ) {
57  } else if ( !(outputConn == nullptr ) && (countConn == nullptr) ){
58  set<DecisionConnector*> c = { outputConn };
60  } else if ( (outputConn == nullptr ) && !(countConn == nullptr) ){
61  set<CountingConnector*> c = { countConn };
63  } else {
64  set<DecisionConnector*> c1 = { outputConn };
65  set<CountingConnector*> c2 = { countConn };
67  }
68  return sc;
69 }
70 
71 
74  return m_globalOutput.resetOutput();
75 }
76 
77 
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 
118 
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
161  msg().setLevel( lvl );
162 
163  m_globalOutput.msg().setLevel( lvl );
164 }
TCS::GlobalOutput::setDecisionTriggerLines
void setDecisionTriggerLines(const std::vector< TrigConf::TriggerLine > &triggers)
Definition: GlobalOutput.cxx:19
checkCorrelInHIST.conn
conn
Definition: checkCorrelInHIST.py:25
TCS::StatusCode::SUCCESS
@ SUCCESS
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/StatusCode.h:17
TCS::GlobalOutput::collectOutput
StatusCode collectOutput(const std::set< DecisionConnector * > &outConn, const std::set< CountingConnector * > &countConn)
Definition: GlobalOutput.cxx:150
TCS::TopoCoreSimResult::m_globalOutput
GlobalOutput m_globalOutput
Definition: TopoCoreSimResult.h:60
TCS::TopoCoreSimResult::m_countConnectorMap
std::map< std::string, TCS::CountingConnector * > m_countConnectorMap
Definition: TopoCoreSimResult.h:71
TCS::TopoCoreSimResult::reset
StatusCode reset()
Definition: TopoCoreSimResult.cxx:73
L1TopoMenu.h
TCS::GlobalOutput::resetOutput
StatusCode resetOutput()
Definition: GlobalOutput.cxx:194
extractSporadic.c1
c1
Definition: extractSporadic.py:134
ConfigurableAlg.h
TCS::TopoCoreSimResult::m_outputConnectors
std::set< TCS::DecisionConnector * > m_outputConnectors
Definition: TopoCoreSimResult.h:68
TCS::CountingConnector
Definition: CountingConnector.h:26
TCS::TopoCoreSimResult::output
const std::vector< const TCS::TOBArray * > & output(const std::string &connName) const
Definition: TopoCoreSimResult.cxx:125
x
#define x
DecisionConnector.h
TCS::TopoCoreSimResult::triggerOutput
const TCS::TOBArray * triggerOutput(const std::string &triggerName) const
Definition: TopoCoreSimResult.cxx:43
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
TCS::TopoCoreSimResult::m_countConnectors
std::set< TCS::CountingConnector * > m_countConnectors
Definition: TopoCoreSimResult.h:76
TCS::TopoCoreSimResult::m_triggerLocationCount
std::map< std::string, TCS::CountingConnector * > m_triggerLocationCount
Definition: TopoCoreSimResult.h:74
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
TrigConf::TriggerLine
a TriggerLine entry describes the location of a threshold multiplicity on a cable (connector)
Definition: L1Connector.h:21
TCS::TopoCoreSimResult::globalOutput
const GlobalOutput & globalOutput() const
Definition: TopoCoreSimResult.h:45
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
TrigConf::TrigConfMessaging::msg
MsgStreamTC & msg() const
The standard message stream.
Definition: TrigConfMessaging.h:81
CountingConnector.h
TCS::TopoCoreSimResult::setMsgLevel
void setMsgLevel(TrigConf::MSGTC::Level lvl)
Definition: TopoCoreSimResult.cxx:160
TCS::TopoCoreSimResult::~TopoCoreSimResult
~TopoCoreSimResult()
Definition: TopoCoreSimResult.cxx:30
TCS_EXCEPTION
#define TCS_EXCEPTION(MSG)
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/Exception.h:14
TCS::TopoCoreSimResult::collectResult
StatusCode collectResult(TCS::DecisionConnector *outputConn=nullptr, TCS::CountingConnector *countConn=nullptr)
Definition: TopoCoreSimResult.cxx:53
TCS::TopoCoreSimResult
Definition: TopoCoreSimResult.h:36
TCS::TOBArray
Definition: TOBArray.h:24
merge.output
output
Definition: merge.py:17
TCS::TopoCoreSimResult::m_triggerLocationDec
std::map< std::string, TCS::DecisionConnector * > m_triggerLocationDec
Definition: TopoCoreSimResult.h:66
python.DataFormatRates.c2
c2
Definition: DataFormatRates.py:123
TCS::TopoCoreSimResult::triggerDecision
bool triggerDecision(const std::string &triggerName) const
Definition: TopoCoreSimResult.cxx:35
TopoCoreSimResult.h
TCS::TopoCoreSimResult::m_outputConnectorMap
std::map< std::string, TCS::DecisionConnector * > m_outputConnectorMap
Definition: TopoCoreSimResult.h:63
TCS
Definition: Global/GlobalSimulation/src/IO/Decision.h:18
TrigConf::MsgStreamTC::setLevel
void setLevel(MSGTC::Level lvl)
Set message level of stream.
Definition: Trigger/TrigConfiguration/TrigConfBase/Root/MsgStream.cxx:52
L1Menu.h
TCS::operator<<
std::ostream & operator<<(std::ostream &, const TCS::CountingConnector &)
Definition: CountingConnector.cxx:93
Exception.h
python.compressB64.c
def c
Definition: compressB64.py:93
TCS::GlobalOutput::setMultiplicityTriggerLines
void setMultiplicityTriggerLines(const std::vector< TrigConf::TriggerLine > &triggers)
Definition: GlobalOutput.cxx:33
TCS::DecisionConnector
Definition: DecisionConnector.h:23
DataArray.h
TCS::StatusCode
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/StatusCode.h:15