ATLAS Offline Software
Loading...
Searching...
No Matches
DecisionConnector.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6
10
11using namespace std;
12using namespace TCS;
13
15 const vector<string> & inputs,
16 const string & algorithm,
17 const vector<string> & outputs) :
18 Connector(name, inputs, algorithm, outputs, DECISION),
20{}
21
25
26bool
27TCS::DecisionConnector::decision(const std::string & trigger) const {
28 unsigned int index(0);
29 for(const TrigConf::TriggerLine & tl : m_triggers) {
30 if(tl.name() == trigger)
31 return m_decision.bit(index);
32 ++index;
33 }
34 TCS_EXCEPTION("Decision connector '" << name() << "' has no output trigger '" << trigger << "'");
35 return false;
36}
37
38
39TCS::TOBArray const *
40TCS::DecisionConnector::output(const std::string & trigger) const {
41 unsigned int index(0);
42 for(const TrigConf::TriggerLine & tl : m_triggers) {
43 if(tl.name() == trigger)
44 return m_outputData[index];
45 ++index;
46 }
47 TCS_EXCEPTION("Decision connector '" << name() << "' has no output trigger '" << trigger << "'");
48 return nullptr;
49}
50
51
54 for(TOBArray const * x : m_outputData) {
55 delete x;
56 }
57 m_outputData.clear();
58
59 // set decision to 0
60 m_decision.reset();
61
63}
64
65void
68 m_decisionAlgorithm = dynamic_cast<DecisionAlg*>(alg);
69 if(m_decisionAlgorithm == nullptr && alg != nullptr) {
70 cerr << "Error: algorithm" << alg->name() << " is not a DecisionAlg" << endl;
71 }
72}
73
74
75// attaches the sorted data to the connector (does take ownership)
76void
77DecisionConnector::attachOutputData(const std::vector<TOBArray *>& data) {
78 if(m_outputData.size() != 0) {
79 TCS_EXCEPTION("Trying to attach data to decision connector '" << name() << "' which has already data attached");
80 }
81
82 //std::vector<TOBArray const *> m_outputData;
83 for(TOBArray * x : data)
84 m_outputData.push_back( x );
85}
86
87
88void
89DecisionConnector::setFirstOutputBit(unsigned int firstOutputBit) {
90 m_decision.setFirstBit(firstOutputBit);
91}
92
93
94namespace TCS {
95
96
97ostream &
98operator<<(ostream &o, const TCS::DecisionConnector & conn) {
99 o << "(" << join(conn.inputNames()) << ") ---[ " << conn.algorithmName() << " ]---> (" << join(conn.outputNames()) << ")";
100 return o;
101}
102
103
104}
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
#define x
Connector(const std::string &name, ConnectorType conntype)
Definition Connector.cxx:31
const std::string & name() const
Definition Connector.h:44
virtual void setAlgorithm(TCS::ConfigurableAlg *)
Definition Connector.cxx:42
const TCS::ConfigurableAlg * algorithm() const
Definition Connector.h:50
DecisionConnector(const std::string &name, const std::vector< std::string > &inputs, const std::string &algorithm, const std::vector< std::string > &outputs)
std::vector< TrigConf::TriggerLine > m_triggers
void attachOutputData(const std::vector< TOBArray * > &)
TOBArray const * output(const std::string &trigger) const
void setAlgorithm(TCS::ConfigurableAlg *alg)
std::vector< TOBArray const * > m_outputData
const Decision & decision() const
void setFirstOutputBit(unsigned int firstOutputBit)
TCS::DecisionAlg * m_decisionAlgorithm
virtual StatusCode clearOutput()
a TriggerLine entry describes the location of a threshold multiplicity on a cable (connector)
Definition L1Connector.h:22
std::ostream & operator<<(std::ostream &os, const TCS::Bin &bin)
std::string join(const std::vector< std::string > &v, const char c=',')
Definition index.py:1
STL namespace.