ATLAS Offline Software
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 
21 using namespace std;
22 using namespace TrigConf;
23 
24 
25 // constructor
26 HLTFrame::HLTFrame() :
27  TrigConfData()
28 {}
29 
30 
31 void
36 
37  setId(0);
38  setName("");
39  setVersion(0);
40 }
41 
42 bool
43 HLTFrame::equals(const HLTFrame* other, const std::string& filename) const {
44  bool equals = true;
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 
61 HLTFrame::compareTo(const HLTFrame* o) const {
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 
85 void
86 HLTFrame::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 
99 void
100 HLTFrame::writeXML(const string & filename) const {
101  std::ofstream xmlfile;
102  xmlfile.open(filename.c_str());
103  xmlfile << "<?xml version=\"1.0\" ?>" << std::endl;
104  writeXML(xmlfile);
105  xmlfile.close();
106 }
107 
108 
109 void
110 HLTFrame::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 
140 std::ostream &
141 TrigConf::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 }
test_athena_ntuple_filter.seq
seq
filter configuration ## -> we use the special sequence 'AthMasterSeq' which is run before any other a...
Definition: test_athena_ntuple_filter.py:18
TrigConf::TrigConfData::setName
void setName(const std::string &name)
Definition: TrigConfData.h:30
TrigConf::HLTFrame::m_HLTSequenceList
HLTSequenceList m_HLTSequenceList
list of HLT trigger sequences (owned)
Definition: HLTFrame.h:74
python.CaloRecoConfig.f
f
Definition: CaloRecoConfig.py:127
checkxAOD.ds
ds
Definition: Tools/PyUtils/bin/checkxAOD.py:257
sendEI_SPB.ch
ch
Definition: sendEI_SPB.py:35
TrigConf::operator<<
std::ostream & operator<<(std::ostream &os, const TrigConf::IsolationLegacy &iso)
Definition: L1ThresholdBase.cxx:339
TrigConf::TrigConfData::name
const std::string & name() const
Definition: TrigConfData.h:22
HLTChainList.h
TrigConf::HLTPrescaleSetCollection::size
size_t size() const
number of prescale sets
Definition: HLTPrescaleSetCollection.h:50
TrigConf::HLTFrame::clear
void clear()
clear chains, sequences and prescales
Definition: HLTFrame.cxx:32
HLTChain.h
TrigConf::DiffStruct
Definition: DiffStruct.h:14
detail
Definition: extract_histogram_tag.cxx:14
DiffStruct.h
TrigConf::HLTFrame::m_hltPrescaleSets
HLTPrescaleSetCollection m_hltPrescaleSets
the hlt prescale set (owned)
Definition: HLTFrame.h:75
TrigConf::HLTChain
HLT chain configuration information.
Definition: TrigConfHLTData/TrigConfHLTData/HLTChain.h:35
TrigConf::HLTFrame::getHLTSequenceList
const HLTSequenceList & getHLTSequenceList() const
const accessor to the list of HLT sequences
Definition: HLTFrame.h:50
TrigConf::HLTFrame::compareTo
DiffStruct * compareTo(const HLTFrame *o) const
Definition: HLTFrame.cxx:61
TrigConf::HLTPrescaleSetCollection::clear
void clear()
Deletes all prescale sets.
Definition: HLTPrescaleSetCollection.cxx:39
TrigConf::HLTSequenceList::print
void print(const std::string &indent="", unsigned int detail=1) const
print the sequence list
Definition: HLTSequenceList.cxx:112
TrigConf
Forward iterator to traverse the main components of the trigger configuration.
Definition: Config.h:22
TrigConf::HLTChainList::print
void print(const std::string &indent="", unsigned int detail=1) const
accessors to list of chains, for backward compatibility, use HLTChainList directly
Definition: HLTChainList.cxx:177
geometry_dat_to_json.indent
indent
Definition: geometry_dat_to_json.py:18
TrigConf::HLTPrescaleSetCollection::sets
std::list< cont > & sets()
Definition: HLTPrescaleSetCollection.h:67
TrigConf::HLTSequenceList::clear
void clear()
Definition: HLTSequenceList.cxx:25
TrigConf::HLTFrame::print
void print(const std::string &indent="", unsigned int detail=1) const override
print method
Definition: HLTFrame.cxx:86
TrigConf::HLTPrescaleSetCollection::prescaleSet
const HLTPrescaleSet * prescaleSet(unsigned int lumiblock) const
Definition: HLTPrescaleSetCollection.cxx:49
TrigConf::TrigConfData
Definition: TrigConfData.h:13
TrigConf::TrigConfData::setId
void setId(unsigned int id)
Definition: TrigConfData.h:29
TrigConf::TrigConfData::smk
unsigned int smk() const
Definition: TrigConfData.h:20
TrigConf::HLTChainList::clear
void clear()
Definition: HLTChainList.cxx:34
equals
Definition: RegSelectorHashMap.h:32
TrigConf::HLTPrescaleSetCollection::print
void print(const std::string &indent="", unsigned int detail=1) const
Print the prescale set.
Definition: HLTPrescaleSetCollection.cxx:162
HLTFrame.h
TrigConf::HLTFrame::m_HLTChainList
HLTChainList m_HLTChainList
list of HLT trigger chains (owned)
Definition: HLTFrame.h:73
HLTSequence.h
HLTPrescaleSet.h
TrigConf::HLTFrame
The HLT trigger menu,.
Definition: HLTFrame.h:33
TrigConf::HLTFrame::equals
bool equals(const HLTFrame *other, const std::string &filename) const
Definition: HLTFrame.cxx:43
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
TrigConf::HLTFrame::writeXML
void writeXML(const std::string &filename) const
Definition: HLTFrame.cxx:100
HLTSequenceList.h
TrigConf::HLTFrame::getHLTChainList
const HLTChainList & getHLTChainList() const
const accessor to the list of HLT chains
Definition: HLTFrame.h:49
TrigConf::TrigConfData::setVersion
void setVersion(unsigned int version)
Definition: TrigConfData.h:31
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:24
TrigConf::TrigConfData::indent
std::ostream & indent(std::ostream &o, int lvl, int size) const
Definition: TrigConfData.cxx:23
TrigConf::HLTFrame::getPrescaleSetCollection
const HLTPrescaleSetCollection & getPrescaleSetCollection() const
Definition: HLTFrame.h:51
TrigConf::TrigConfData::printNameIdV
void printNameIdV(const std::string &indent="") const
Definition: TrigConfData.cxx:31
TrigConf::HLTSequence
HLT sequence configuration information.
Definition: HLTSequence.h:28