ATLAS Offline Software
Loading...
Searching...
No Matches
TrigConfSeq.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
5// C/C++
6#include <algorithm>
7#include <sstream>
8
11
12
13//--------------------------------------------------------------------------------------
21
22//--------------------------------------------------------------------------------------
24 unsigned int index,
25 const std::string &name)
26 :m_output_te_name(name),
29 m_topo_te(0)
30{
31}
32
33//--------------------------------------------------------------------------------------
35{
36 //
37 // Clear all string variables
38 //
39 m_output_te_name.clear();
40 for(unsigned int i = 0; i < m_alg.size(); ++i) m_alg[i].clearStrings();
41}
42
43//--------------------------------------------------------------------------------------
44const TrigConfAlg& TrigConfSeq::getAlg(unsigned int pos) const
45{
46 if(pos >= m_alg.size()) {
47 REPORT_MESSAGE_WITH_CONTEXT(MSG::ERROR, "TrigConfSeq")
48 << "getAlg(" << pos << ") error! Index is greater than alg size=" << m_alg.size() << " for " << m_output_te_name;
49 return m_alg.front();
50 }
51 if(m_alg[pos].getPosition() != pos) {
52 REPORT_MESSAGE_WITH_CONTEXT(MSG::ERROR, "TrigConfSeq")
53 << "getAlg(" << pos << ") error! Index mismatch: " << m_alg[pos].getPosition() << "!=" << pos;
54 }
55
56 return m_alg[pos];
57}
58
59//--------------------------------------------------------------------------------------
60std::vector<TrigConfAlg>::const_iterator TrigConfSeq::findName(const std::string &aname) const
61{
62 // find first algorithm by name
63 std::vector<TrigConfAlg>::const_iterator it = m_alg.begin();
64
65 for(; it != m_alg.end(); ++it) {
66 if(it->getName() == aname) break;
67 }
68
69 return it;
70}
71
72//--------------------------------------------------------------------------------------
73std::vector<TrigConfAlg>::const_iterator TrigConfSeq::findType(const std::string &atype) const
74{
75 // find first algorithm by type
76 std::vector<TrigConfAlg>::const_iterator it = m_alg.begin();
77
78 for(; it != m_alg.end(); ++it) {
79 if(it->getType() == atype) break;
80 }
81
82 return it;
83}
84
85//--------------------------------------------------------------------------------------
86bool TrigConfSeq::matchAlgName(const std::string &aname) const
87{
88 //
89 // Match algorithm name to a list of my configured algorithms
90 //
91 return (TrigConfSeq::findName(aname) != m_alg.end());
92}
93
94//--------------------------------------------------------------------------------------
95bool TrigConfSeq::matchAlgType(const std::string &atype) const
96{
97 //
98 // Match algorithm type to a list of my configured algorithms
99 //
100 return (TrigConfSeq::findType(atype) != m_alg.end());
101}
102
103//--------------------------------------------------------------------------------------
104void TrigConfSeq::print(std::ostream &os) const
105{
106 os << str(*this) << std::endl;
107}
108
109//--------------------------------------------------------------------------------------
110std::string str(const TrigConfSeq &o)
111{
112 std::stringstream s;
113 s << "TrigConfSeq: " << o.getName() << " id=" << o.getId()
114 << " contains " << o.getAlg().size() << " algorithm(s): " << std::endl;
115
116 for(unsigned int i = 0; i < o.getAlg().size(); ++i) {
117 s << " " << str(o.getAlg()[i]) << std::endl;
118 }
119
120 return s.str();
121}
Helpers for checking error return status codes and reporting errors.
#define REPORT_MESSAGE_WITH_CONTEXT(LVL, CONTEXT_NAME)
Report a message, with an explicitly specified context name.
std::vector< TrigConfAlg >::const_iterator findType(const std::string &atype) const
std::vector< TrigConfAlg > m_alg
Definition TrigConfSeq.h:71
void clearStrings()
bool matchAlgType(const std::string &atype) const
bool matchAlgName(const std::string &aname) const
uint32_t m_output_te_id
Definition TrigConfSeq.h:69
std::vector< TrigConfAlg >::const_iterator findName(const std::string &aname) const
const TrigConfAlg & getAlg(unsigned int pos) const
const std::string & getName() const
Definition TrigConfSeq.h:44
uint32_t m_topo_te
Definition TrigConfSeq.h:70
void print(std::ostream &os=std::cout) const
uint16_t m_output_te_index
Definition TrigConfSeq.h:68
uint32_t getId() const
Definition TrigConfSeq.h:43
std::string m_output_te_name
Definition TrigConfSeq.h:67
const std::vector< TrigConfAlg > & getAlg() const
Definition TrigConfSeq.h:50
Definition index.py:1