ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigConfiguration
TrigConfL1Data
Root
TriggerItem.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
TrigConfL1Data/DiffStruct.h
"
6
#include "
TrigConfL1Data/HelperFunctions.h
"
7
#include "
TrigConfL1Data/L1DataDef.h
"
8
#include "
TrigConfL1Data/TriggerItem.h
"
9
10
#include <iostream>
11
#include <iomanip>
12
#include <stdexcept>
13
#include <algorithm>
14
15
using namespace
std
;
16
using namespace
TrigConf
;
17
18
TriggerItem::TriggerItem
() :
TrigConfData
(),
19
m_ComplexDeadtime
( 0 ),
20
m_Definition
(
""
),
21
m_CtpId
( -1 ),
22
m_TriggerType
( 0 ),
23
m_Partition
( 0 ),
24
m_Monitor
( 0 )
25
{}
26
27
TriggerItem::~TriggerItem
() {
28
}
29
30
31
uint16_t
32
TrigConf::TriggerItem::bunchgroupMask
()
const
{
33
uint16_t bgmask(0);
34
if
(
m_TopNode
) {
35
m_TopNode
->getBunchGroupsMask(bgmask);
36
}
37
return
bgmask;
38
}
39
40
41
TrigConf::DiffStruct
*
42
TrigConf::TriggerItem::compareTo
(
const
TriggerItem
* o)
const
{
43
DiffStruct
* ds =
new
DiffStruct
(
"TriggerItem"
);
44
ds->check(
"ctpid"
,
ctpId
(), o->
ctpId
());
45
ds->check(
"definition"
,
definition
(), o->
definition
());
46
ds->check(
"complex_deadtime"
,
complex_deadtime
(), o->
complex_deadtime
());
47
ds->check(
"triggertype"
,
triggerType
(), o->
triggerType
());
48
if
(!ds->empty()) {
49
ds->name =
name
();
50
}
else
{
51
delete
ds; ds=0;
52
}
53
return
ds;
54
}
55
56
57
void
58
TriggerItem::writeXML
(std::ostream &
xmlfile
,
int
indentLevel,
int
indentWidth)
const
{
59
60
61
62
63
string
final_def =
m_Definition
;
64
bool
end=
false
;
65
string::size_type
index
=0;
66
while
(!end){
67
std::string::size_type pos=final_def.find(
'&'
,
index
);
68
if
(pos!= std::string::npos){
69
end=
false
;
70
index
= pos+1;
71
//do the replace
72
final_def.replace(pos, 1,
"&"
);
73
}
else
{
74
end=
true
;
75
index
=0;
76
}
77
}
78
79
indent
(
xmlfile
, indentLevel, indentWidth)
80
<<
"<TriggerItem ctpid=\""
<<
m_CtpId
81
<<
"\" partition=\""
<<
partition
()
82
<<
"\" name=\""
<<
name
()
83
<<
"\" complex_deadtime=\""
<<
complex_deadtime
()
84
<<
"\" definition=\""
<< final_def
85
<<
"\" trigger_type=\""
<<
TrigConf::uint2bin
(
m_TriggerType
,
partition
()==1 ? 8 : 4) <<
"\""
;
86
if
(
monitor
()!=0) {
87
string
s(
"LF:"
);
88
s += (
monitor
() & 0x04 ?
'1'
:
'0'
);
89
s += (
monitor
() & 0x02 ?
'1'
:
'0'
);
90
s += (
monitor
() & 0x01 ?
'1'
:
'0'
);
91
s +=
"|HF:"
;
92
s += (
monitor
() & 0x20 ?
'1'
:
'0'
);
93
s += (
monitor
() & 0x10 ?
'1'
:
'0'
);
94
s += (
monitor
() & 0x08 ?
'1'
:
'0'
);
95
xmlfile
<<
" monitor=\""
<< s <<
"\""
;
96
}
97
xmlfile
<<
">"
<< endl;
98
99
if
(
m_TopNode
)
100
m_TopNode
->writeXML(
xmlfile
, indentLevel+1, indentWidth);
101
102
indent
(
xmlfile
, indentLevel, indentWidth) <<
"</TriggerItem>"
<< endl;
103
}
104
105
106
void
107
TriggerItem::buildLogic
(std::string & logic, std::vector<std::string> & conditionList)
const
{
108
if
(
m_TopNode
)
109
m_TopNode
->buildLogic(conditionList, logic);
110
}
111
112
113
void
114
TriggerItem::setCondition
(
const
string
& logic,
115
const
vector<string>& conditions,
116
const
vector<TriggerThreshold*>& thrs) {
117
// logic is a string like "!(1|2)&(3|4)"
118
// vector of conditions of length equal the largest number in logic string (e.g 4)
119
// a condition can be either a single name for internal triggers or a komma separated list of multiplicity, conditions name and threshold name
120
// thrs is a list of thresholds
121
122
m_Definition
=
"("
+logic+
")"
;
123
124
try
{
125
m_TopNode
.reset (
TrigConf::parse
(logic, conditions, thrs));
126
}
127
catch
(
const
exception& e) {
128
cout <<
"WARNING: Could not set condition of triggeritem "
<<
name
() <<
" because: "
<< e.what() << endl;
129
}
130
}
131
132
133
void
134
TriggerItem::print
(
const
std::string&
indent
,
unsigned
int
detail
)
const
{
135
if
(
detail
<3) {
136
cout <<
indent
<<
"TriggerItem ctpid = "
<<
m_CtpId
<<
" "
;
137
printNameIdV
();
138
}
else
{
139
cout <<
indent
<<
"=================================="
<< endl;
140
cout <<
indent
<<
"TriggerItem:"
;
141
printNameIdV
(
indent
);
142
cout <<
indent
<<
"Complex Deadtime: "
<<
m_ComplexDeadtime
<< endl;
143
cout <<
indent
<<
"Definition: "
<<
m_Definition
<< endl;
144
cout <<
indent
<<
"CTP_id : "
<<
m_CtpId
<< endl;
145
cout <<
indent
<<
"TriggerType(hex): 0x"
<< std::hex <<
m_TriggerType
<< std::dec << endl;
146
cout <<
indent
<<
"Bunchgroup mask : "
<<
uint2bin
(
bunchgroupMask
(), 16) << endl;
147
cout <<
indent
<<
"Monitor : "
<<
monitor
() << endl;
148
if
(
detail
>=4) {
149
if
(
m_TopNode
)
m_TopNode
->print(
indent
,
detail
);
150
else
cout <<
indent
<<
"TopNode is NULL pointer"
<< endl;
151
}
152
}
153
}
154
155
156
std::ostream &
157
TrigConf::operator<<
(std::ostream & o,
const
TrigConf::TriggerItem
& item) {
158
o <<
"TriggerItem: "
<< (
const
TrigConfData
&)item;
159
o <<
" Complex Deadtime: "
<< item.
m_ComplexDeadtime
<< endl;
160
o <<
" Definition: "
<< item.
m_Definition
<< endl;
161
o <<
" CTP_id: "
<< item.
m_CtpId
<< endl;
162
o <<
" TriggerType(hex): "
<< hex << item.
m_TriggerType
<< dec << endl;
163
if
(item.
topNode
()) o << *item.
topNode
();
164
else
o <<
" No TopNode"
<< endl;
165
return
o;
166
}
167
168
169
string
170
TriggerItem::__str__
()
const
{
171
stringstream s;
172
s << *
this
;
173
return
s.str();
174
}
DiffStruct.h
L1DataDef.h
TriggerItem.h
HelperFunctions.h
TrigConf::DiffStruct
Definition
DiffStruct.h:14
TrigConf::TrigConfData
Definition
TrigConfData.h:13
TrigConf::TrigConfData::indent
std::ostream & indent(std::ostream &o, int lvl, int size) const
Definition
TrigConfData.cxx:23
TrigConf::TrigConfData::name
const std::string & name() const
Definition
TrigConfData.h:22
TrigConf::TrigConfData::printNameIdV
void printNameIdV(const std::string &indent="") const
Definition
TrigConfData.cxx:31
TrigConf::TrigConfData::TrigConfData
TrigConfData(const std::string &name="")
Definition
TrigConfData.cxx:14
TrigConf::TriggerItem
Definition
TriggerItem.h:26
TrigConf::TriggerItem::m_Definition
std::string m_Definition
Definition
TriggerItem.h:71
TrigConf::TriggerItem::m_TopNode
std::unique_ptr< TriggerItemNode > m_TopNode
Definition
TriggerItem.h:72
TrigConf::TriggerItem::m_Monitor
unsigned short m_Monitor
Definition
TriggerItem.h:76
TrigConf::TriggerItem::complex_deadtime
unsigned int complex_deadtime() const
Definition
TriggerItem.h:32
TrigConf::TriggerItem::print
virtual void print(const std::string &indent="", unsigned int detail=1) const override
Definition
TriggerItem.cxx:134
TrigConf::TriggerItem::topNode
const TriggerItemNode * topNode() const
Definition
TriggerItem.h:37
TrigConf::TriggerItem::buildLogic
void buildLogic(std::string &logic, std::vector< std::string > &conditionList) const
Definition
TriggerItem.cxx:107
TrigConf::TriggerItem::ctpId
int ctpId() const
Definition
TriggerItem.h:35
TrigConf::TriggerItem::compareTo
DiffStruct * compareTo(const TriggerItem *o) const
Definition
TriggerItem.cxx:42
TrigConf::TriggerItem::m_ComplexDeadtime
unsigned int m_ComplexDeadtime
Definition
TriggerItem.h:70
TrigConf::TriggerItem::bunchgroupMask
uint16_t bunchgroupMask() const
Definition
TriggerItem.cxx:32
TrigConf::TriggerItem::__str__
std::string __str__() const override
Definition
TriggerItem.cxx:170
TrigConf::TriggerItem::writeXML
void writeXML(std::ostream &xmlfile, int indentLevel=0, int indentWidth=2) const
Definition
TriggerItem.cxx:58
TrigConf::TriggerItem::m_CtpId
int m_CtpId
Definition
TriggerItem.h:73
TrigConf::TriggerItem::definition
const std::string & definition() const
Definition
TriggerItem.h:33
TrigConf::TriggerItem::m_TriggerType
unsigned int m_TriggerType
Definition
TriggerItem.h:74
TrigConf::TriggerItem::TriggerItem
TriggerItem()
Definition
TriggerItem.cxx:18
TrigConf::TriggerItem::setCondition
void setCondition(const std::string &logic, const std::vector< std::string > &conditions, const std::vector< TrigConf::TriggerThreshold * > &thrs)
Definition
TriggerItem.cxx:114
TrigConf::TriggerItem::partition
unsigned int partition() const
Definition
TriggerItem.h:36
TrigConf::TriggerItem::monitor
unsigned short monitor() const
Definition
TriggerItem.h:38
TrigConf::TriggerItem::m_Partition
unsigned int m_Partition
Definition
TriggerItem.h:75
TrigConf::TriggerItem::~TriggerItem
virtual ~TriggerItem() override
Definition
TriggerItem.cxx:27
TrigConf::TriggerItem::triggerType
unsigned int triggerType() const
Definition
TriggerItem.h:34
xmlfile
static std::vector< std::string > xmlfile
Definition
iLumiCalc.h:29
TrigConf
Forward iterator to traverse the main components of the trigger configuration.
Definition
Config.h:22
TrigConf::uint2bin
std::string uint2bin(uint32_t uinteger, uint16_t width)
Definition
Trigger/TrigConfiguration/TrigConfL1Data/Root/HelperFunctions.cxx:325
TrigConf::operator<<
std::ostream & operator<<(std::ostream &os, const TrigConf::IsolationLegacy &iso)
Definition
L1ThresholdBase.cxx:339
TrigConf::parse
std::vector< std::string > parse(std::string names)
Definition
TrigConfHLTData/Root/HLTChain.cxx:117
detail
Definition
extract_histogram_tag.cxx:14
index
Definition
index.py:1
std
STL namespace.
Generated on
for ATLAS Offline Software by
1.17.0