ATLAS Offline Software
Loading...
Searching...
No Matches
HLTFrame.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
6
13
14#include <map>
15#include <vector>
16#include <string>
17#include <iostream>
18#include <fstream>
19#include <sstream>
20
21using namespace std;
22using namespace TrigConf;
23
24
25// constructor
29
30
31void
33 m_HLTChainList.clear();
34 m_HLTSequenceList.clear();
35 m_hltPrescaleSets.clear();
36
37 setId(0);
38 setName("");
39 setVersion(0);
40}
41
42bool
43HLTFrame::equals(const HLTFrame* other, const std::string& filename) const {
44 bool equals = true;
45 DiffStruct* ds = compareTo(other);
46 if(ds) {
47 equals = false;
48 std::ofstream xmlfile;
49 xmlfile.open(filename.c_str());
50 // file will be empty if there are no differences
51 xmlfile << "<?xml version=\"1.0\" ?>" << std::endl;
52 ds->writeXML(xmlfile);
53 xmlfile.close();
54 delete ds;
55 }
56 return equals;
57}
58
59
62 DiffStruct * ds = new DiffStruct("HLT_MENU");
63 ds->name = name();
64 ds->check("menu_name", name(), o->name());
65 std::string pss_name(""), o_pss_name("");
66
67 const auto& pssc = getPrescaleSetCollection();
68 const auto& o_pssc = o->getPrescaleSetCollection();
69 if(pssc.size()==1)
70 pss_name= pssc.sets().front().pss->name();
71 if(o_pssc.size()==1)
72 o_pss_name= o_pssc.sets().front().pss->name();
73 ds->check("prescale_set_name", pss_name, o_pss_name);
74
75 ds->addSub( getHLTSequenceList().compareTo( & o->getHLTSequenceList()) );
76 ds->addSub( getHLTChainList().compareTo( & o->getHLTChainList()) );
77
78 if(ds->empty()) {
79 delete ds; ds=0;
80 }
81 return ds;
82}
83
84
85void
86HLTFrame::print(const std::string& indent, unsigned int detail) const {
87 if(detail>=1) {
88 cout << indent << "================================================================================" << endl;
89 cout << indent << "HLT Configuration";
90 if(smk()>0) cout << " (SMK = " << smk() << ")";
91 cout << ": "; printNameIdV(indent);
95 cout << indent << "================================================================================" << endl;
96 }
97}
98
99void
100HLTFrame::writeXML(const string & filename) const {
101 std::ofstream xmlfile;
102 xmlfile.open(filename.c_str());
103 xmlfile << "<?xml version=\"1.0\" ?>" << std::endl;
105 xmlfile.close();
106}
107
108
109void
110HLTFrame::writeXML(std::ofstream & xmlfile) const {
111
112 string pss_name("");
113 if(m_hltPrescaleSets.size()>1) {
114 pss_name = "multiple";
115 } else if(m_hltPrescaleSets.size()==0) {
116 pss_name = "none";
117 } else if(m_hltPrescaleSets.prescaleSet(0)==0) {
118 pss_name = "not loaded";
119 } else {
120 pss_name = m_hltPrescaleSets.prescaleSet(0)->name();
121 }
122
123 xmlfile << "<HLT_MENU menu_name=\"" << name() << "\" prescale_set_name=\"" << pss_name << "\">" << endl
124 << " <SEQUENCE_LIST>" << endl;
125
127 seq->writeXML(xmlfile);
128
129 xmlfile << " </SEQUENCE_LIST>" << endl
130 << " <CHAIN_LIST>" << endl;
131
132 for(HLTChain *ch: getHLTChainList())
133 ch->writeXML(xmlfile);
134
135 xmlfile << " </CHAIN_LIST>" << endl
136 << "</HLT_MENU>" << endl;
137}
138
139
140std::ostream &
141TrigConf::operator<<(std::ostream & o, const TrigConf::HLTFrame & f) {
142 o << "HLTFrame print: " << std::endl
143 << "Running " << (f.mergedHLT() ? "":" not ") << "merged HLT" << std::endl
144 << f.getHLTChainList()
145 << f.getHLTSequenceList();
146 return o;
147}
void print(const std::string &indent="", unsigned int detail=1) const
accessors to list of chains, for backward compatibility, use HLTChainList directly
HLT chain configuration information.
The HLT trigger menu,.
Definition HLTFrame.h:33
DiffStruct * compareTo(const HLTFrame *o) const
Definition HLTFrame.cxx:61
HLTFrame()
default constructor
Definition HLTFrame.cxx:26
HLTPrescaleSetCollection m_hltPrescaleSets
the hlt prescale set (owned)
Definition HLTFrame.h:75
HLTSequenceList m_HLTSequenceList
list of HLT trigger sequences (owned)
Definition HLTFrame.h:74
const HLTSequenceList & getHLTSequenceList() const
const accessor to the list of HLT sequences
Definition HLTFrame.h:50
void writeXML(const std::string &filename) const
Definition HLTFrame.cxx:100
const HLTPrescaleSetCollection & getPrescaleSetCollection() const
Definition HLTFrame.h:51
void print(const std::string &indent="", unsigned int detail=1) const override
print method
Definition HLTFrame.cxx:86
void clear()
clear chains, sequences and prescales
Definition HLTFrame.cxx:32
bool equals(const HLTFrame *other, const std::string &filename) const
Definition HLTFrame.cxx:43
HLTChainList m_HLTChainList
list of HLT trigger chains (owned)
Definition HLTFrame.h:73
const HLTChainList & getHLTChainList() const
const accessor to the list of HLT chains
Definition HLTFrame.h:49
void print(const std::string &indent="", unsigned int detail=1) const
Print the prescale set.
void print(const std::string &indent="", unsigned int detail=1) const
print the sequence list
HLT sequence configuration information.
Definition HLTSequence.h:28
void setId(unsigned int id)
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
TrigConfData(const std::string &name="")
unsigned int smk() const
void setVersion(unsigned int version)
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.