ATLAS Offline Software
Loading...
Searching...
No Matches
CTPConfig.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
7
8#include <iostream>
9#include <fstream>
10
11using namespace std;
12using namespace TrigConf;
13
24
27
28
29
30void
31CTPConfig::setCTPVersion( unsigned int v ) {
32 m_ctpVersion = v;
34}
35
36void
37CTPConfig::setL1Version( unsigned int v ) {
38 m_l1Version = v;
40}
41
42void
44 for(int i=0; i<4; i++)
45 m_PrescaleSets[i].reset();
46}
47
48void
50 if(pss.partition()>3) {
51 cout << "Error: Partition " << pss.partition() << " of PrescaleSet " << pss.name() << " is larger than 3" << endl;
52 } else {
53 m_PrescaleSets[pss.partition()] = pss;
54 }
55}
56
57
58bool
59CTPConfig::equals(const CTPConfig* other, const std::string& filename) const {
60 bool equals = true;
61 DiffStruct* ds = compareTo(other);
62 if(ds) {
63 equals = false;
64 std::ofstream xmlfile;
65 xmlfile.open(filename.c_str());
66 // file will be empty if there are no differences
67 xmlfile << "<?xml version=\"1.0\" ?>" << std::endl;
68 ds->writeXML(xmlfile);
69 xmlfile.close();
70 delete ds;
71 }
72 return equals;
73}
74
77 DiffStruct * ds = new DiffStruct("LVL1Config");
78 ds->name = name();
79 ds->check("name", name(), o->name());
80
81 ds->addSub( menu().compareTo( & o->menu()) );
82 // ds->addSub( getHLTChainList().compareTo( & o->getHLTChainList()) );
83
84 if(ds->empty()) {
85 delete ds; ds=0;
86 }
87 return ds;
88}
89
90void
91CTPConfig::print(const std::string& indent, unsigned int detail) const {
92 if(detail>=1) {
93 cout << indent << "================================================================================" << endl;
94 cout << indent << "CTP Configuration";
95 if(smk()>0) cout << " (SMK = " << smk() << ")";
96 cout << ": "; printNameIdV(indent);
97 cout << indent << "CTP Version " << ctpVersion() << endl;
98 cout << indent << "L1 Version " << l1Version() << endl;
103 cout << indent << "================================================================================" << endl;
104 }
105}
106
107
108void
109CTPConfig::writeXML(const std::string & filename, int indentWidth) const {
110 std::ofstream xmlfile;
111 xmlfile.open( filename );
112 int indentLevel=1;
113 xmlfile << "<?xml version=\"1.0\"?>" << endl
114 << "<LVL1Config name=\"" << menu().name() << "\""
115 << " ctpVersion=\"" << ctpVersion() << "\""
116 << " l1Version=\"" << l1Version() << "\""
117 << ">" << endl
118 << " <!--File is generated by TrigConfReadWrite-->" << endl
119 << " <!--No. L1 thresholds defined: " << menu().thresholdConfig().size() << "-->" << endl
120 << " <!--No. L1 items defined: " << menu().size() << "-->" << endl;
121 writeXML(xmlfile,indentLevel,indentWidth);
122 xmlfile << "</LVL1Config>" << endl;
123 xmlfile.close();
124
125}
126
127
128void
129CTPConfig::writeXML(std::ostream & xmlfile, int indentLevel, int indentWidth) const {
130 menu().writeXMLItems(xmlfile, indentLevel, indentWidth);
131 for(const PrescaleSet& pss: m_PrescaleSets) {
132 if( ! pss.isNull()) {
133 pss.writeXML(xmlfile, indentLevel, indentWidth);
134 }
135 }
136 menu().writeXMLThresholds(xmlfile, indentLevel, indentWidth);
137 menu().writeXMLMonCounters(xmlfile, indentLevel, indentWidth);
138 random().writeXML(xmlfile, indentLevel, indentWidth);
139 bunchGroupSet().writeXML(xmlfile, indentLevel, indentWidth);
140 prescaledClock().writeXML(xmlfile, indentLevel, indentWidth);
141 menu().caloInfo().writeXML(xmlfile, indentLevel, indentWidth);
142 muCTPi().writeXML(xmlfile,indentLevel,indentWidth);
143}
144
virtual void print(const std::string &indent="", unsigned int detail=1) const override
void writeXML(std::ostream &xmlfile, int indentLevel=0, int indentWidth=2) const
const PrescaledClock & prescaledClock() const
Definition CTPConfig.h:42
unsigned int ctpVersion() const
Definition CTPConfig.h:34
virtual ~CTPConfig() override
Definition CTPConfig.cxx:25
const Random & random() const
Definition CTPConfig.h:44
unsigned int l1Version() const
Definition CTPConfig.h:35
void setPrescaleSet(const PrescaleSet &pss)
Definition CTPConfig.cxx:49
const BunchGroupSet & bunchGroupSet() const
Definition CTPConfig.h:41
virtual void print(const std::string &indent="", unsigned int detail=1) const override
Definition CTPConfig.cxx:91
unsigned int m_l1Version
Definition CTPConfig.h:106
PrescaleSet m_PrescaleSets[4]
Definition CTPConfig.h:110
const Menu & menu() const
Definition CTPConfig.h:39
const Muctpi & muCTPi() const
Definition CTPConfig.h:47
const PrescaleSet & prescaleSet(unsigned int partition=0) const
Definition CTPConfig.h:40
void writeXML(const std::string &filename, int indentWidth=2) const
void setL1Version(unsigned int v)
Definition CTPConfig.cxx:37
DiffStruct * compareTo(const CTPConfig *o) const
Definition CTPConfig.cxx:76
unsigned int m_ctpVersion
Definition CTPConfig.h:105
void setCTPVersion(unsigned int v)
Definition CTPConfig.cxx:31
bool equals(const CTPConfig *other, const std::string &filename) const
Definition CTPConfig.cxx:59
void writeXML(std::ostream &xmlfile, int indentLevel=0, int indentWidth=2) const
Definition CaloInfo.cxx:98
void writeXMLThresholds(std::ostream &xmlfile, int indentLevel=0, int indentWidth=2) const
Definition Menu.cxx:299
int size() const
Definition Menu.h:143
void writeXMLMonCounters(std::ostream &xmlfile, int indentLevel=0, int indentWidth=2) const
Definition Menu.cxx:313
virtual void print(const std::string &indent="", unsigned int detail=1) const override
Definition Menu.cxx:210
const CaloInfo & caloInfo() const
Definition Menu.h:74
const ThresholdConfig & thresholdConfig() const
Definition Menu.h:73
void writeXMLItems(std::ostream &xmlfile, int indentLevel=0, int indentWidth=2) const
Definition Menu.cxx:288
virtual void writeXML(std::ostream &xmlfile, int indentLevel=0, int indentWidth=2) const
Definition Muctpi.cxx:28
virtual void print(const std::string &indent="", unsigned int detail=1) const override
unsigned int partition() const
Definition PrescaleSet.h:40
virtual void writeXML(std::ostream &xmlfile, int indentLevel=0, int indentWidth=2) const
virtual void print(const std::string &indent="", unsigned int detail=1) const override
Definition Random.cxx:28
virtual void writeXML(std::ostream &xmlfile, int indentLevel=0, int indentWidth=2) const
Definition Random.cxx:49
std::ostream & indent(std::ostream &o, int lvl, int size) const
const std::string & name() const
void printNameIdV(const std::string &indent="") const
unsigned int smk() const
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
STL namespace.