ATLAS Offline Software
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 //--------------------------------------------------------------------------------------
15  :m_output_te_name(),
16  m_output_te_index(0),
17  m_output_te_id(0),
18  m_topo_te(0)
19 {
20 }
21 
22 //--------------------------------------------------------------------------------------
23 TrigConfSeq::TrigConfSeq(unsigned int id,
24  unsigned int index,
25  const std::string &name)
26  :m_output_te_name(name),
27  m_output_te_index(index),
28  m_output_te_id(id),
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 //--------------------------------------------------------------------------------------
44 const 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 //--------------------------------------------------------------------------------------
60 std::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 //--------------------------------------------------------------------------------------
73 std::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 //--------------------------------------------------------------------------------------
86 bool 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 //--------------------------------------------------------------------------------------
95 bool 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 //--------------------------------------------------------------------------------------
104 void TrigConfSeq::print(std::ostream &os) const
105 {
106  os << str(*this) << std::endl;
107 }
108 
109 //--------------------------------------------------------------------------------------
110 std::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 }
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
TrigConfSeq::matchAlgType
bool matchAlgType(const std::string &atype) const
Definition: TrigConfSeq.cxx:95
TrigConfSeq::clearStrings
void clearStrings()
Definition: TrigConfSeq.cxx:34
index
Definition: index.py:1
TrigConfSeq::findName
std::vector< TrigConfAlg >::const_iterator findName(const std::string &aname) const
Definition: TrigConfSeq.cxx:60
skel.it
it
Definition: skel.GENtoEVGEN.py:423
str
std::string str(const TrigConfSeq &o)
Definition: TrigConfSeq.cxx:110
TrigConfSeq::m_alg
std::vector< TrigConfAlg > m_alg
Definition: TrigConfSeq.h:71
TrigConfSeq::getId
uint32_t getId() const
Definition: TrigConfSeq.h:43
TrigConfSeq::findType
std::vector< TrigConfAlg >::const_iterator findType(const std::string &atype) const
Definition: TrigConfSeq.cxx:73
python.Dumpers.aname
string aname
Definition: Dumpers.py:5541
TrigConfSeq::TrigConfSeq
TrigConfSeq()
Definition: TrigConfSeq.cxx:14
Pmt::getPosition
Eigen::Vector3d getPosition(const xAOD::TrackParticle &trk)
Definition: PoorMansIpAugmenterAlg.cxx:43
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
lumiFormat.i
int i
Definition: lumiFormat.py:92
TrigConfSeq.h
TrigConfSeq
Definition: TrigConfSeq.h:29
TrigConfAlg
Definition: TrigConfAlg.h:25
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
TrigConfSeq::getAlg
const std::vector< TrigConfAlg > & getAlg() const
Definition: TrigConfSeq.h:50
REPORT_MESSAGE_WITH_CONTEXT
#define REPORT_MESSAGE_WITH_CONTEXT(LVL, CONTEXT_NAME)
Report a message, with an explicitly specified context name.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:345
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:194
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
TrigConfSeq::matchAlgName
bool matchAlgName(const std::string &aname) const
Definition: TrigConfSeq.cxx:86
errorcheck.h
Helpers for checking error return status codes and reporting errors.
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
TrigConfSeq::m_output_te_name
std::string m_output_te_name
Definition: TrigConfSeq.h:67
TrigConfSeq::getName
const std::string & getName() const
Definition: TrigConfSeq.h:44
TrigConfSeq::print
void print(std::ostream &os=std::cout) const
Definition: TrigConfSeq.cxx:104
TrigConfSeq::getAlg
const TrigConfAlg & getAlg(unsigned int pos) const
Definition: TrigConfSeq.cxx:44