ATLAS Offline Software
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 
13 using namespace std;
14 using namespace TrigConf;
15 
17  m_outputTE ( 0 ),
18  m_topoStartTE ( 0 ),
19  m_level( 0 )
20 {}
21 
22 TrigConf::HLTSequence::HLTSequence( const vector<HLTTriggerElement*>& inputTEs,
23  HLTTriggerElement* outputTE,
24  const vector<string>& algorithms) :
25  m_inputTEs ( inputTEs ),
26  m_outputTE ( outputTE ),
27  m_algorithms( algorithms )
28 {
29  setName(outputTE->name());
30 }
31 
33 {
34  for(HLTTriggerElement* te : m_inputTEs)
35  delete te;
36  delete m_outputTE;
37  delete m_topoStartTE;
38 }
39 
40 void
42  m_outputTE = outputTE;
43  setName(outputTE->name());
44 }
45 
46 unsigned int
48  return m_outputTE->hashId();
49 }
50 
51 
52 void TrigConf::HLTSequence::writeXML(std::ofstream & xmlfile) {
53 
54  xmlfile << " <SEQUENCE";
55 
56  xmlfile << " output=\"" << m_outputTE->name() << "\"";
57 
58  xmlfile << " input=\"";
59  bool first = true;
60  for(HLTTriggerElement* te: m_inputTEs) {
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 
82 std::string
84  std::stringstream str;
85  str << "(";
86  for (TrigConf::HLTTriggerElement* inputTE : m_inputTEs) {
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 
109 void
110 TrigConf::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 
142 std::ostream &
143 TrigConf::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 
175 string HLTSequence::__str__() const {
176  stringstream s;
177  s << *this;
178  return s.str();
179 }
TrigConf::TrigConfData::setName
void setName(const std::string &name)
Definition: TrigConfData.h:30
TrigConf::HLTSequence::concise
std::string concise() const
Definition: HLTSequence.cxx:83
checkxAOD.ds
ds
Definition: Tools/PyUtils/bin/checkxAOD.py:260
TrigConf::HLTSequence::inputTEs
std::vector< HLTTriggerElement * > & inputTEs()
accessor to the list of input trigger elements
Definition: HLTSequence.h:48
TrigConf::operator<<
std::ostream & operator<<(std::ostream &os, const TrigConf::IsolationLegacy &iso)
Definition: L1ThresholdBase.cxx:339
TrigConf::HLTSequence::hashId
unsigned int hashId() const
Definition: HLTSequence.cxx:47
TrigConf::TrigConfData::name
const std::string & name() const
Definition: TrigConfData.h:22
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
algorithm
std::string algorithm
Definition: hcg.cxx:82
TrigConf::HLTSequence::set_outputTE
void set_outputTE(HLTTriggerElement *outputTE)
Definition: HLTSequence.cxx:41
SGout2dot.alg
alg
Definition: SGout2dot.py:243
TrigConf::HLTSequence::algorithms
std::vector< std::string > & algorithms()
accessor to the list of algorithms
Definition: HLTSequence.h:50
TrigConf::DiffStruct
Definition: DiffStruct.h:14
detail
Definition: extract_histogram_tag.cxx:14
DiffStruct.h
TrigConf::HLTSequence::HLTSequence
HLTSequence()
default constructor
Definition: HLTSequence.cxx:16
TrigConf::HLTSequence::writeXML
void writeXML(std::ofstream &xmlfile)
Definition: HLTSequence.cxx:52
TrigConf
Forward iterator to traverse the main components of the trigger configuration.
Definition: Config.h:22
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
uint
unsigned int uint
Definition: LArOFPhaseFill.cxx:20
geometry_dat_to_json.indent
indent
Definition: geometry_dat_to_json.py:36
lumiFormat.i
int i
Definition: lumiFormat.py:85
TrigConf::HLTSequence::print
void print(const std::string &indent="", unsigned int detail=1) const
print method
Definition: HLTSequence.cxx:110
TrigConf::HLTSequence::outputTE
HLTTriggerElement * outputTE()
accessor to the list of output trigger elements (just 1)
Definition: HLTSequence.h:49
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
TrigConf::HLTSequence::~HLTSequence
~HLTSequence()
destructor
Definition: HLTSequence.cxx:32
TrigConf::HLTTriggerElement
HLT trigger element configuration information.
Definition: HLTTriggerElement.h:26
HLTTriggerElement.h
HLTSequence.h
Base_Fragment.width
width
Definition: Sherpa_i/share/common/Base_Fragment.py:59
python.CaloScaleNoiseConfig.str
str
Definition: CaloScaleNoiseConfig.py:78
DeMoScan.first
bool first
Definition: DeMoScan.py:536
TrigConf::HLTSequence::__str__
std::string __str__() const
Definition: HLTSequence.cxx:175
str
Definition: BTagTrackIpAccessor.cxx:11
TrigConf::HLTSequence::compareTo
DiffStruct * compareTo(const HLTSequence *o) const
Definition: HLTSequence.cxx:94
TrigConf::HLTSequence
HLT sequence configuration information.
Definition: HLTSequence.h:28