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