ATLAS Offline Software
Loading...
Searching...
No Matches
CountingConnector.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5
7
9
13
14using namespace std;
15using namespace TCS;
16
18 const string & input,
19 const string & algorithm,
20 const string & output) :
21 Connector(name, {input}, algorithm, {output}, COUNT),
22 m_countingAlgorithm(0)
23{}
24
28
29// TO-DO: Add function to return the counts, but format?
30
31
32
33TCS::TOBArray const *
34TCS::CountingConnector::output(const std::string & trigger) const {
35 unsigned int index(0);
36 for(const TrigConf::TriggerLine & tl : m_triggers) {
37 if(tl.name() == trigger)
38 return m_outputData[index];
39 ++index;
40 }
41 TCS_EXCEPTION("Counting connector '" << name() << "' has no output trigger '" << trigger << "'");
42 return nullptr;
43}
44
45
48 for(TOBArray const * x : m_outputData) {
49 delete x;
50 }
51 m_outputData.clear();
52
53 // set counting to 0
54 m_count.reset();
55
57}
58
61 return dynamic_cast<InputConnector*>(m_inputConnectors[0]);
62}
63
64void
67 m_countingAlgorithm = dynamic_cast<CountingAlg*>(alg);
68 if(m_countingAlgorithm == nullptr && alg != nullptr) {
69 TCS_EXCEPTION("Error: algorithm " << alg->name() << " is not a CountingAlg");
70 }
71}
72
73// attaches the selected data to the connector (does take ownership)
74void
75CountingConnector::attachOutputData(const std::vector<TOBArray *>& data) {
76 if(m_outputData.size() != 0) {
77 TCS_EXCEPTION("Trying to attach data to multiplicity connector '" << name() <<"' which has already data attached");
78 }
79
80 for(TOBArray * x : data)
81 m_outputData.push_back( dynamic_cast<const TOBArray*>(x) );
82}
83
84
85void
86CountingConnector::setFirstOutputBit(unsigned int firstOutputBit) {
87 m_count.setFirstBit(firstOutputBit);
88}
89
90namespace TCS {
91
92 ostream &
93 operator<<(ostream&o, const TCS::CountingConnector & conn) {
94 o << "(" << join(conn.inputNames()) << ") ---[" << conn.algorithmName() << "]---> (" << join(conn.outputNames()) << ")";
95 return o;
96
97 }
98}
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
#define x
Connector(const std::string &name, ConnectorType conntype)
Definition Connector.cxx:31
std::vector< TCS::Connector * > m_inputConnectors
Definition Connector.h:98
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
TOBArray const * output(const std::string &trigger) const
void attachOutputData(const std::vector< TOBArray * > &)
CountingConnector(const std::string &name, const std::string &input, const std::string &algorithm, const std::string &output)
TCS::CountingAlg * m_countingAlgorithm
std::vector< TrigConf::TriggerLine > m_triggers
void setFirstOutputBit(unsigned int firstOutputBit)
void setAlgorithm(TCS::ConfigurableAlg *alg)
std::vector< TOBArray const * > m_outputData
InputConnector * inputConnector() const
virtual StatusCode clearOutput()
a TriggerLine entry describes the location of a threshold multiplicity on a cable (connector)
Definition L1Connector.h:22
std::string algorithm
Definition hcg.cxx:85
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.