ATLAS Offline Software
Connector.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 #ifndef L1TopoCoreSim_Connector
4 #define L1TopoCoreSim_Connector
5 
6 #include <iostream>
7 #include <vector>
8 #include <string>
9 
11 #include "L1TopoCommon/Types.h"
12 
13 
14 namespace TCS {
15 
16  class ConfigurableAlg;
17 
18  // std::vector<std::string> vectorize(const std::string& str);
19 
20  // std::vector<std::string> vectorize2(const std::string &str1, const std::string &str2);
21 
22  class Connector {
23  public:
24 
26 
27  // standard connector
28  Connector( const std::string & name,
29  ConnectorType conntype );
30 
31  Connector( const std::string & name,
32  const std::vector<std::string> & inputnames,
33  const std::string & algorithm,
34  const std::vector<std::string> & outputnames,
35  ConnectorType conntype );
36 
37  virtual ~Connector();
38 
39  bool isInputConnector() const { return m_conntype == INPUT; }
40  bool isSortingConnector() const { return m_conntype == SORT; }
41  bool isDecisionConnector() const { return m_conntype == DECISION; }
42  bool isCountingConnector() const { return m_conntype == COUNT; }
43 
44  const std::string & name() const { return m_name; }
45  const std::string & algorithmName() const { return m_algorithmName; }
46  const std::vector<std::string> & inputNames() const { return m_inputNames; }
47  const std::vector<std::string> & outputNames() const { return m_outputNames; }
48 
49  const std::vector<TCS::Connector*> & inputConnectors() const { return m_inputConnectors; }
50  const TCS::ConfigurableAlg* algorithm() const { return m_algorithm; }
51 
52  virtual void setAlgorithm(TCS::ConfigurableAlg*);
53 
54  virtual StatusCode clearOutput() = 0;
55 
56  StatusCode reset();
57 
58  // accessors
59  bool isExecuted() const { return m_isExecuted; }
60 
62 
63  unsigned int numberOutputBits() const;
64 
69  void toggleInputOverflow(const bool value);
70  bool hasInputOverflow() const { return m_hasInputOverflow; }
71 
72  void toggleAmbiguity(const bool value);
73  bool hasAmbiguity() const { return m_hasAmbiguity; }
74 
75  protected: // functions
76 
77  friend class TopoSteering;
78  friend class TopoSteeringStructure;
79 
80  // setters
82 
84 
85  std::vector<TCS::Connector*> & inputConnectors() { return m_inputConnectors; }
86 
88 
89  protected: // data
90 
91  // configuration of the connector: name, input, algorithms
92  std::string m_name{""};
93  std::string m_algorithmName{""};
94  std::vector<std::string> m_inputNames;
95  std::vector<std::string> m_outputNames;
96 
97  // the instances for input and algorithms (algorithms are owned by AlgFactory, connectors by the steering)
98  std::vector<TCS::Connector*> m_inputConnectors;
99 
103 
104  // status information
105  bool m_isExecuted {false}; // true if connector alg(s) have been executed on current event (must be reset at begin of event
106 
107  StatusCode m_executionStatusCode {StatusCode::SUCCESS}; // StatusCode of last execution (for cache)
111  bool m_hasInputOverflow{false};
112 
113  bool m_hasAmbiguity{false};
114 
115  private:
116 
118 
119  };
120 
121 }
122 
123 std::ostream & operator<<(std::ostream &, const TCS::Connector&);
124 
125 #endif
TCS::Connector::isInputConnector
bool isInputConnector() const
Definition: Connector.h:39
TCS::StatusCode::SUCCESS
@ SUCCESS
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/StatusCode.h:17
TCS::Connector::m_executionStatusCode
StatusCode m_executionStatusCode
Definition: Connector.h:107
TCS::Connector::executionStatusCode
StatusCode executionStatusCode() const
Definition: Connector.h:61
TCS::Connector::m_inputConnectors
std::vector< TCS::Connector * > m_inputConnectors
Definition: Connector.h:98
TCS::Connector
Definition: Connector.h:22
TCS::Connector::m_algorithm
TCS::ConfigurableAlg * m_algorithm
the algorithm that belongs to this connector
Definition: Connector.h:102
TCS::Connector::setExecutionStatusCode
void setExecutionStatusCode(StatusCode statusCode)
Definition: Connector.h:83
TCS::Connector::m_hasAmbiguity
bool m_hasAmbiguity
Definition: Connector.h:113
operator<<
std::ostream & operator<<(std::ostream &, const TCS::Connector &)
Definition: Connector.cxx:87
athena.value
value
Definition: athena.py:124
TCS::Connector::COUNT
@ COUNT
Definition: Connector.h:25
Types.h
TCS::Connector::m_name
std::string m_name
Definition: Connector.h:92
TCS::Connector::INPUT
@ INPUT
Definition: Connector.h:25
dumpTruth.statusCode
statusCode
Definition: dumpTruth.py:85
TCS::Connector::inputConnectors
std::vector< TCS::Connector * > & inputConnectors()
Definition: Connector.h:85
TCS::Connector::algorithmName
const std::string & algorithmName() const
Definition: Connector.h:45
TCS::Connector::m_algorithmName
std::string m_algorithmName
Definition: Connector.h:93
StatusCode.h
TCS::Connector::reset
StatusCode reset()
Definition: Connector.cxx:48
TCS::Connector::m_conntype
ConnectorType m_conntype
Definition: Connector.h:117
TCS::Connector::Connector
Connector(const std::string &name, ConnectorType conntype)
Definition: Connector.cxx:31
TCS::Connector::toggleInputOverflow
void toggleInputOverflow(const bool value)
to be toggled after 'attachOutputData' is called.
Definition: Connector.cxx:76
TCS::Connector::hasInputOverflow
bool hasInputOverflow() const
Definition: Connector.h:70
TCS::Connector::isExecuted
bool isExecuted() const
Definition: Connector.h:59
TCS::Connector::ConnectorType
ConnectorType
Definition: Connector.h:25
TCS::TopoSteering
Definition: TopoSteering.h:47
TCS::ConfigurableAlg
Definition: ConfigurableAlg.h:30
TCS::Connector::outputNames
const std::vector< std::string > & outputNames() const
Definition: Connector.h:47
TCS::Connector::toggleAmbiguity
void toggleAmbiguity(const bool value)
Definition: Connector.cxx:81
TCS::Connector::algorithm
const TCS::ConfigurableAlg * algorithm() const
Definition: Connector.h:50
TCS::Connector::~Connector
virtual ~Connector()
Definition: Connector.cxx:38
TCS::Connector::name
const std::string & name() const
Definition: Connector.h:44
TCS::Connector::m_outputNames
std::vector< std::string > m_outputNames
Definition: Connector.h:95
TCS::Connector::m_inputNames
std::vector< std::string > m_inputNames
Definition: Connector.h:94
TCS::Connector::DECISION
@ DECISION
Definition: Connector.h:25
TCS::Connector::SORT
@ SORT
Definition: Connector.h:25
TCS::Connector::m_isExecuted
bool m_isExecuted
Definition: Connector.h:105
TCS::Connector::isSortingConnector
bool isSortingConnector() const
Definition: Connector.h:40
TCS::Connector::inputConnectors
const std::vector< TCS::Connector * > & inputConnectors() const
Definition: Connector.h:49
TCS::Connector::isDecisionConnector
bool isDecisionConnector() const
Definition: Connector.h:41
TCS::Connector::numberOutputBits
unsigned int numberOutputBits() const
Definition: Connector.cxx:68
TCS::TopoSteeringStructure
Definition: TopoSteeringStructure.h:32
TCS::Connector::algorithm
TCS::ConfigurableAlg * algorithm()
Definition: Connector.h:87
TCS::Connector::NONE
@ NONE
Definition: Connector.h:25
TCS
Definition: Global/GlobalSimulation/src/IO/Decision.h:18
TCS::Connector::isCountingConnector
bool isCountingConnector() const
Definition: Connector.h:42
TCS::Connector::hasAmbiguity
bool hasAmbiguity() const
Definition: Connector.h:73
TCS::Connector::inputNames
const std::vector< std::string > & inputNames() const
Definition: Connector.h:46
TCS::Connector::clearOutput
virtual StatusCode clearOutput()=0
TCS::Connector::setIsExecuted
void setIsExecuted(bool isExecuted)
Definition: Connector.h:81
TCS::Connector::m_hasInputOverflow
bool m_hasInputOverflow
whether the input data came with an overflow bit
Definition: Connector.h:111
TCS::StatusCode
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/StatusCode.h:15
TCS::Connector::setAlgorithm
virtual void setAlgorithm(TCS::ConfigurableAlg *)
Definition: Connector.cxx:42