ATLAS Offline Software
CTPConfig.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 
8 #include <iostream>
9 #include <fstream>
10 
11 using namespace std;
12 using namespace TrigConf;
13 
14 CTPConfig::CTPConfig() : L1DataBaseclass(),
15  m_ctpVersion( 0 ),
16  m_l1Version( 0 ),
17  m_PrescaleSetId( 0 ),
18  m_BunchGroupSetId( 0 ),
19  m_LoadCtpFiles( true ),
20  m_LoadCtpcoreFiles( true ),
21  m_LoadCtpinFiles( true ),
22  m_LoadCtpmonFiles( true ),
23  m_CTPFiles( nullptr )
24 {}
25 
27  delete m_CTPFiles;
28 }
29 
30 
31 
32 void
33 CTPConfig::setCTPVersion( unsigned int v ) {
34  m_ctpVersion = v;
36 }
37 
38 void
39 CTPConfig::setL1Version( unsigned int v ) {
40  m_l1Version = v;
42 }
43 
44 void
46  for(int i=0; i<4; i++)
48 }
49 
50 void
52  if(pss.partition()>3) {
53  cout << "Error: Partition " << pss.partition() << " of PrescaleSet " << pss.name() << " is larger than 3" << endl;
54  } else {
55  m_PrescaleSets[pss.partition()] = pss;
56  }
57 }
58 
59 
60 bool
61 CTPConfig::equals(const CTPConfig* other, const std::string& filename) const {
62  bool equals = true;
64  if(ds) {
65  equals = false;
66  std::ofstream xmlfile;
67  xmlfile.open(filename.c_str());
68  // file will be empty if there are no differences
69  xmlfile << "<?xml version=\"1.0\" ?>" << std::endl;
70  ds->writeXML(xmlfile);
71  xmlfile.close();
72  delete ds;
73  }
74  return equals;
75 }
76 
79  DiffStruct * ds = new DiffStruct("LVL1Config");
80  ds->name = name();
81  ds->check("name", name(), o->name());
82 
83  ds->addSub( menu().compareTo( & o->menu()) );
84  // ds->addSub( getHLTChainList().compareTo( & o->getHLTChainList()) );
85 
86  if(ds->empty()) {
87  delete ds; ds=0;
88  }
89  return ds;
90 }
91 
92 void
93 CTPConfig::print(const std::string& indent, unsigned int detail) const {
94  if(detail>=1) {
95  cout << indent << "================================================================================" << endl;
96  cout << indent << "CTP Configuration";
97  if(smk()>0) cout << " (SMK = " << smk() << ")";
98  cout << ": "; printNameIdV(indent);
99  cout << indent << "CTP Version " << ctpVersion() << endl;
100  cout << indent << "L1 Version " << l1Version() << endl;
101  menu().print(indent, detail);
105  cout << indent << "================================================================================" << endl;
106  }
107 }
108 
109 
110 void
111 CTPConfig::writeXML(const std::string & filename, int indentWidth) const {
112  std::ofstream xmlfile;
113  xmlfile.open( filename );
114  int indentLevel=1;
115  xmlfile << "<?xml version=\"1.0\"?>" << endl
116  << "<LVL1Config name=\"" << menu().name() << "\""
117  << " ctpVersion=\"" << ctpVersion() << "\""
118  << " l1Version=\"" << l1Version() << "\""
119  << ">" << endl
120  << " <!--File is generated by TrigConfReadWrite-->" << endl
121  << " <!--No. L1 thresholds defined: " << menu().thresholdConfig().size() << "-->" << endl
122  << " <!--No. L1 items defined: " << menu().size() << "-->" << endl;
123  writeXML(xmlfile,indentLevel,indentWidth);
124  xmlfile << "</LVL1Config>" << endl;
125  xmlfile.close();
126 
127 }
128 
129 
130 void
131 CTPConfig::writeXML(std::ostream & xmlfile, int indentLevel, int indentWidth) const {
132  menu().writeXMLItems(xmlfile, indentLevel, indentWidth);
133  for(const PrescaleSet& pss: m_PrescaleSets) {
134  if( ! pss.isNull()) {
135  pss.writeXML(xmlfile, indentLevel, indentWidth);
136  }
137  }
138  menu().writeXMLThresholds(xmlfile, indentLevel, indentWidth);
139  menu().writeXMLMonCounters(xmlfile, indentLevel, indentWidth);
140  random().writeXML(xmlfile, indentLevel, indentWidth);
141  bunchGroupSet().writeXML(xmlfile, indentLevel, indentWidth);
142  prescaledClock().writeXML(xmlfile, indentLevel, indentWidth);
143  menu().caloInfo().writeXML(xmlfile, indentLevel, indentWidth);
144  muCTPi().writeXML(xmlfile,indentLevel,indentWidth);
145 }
146 
TrigConf::CaloInfo::writeXML
void writeXML(std::ostream &xmlfile, int indentLevel=0, int indentWidth=2) const
Definition: CaloInfo.cxx:98
CTPConfig.h
checkxAOD.ds
ds
Definition: Tools/PyUtils/bin/checkxAOD.py:257
TrigConf::PrescaleSet::partition
unsigned int partition() const
Definition: PrescaleSet.h:40
TrigConf::TrigConfData::name
const std::string & name() const
Definition: TrigConfData.h:22
TrigConf::ThresholdConfig::m_l1Version
unsigned int m_l1Version
Definition: ThresholdConfig.h:99
TrigConf::PrescaleSet
Definition: PrescaleSet.h:22
TrigConf::Menu::caloInfo
const CaloInfo & caloInfo() const
Definition: Menu.h:74
TrigConf::PrescaleSet::print
virtual void print(const std::string &indent="", unsigned int detail=1) const override
Definition: PrescaleSet.cxx:197
TrigConf::Menu::print
virtual void print(const std::string &indent="", unsigned int detail=1) const override
Definition: Menu.cxx:211
TrigConf::CTPConfig::ctpVersion
unsigned int ctpVersion() const
Definition: CTPConfig.h:33
TrigConf::DiffStruct
Definition: DiffStruct.h:14
TrigConf::Menu::writeXMLThresholds
void writeXMLThresholds(std::ostream &xmlfile, int indentLevel=0, int indentWidth=2) const
Definition: Menu.cxx:301
TrigConf::CTPConfig::bunchGroupSet
const BunchGroupSet & bunchGroupSet() const
Definition: CTPConfig.h:40
TrigConf::CTPConfig::m_ctpVersion
unsigned int m_ctpVersion
Definition: CTPConfig.h:104
detail
Definition: extract_histogram_tag.cxx:14
TrigConf::Muctpi::writeXML
virtual void writeXML(std::ostream &xmlfile, int indentLevel=0, int indentWidth=2) const
Definition: Muctpi.cxx:28
DiffStruct.h
TrigConf::CTPConfig::m_CTPFiles
CTPFiles * m_CTPFiles
Definition: CTPConfig.h:121
TrigConf::ThresholdConfig::size
size_t size() const
Definition: ThresholdConfig.h:44
TrigConf::CTPConfig::random
const Random & random() const
Definition: CTPConfig.h:43
TrigConf
Forward iterator to traverse the main components of the trigger configuration.
Definition: Config.h:22
TrigConf::CTPConfig::equals
bool equals(const CTPConfig *other, const std::string &filename) const
Definition: CTPConfig.cxx:61
TrigConf::CTPConfig::prescaledClock
const PrescaledClock & prescaledClock() const
Definition: CTPConfig.h:41
TrigConf::CTPConfig::l1Version
unsigned int l1Version() const
Definition: CTPConfig.h:34
geometry_dat_to_json.indent
indent
Definition: geometry_dat_to_json.py:18
lumiFormat.i
int i
Definition: lumiFormat.py:92
TrigConf::CTPConfig::compareTo
DiffStruct * compareTo(const CTPConfig *o) const
Definition: CTPConfig.cxx:78
TrigConf::CTPConfig::m_l1Version
unsigned int m_l1Version
Definition: CTPConfig.h:105
TrigConf::Menu::thresholdConfig
const ThresholdConfig & thresholdConfig() const
Definition: Menu.h:73
TrigConf::CTPConfig::clearPrescaleSets
void clearPrescaleSets()
Definition: CTPConfig.cxx:45
TrigConf::CTPConfig::m_PrescaleSets
PrescaleSet m_PrescaleSets[4]
Definition: CTPConfig.h:109
TrigConf::ThresholdConfig::m_ctpVersion
unsigned int m_ctpVersion
Definition: ThresholdConfig.h:98
TrigConf::CTPConfig::prescaleSet
const PrescaleSet & prescaleSet(unsigned int partition=0) const
Definition: CTPConfig.h:39
TrigConf::Random::print
virtual void print(const std::string &indent="", unsigned int detail=1) const override
Definition: Random.cxx:28
TrigConf::TrigConfData::smk
unsigned int smk() const
Definition: TrigConfData.h:20
equals
Definition: RegSelectorHashMap.h:32
TrigConf::BunchGroupSet::print
virtual void print(const std::string &indent="", unsigned int detail=1) const override
Definition: BunchGroupSet.cxx:50
python.PyAthena.v
v
Definition: PyAthena.py:157
TrigConf::CTPConfig::setCTPVersion
void setCTPVersion(unsigned int v)
Definition: CTPConfig.cxx:33
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
TrigConf::CTPConfig::menu
const Menu & menu() const
Definition: CTPConfig.h:38
TrigConf::CTPConfig::setL1Version
void setL1Version(unsigned int v)
Definition: CTPConfig.cxx:39
TrigConf::CTPConfig::writeXML
void writeXML(const std::string &filename, int indentWidth=2) const
Definition: CTPConfig.cxx:111
CxxUtils::reset
constexpr std::enable_if_t< is_bitmask_v< E >, E & > reset(E &lhs, E rhs)
Convenience function to clear bits in a class enum bitmask.
Definition: bitmask.h:243
TrigConf::BunchGroupSet::writeXML
void writeXML(std::ostream &xmlfile, int indentLevel=0, int indentWidth=2) const
Definition: BunchGroupSet.cxx:65
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:24
TrigConf::CTPConfig
Definition: CTPConfig.h:27
TrigConf::TrigConfData::indent
std::ostream & indent(std::ostream &o, int lvl, int size) const
Definition: TrigConfData.cxx:23
TrigConf::Menu::writeXMLMonCounters
void writeXMLMonCounters(std::ostream &xmlfile, int indentLevel=0, int indentWidth=2) const
Definition: Menu.cxx:315
TrigConf::L1DataBaseclass
Definition: L1DataBaseclass.h:22
TrigConf::Random::writeXML
virtual void writeXML(std::ostream &xmlfile, int indentLevel=0, int indentWidth=2) const
Definition: Random.cxx:49
TrigConf::PrescaledClock::writeXML
virtual void writeXML(std::ostream &xmlfile, int indentLevel=0, int indentWidth=2) const
Definition: PrescaledClock.cxx:26
TrigConf::CTPConfig::print
virtual void print(const std::string &indent="", unsigned int detail=1) const override
Definition: CTPConfig.cxx:93
TrigConf::Menu::writeXMLItems
void writeXMLItems(std::ostream &xmlfile, int indentLevel=0, int indentWidth=2) const
Definition: Menu.cxx:289
TrigConf::Menu::size
int size() const
Definition: Menu.h:143
TrigConf::TrigConfData::printNameIdV
void printNameIdV(const std::string &indent="") const
Definition: TrigConfData.cxx:31
TrigConf::CTPConfig::muCTPi
const Muctpi & muCTPi() const
Definition: CTPConfig.h:46
TrigConf::CTPConfig::setPrescaleSet
void setPrescaleSet(const PrescaleSet &pss)
Definition: CTPConfig.cxx:51
TrigConf::CTPConfig::~CTPConfig
virtual ~CTPConfig() override
Definition: CTPConfig.cxx:26