ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigConfiguration
TrigConfL1Data
Root
DiffStruct.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
TrigConfL1Data/DiffStruct.h
"
6
7
#include <string>
8
9
#include <iostream>
10
#include <fstream>
11
12
using namespace
std
;
13
14
TrigConf::DiffStruct::DiffStruct
(
const
std::string&
tagname
,
const
std::string&
name
) :
15
tagname
(
tagname
),
16
name
(
name
)
17
{}
18
19
TrigConf::DiffStruct::~DiffStruct
() {
20
for
(
DiffStruct
* d :
subs
)
21
delete
d;
22
}
23
24
25
void
26
TrigConf::DiffStruct::check
(
const
std::string& attname,
const
std::string& lval,
const
std::string& rval) {
27
if
(lval!=rval)
attdiffs
.push_back(
AttDiff
(attname, lval, rval));
28
}
29
30
void
31
TrigConf::DiffStruct::check
(
const
std::string& attname,
int
lval,
int
rval) {
32
if
(lval!=rval)
33
attdiffs
.push_back(
AttDiff
(attname, std::to_string(lval), std::to_string(rval) ));
34
}
35
36
void
37
TrigConf::DiffStruct::check
(
const
std::string& attname,
unsigned
int
lval,
unsigned
int
rval) {
38
if
(lval!=rval)
39
attdiffs
.push_back(
AttDiff
(attname, std::to_string(lval), std::to_string(rval) ));
40
}
41
42
void
43
TrigConf::DiffStruct::check
(
const
std::string& attname,
float
lval,
float
rval) {
44
if
(lval!=rval)
45
attdiffs
.push_back(
AttDiff
(attname, std::to_string(lval), std::to_string(rval) ));
46
}
47
48
void
49
TrigConf::DiffStruct::check
(
const
std::string& attname,
bool
lval,
bool
rval) {
50
if
(lval!=rval)
51
attdiffs
.push_back(
AttDiff
(attname, std::to_string(lval), std::to_string(rval) ));
52
}
53
54
void
55
TrigConf::DiffStruct::addSub
(
DiffStruct
* sub) {
56
if
(sub)
subs
.push_back(sub);
57
}
58
59
void
60
TrigConf::DiffStruct::addRightOnlySub
(
const
string
&
tagname
,
const
string
&
name
) {
61
rightonly
.insert( std::pair<string,string>(
tagname
,
name
) );
62
}
63
64
void
65
TrigConf::DiffStruct::addLeftOnlySub
(
const
string
&
tagname
,
const
string
&
name
) {
66
leftonly
.insert( std::pair<string,string>(
tagname
,
name
) );
67
}
68
69
bool
70
TrigConf::DiffStruct::empty
()
const
{
71
return
attdiffs
.size()==0 &&
subs
.size()==0;
72
}
73
74
75
void
76
TrigConf::DiffStruct::writeXML
(ofstream &
xmlfile
,
const
std::string& prefix)
const
{
77
if
(
empty
())
return
;
78
xmlfile
<< prefix <<
"<"
<<
tagname
;
79
if
(
name
!=
""
)
80
xmlfile
<<
" name=\""
<<
name
<<
"\""
;
81
for
(
const
AttDiff
& d :
attdiffs
)
82
xmlfile
<<
" "
<< d.attname <<
"_l=\""
<< d.lval <<
"\" "
<< d.attname <<
"_r=\""
<< d.rval <<
"\""
;
83
if
(
subs
.size()==0 &&
rightonly
.size()==0 &&
leftonly
.size()==0) {
84
xmlfile
<<
"/>"
<< endl;
85
}
else
{
86
xmlfile
<<
">"
<< endl;
87
for
(
DiffStruct
*d :
subs
)
88
d->writeXML(
xmlfile
, prefix+
" "
);
89
if
(
leftonly
.size()>0) {
90
xmlfile
<< prefix <<
" <LEFT_ONLY>"
<< endl;
91
for
(OnlyMap_t::value_type tag_name :
leftonly
)
92
xmlfile
<< prefix <<
" <"
<< tag_name.first <<
" name=\""
<< tag_name.second <<
"\"/>"
<< endl;
93
xmlfile
<< prefix <<
" </LEFT_ONLY>"
<< endl;
94
}
95
if
(
rightonly
.size()>0) {
96
xmlfile
<< prefix <<
" <RIGHT_ONLY>"
<< endl;
97
for
(OnlyMap_t::value_type tag_name :
rightonly
)
98
xmlfile
<< prefix <<
" <"
<< tag_name.first <<
" name=\""
<< tag_name.second <<
"\"/>"
<< endl;
99
xmlfile
<< prefix <<
" </RIGHT_ONLY>"
<< endl;
100
}
101
xmlfile
<< prefix <<
"</"
<<
tagname
<<
">"
<< endl;
102
}
103
}
DiffStruct.h
empty
static const Attributes_t empty
Definition
XmlStreamer.cxx:16
TrigConf::DiffStruct::name
std::string name
Definition
DiffStruct.h:40
TrigConf::DiffStruct::tagname
std::string tagname
Definition
DiffStruct.h:39
TrigConf::DiffStruct::check
void check(const std::string &attname, const std::string &lval, const std::string &rval)
Definition
DiffStruct.cxx:26
TrigConf::DiffStruct::~DiffStruct
~DiffStruct()
Definition
DiffStruct.cxx:19
TrigConf::DiffStruct::attdiffs
std::vector< AttDiff > attdiffs
Definition
DiffStruct.h:41
TrigConf::DiffStruct::rightonly
OnlyMap_t rightonly
Definition
DiffStruct.h:44
TrigConf::DiffStruct::empty
bool empty() const
Definition
DiffStruct.cxx:70
TrigConf::DiffStruct::addLeftOnlySub
void addLeftOnlySub(const std::string &tagname, const std::string &name)
Definition
DiffStruct.cxx:65
TrigConf::DiffStruct::writeXML
void writeXML(std::ofstream &xmlfile, const std::string &prefix="") const
Definition
DiffStruct.cxx:76
TrigConf::DiffStruct::leftonly
OnlyMap_t leftonly
Definition
DiffStruct.h:45
TrigConf::DiffStruct::addRightOnlySub
void addRightOnlySub(const std::string &tagname, const std::string &name)
Definition
DiffStruct.cxx:60
TrigConf::DiffStruct::DiffStruct
DiffStruct(const std::string &tagname, const std::string &name="")
Definition
DiffStruct.cxx:14
TrigConf::DiffStruct::addSub
void addSub(DiffStruct *sub)
Definition
DiffStruct.cxx:55
TrigConf::DiffStruct::subs
std::vector< DiffStruct * > subs
Definition
DiffStruct.h:42
xmlfile
static std::vector< std::string > xmlfile
Definition
iLumiCalc.h:29
std
STL namespace.
TrigConf::DiffStruct::AttDiff
Definition
DiffStruct.h:33
Generated on
for ATLAS Offline Software by
1.17.0