ATLAS Offline Software
Loading...
Searching...
No Matches
HLTSequence.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
8
9#include <iostream>
10#include <sstream>
11#include <fstream>
12
13using namespace std;
14using namespace TrigConf;
15
21
22TrigConf::HLTSequence::HLTSequence( const vector<HLTTriggerElement*>& inputTEs,
24 const vector<string>& algorithms) :
28{
29 setName(outputTE->name());
30}
31
33{
35 delete te;
36 delete m_outputTE;
37 delete m_topoStartTE;
38}
39
40void
45
46unsigned int
48 return m_outputTE->hashId();
49}
50
51
53
54 xmlfile << " <SEQUENCE";
55
56 xmlfile << " output=\"" << m_outputTE->name() << "\"";
57
58 xmlfile << " input=\"";
59 bool first = true;
61 if(first) {first=false;} else {xmlfile << " ";}
62 xmlfile << te->name();
63 }
64 xmlfile << "\"";
65
66 xmlfile << " algorithm=\"";
67 first = true;
68 for(const string& alg: m_algorithms) {
69 if(first) {first=false;} else {xmlfile << " ";}
70 xmlfile << alg;
71 }
72 xmlfile << "\"";
73
74 if (m_topoStartTE) {
75 xmlfile << " topo_start_from=\"" << m_topoStartTE->name() << "\"";
76 }
77
78 xmlfile << "/> " << endl;
79 return;
80}
81
82std::string
84 std::stringstream str;
85 str << "(";
87 str << inputTE->name() << ",";
88 }
89 str << outputTE()->name() << ")";
90 return str.str();
91}
92
95 DiffStruct * ds = new DiffStruct("SEQUENCE", name());
96 ds->check("number_algs", (unsigned int)algorithms().size(), (unsigned int)o->algorithms().size() );
97 ds->check("number_inputs", (unsigned int)inputTEs().size(), (unsigned int)o->inputTEs().size() );
98 if(algorithms().size()==o->algorithms().size()) {
99 for(size_t i=0; i<algorithms().size(); ++i)
100 ds->check("alg_" + std::to_string(i), algorithms()[i], o->algorithms()[i] );
101 }
102 if(ds->empty()) {
103 delete ds; ds=0;
104 }
105 return ds;
106}
107
108
109void
110TrigConf::HLTSequence::print(const std::string& indent, unsigned int detail) const {
111 if(detail>=4) {
112 cout << indent << "HLTSequence "; printNameIdV();
113 }
114 if(detail>=5) {
115 cout << indent << " inputTEs : ";
116 bool first = true;
117 for(HLTTriggerElement* te: m_inputTEs) {
118 if(first) {first=false;} else {cout << ", ";}
119 cout << *te;
120 }
121 cout << endl;
122 if (m_topoStartTE) {
123 cout << indent << " topoStartTE " << *m_topoStartTE << endl;
124 }
125 cout << indent << " algorithms: ";
126 first = true;
127 uint width = 0;
128 for(const string& alg: m_algorithms) {
129 width += alg.size();
130 if(first) {first=false;} else {cout << ", "; width+=2; }
131 if(width>=140) {
132 cout << endl << indent << " ";
133 width=0;
134 }
135 cout << alg;
136 }
137 cout << endl;
138 cout << indent << " outputTE : " << outputTE()->name() << endl;
139 }
140}
141
142std::ostream &
143TrigConf::operator<<(std::ostream & o, const TrigConf::HLTSequence & s) {
144 o << "- -- HLTSequence printout ---------------------------------- " << std::endl;
145 o << "- -- inputTEs : ";
146 bool first = true;
147 for (TrigConf::HLTTriggerElement* inputTE : s.m_inputTEs) {
148 if (first)
149 first = false;
150 else
151 o << ", ";
152 o << *inputTE;
153 }
154
155 if (s.m_topoStartTE) {
156 o << "\n";
157 o << "- -- topoStartTE ";
158 o << *s.m_topoStartTE;
159 }
160 o << "\n- -- algorithms";
161 first = true;
162 for (const std::string& algorithm : s.m_algorithms) {
163 if (first)
164 first = false;
165 else
166 o << ", ";
167 o << algorithm;
168 }
169 o << "\n- -- outputTE : "; o << *s.outputTE();
170 o << "\n- ---------------------------------------------------------- " << std::endl;
171 return o;
172}
173
174
175string HLTSequence::__str__() const {
176 stringstream s;
177 s << *this;
178 return s.str();
179}
unsigned int uint
const double width
HLT sequence configuration information.
Definition HLTSequence.h:28
std::vector< HLTTriggerElement * > m_inputTEs
list of input trigger elements
Definition HLTSequence.h:91
void set_outputTE(HLTTriggerElement *outputTE)
unsigned int hashId() const
HLTSequence()
default constructor
DiffStruct * compareTo(const HLTSequence *o) const
std::vector< std::string > m_algorithms
list of algorithms
Definition HLTSequence.h:93
std::string concise() const
std::vector< HLTTriggerElement * > & inputTEs()
accessor to the list of input trigger elements
Definition HLTSequence.h:48
HLTTriggerElement * m_outputTE
list of output trigger elements (just 1)
Definition HLTSequence.h:92
std::string __str__() const
HLTTriggerElement * m_topoStartTE
only for topolical algorithms: specify output TE from previous topological Algo, for combinations
Definition HLTSequence.h:94
std::vector< std::string > & algorithms()
accessor to the list of algorithms
Definition HLTSequence.h:50
unsigned int m_level
level where sequence is running for a given configuration (to be determined in light of the menu,...
Definition HLTSequence.h:97
void print(const std::string &indent="", unsigned int detail=1) const
print method
HLTTriggerElement * outputTE()
accessor to the list of output trigger elements (just 1)
Definition HLTSequence.h:49
void writeXML(std::ofstream &xmlfile)
HLT trigger element configuration information.
std::ostream & indent(std::ostream &o, int lvl, int size) const
void setName(const std::string &name)
const std::string & name() const
void printNameIdV(const std::string &indent="") const
std::string algorithm
Definition hcg.cxx:85
static std::vector< std::string > xmlfile
Definition iLumiCalc.h:29
Forward iterator to traverse the main components of the trigger configuration.
Definition Config.h:22
std::ostream & operator<<(std::ostream &os, const TrigConf::IsolationLegacy &iso)
STL namespace.