ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigAnalysis
TrigInDetAnalysisExample
python
chainString.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
2
3
# take a chain string configuration and decode it into the constituent parts,
4
# so that it can be reconstructed without the tags.
5
6
# This is an approximate python implementation of the equivalent c++
7
# class and wouldn't be needed if the setPath() method on the GenericMonitoringTool
8
# worked correctly, since the decoding is done in the c++, and the path could then
9
# be set correctly at that point. sadly, this doesn;t not seem to work, so we need
10
# to decode consistently in the c++ and the python to make sure that things
11
# are consistent
12
13
class
chainString
:
14
15
def
__init__
(self, input ):
16
self.
head
=
""
17
self.
tail
=
""
18
self.
roi
=
""
19
self.
vtx
=
""
20
self.
element
=
""
21
self.
extra
=
""
22
self.
passed
=
""
23
24
if
":"
in
input : parts = input.split(
":"
)
25
else
: parts = [ input ]
26
27
if
len(parts) == 1 : self.
tail
= parts[0]
28
else
:
29
30
self.
head
= parts[0]
31
32
for
part
in
parts[1:]:
33
if
part.endswith(
";DTE"
):
34
self.
passed
=
True
35
part = part[0:-4]
36
if
part.startswith(
"key="
) : self.
tail
= part[4:]
37
if
part.startswith(
"roi="
) : self.
roi
= part[4:]
38
if
part.startswith(
"vtx="
) : self.
vtx
= part[4:]
39
if
part.startswith(
"te="
) : self.
element
= part[3:]
40
if
part.startswith(
"extra="
) : self.
extra
= part[6:]
41
42
if
len(parts)>1
and
self.
tail
==
""
: self.
tail
= parts[1]
43
if
len(parts)>2
and
self.
roi
==
""
: self.
roi
= parts[2]
44
if
len(parts)>3
and
self.
vtx
==
""
: self.
vtx
= parts[3]
45
if
len(parts)>4
and
self.
element
==
""
: self.
element
= parts[4]
46
if
len(parts)>5
and
self.
extra
==
""
: self.
extra
= parts[5]
47
48
stuff = [ self.
roi
, self.
vtx
, self.
element
, self.
extra
]
49
50
sum = self.
head
51
52
if
self.
tail
!=
""
:
53
if
sum ==
""
: sum = self.
tail
54
else
: sum +=
"_"
+ self.
tail
55
56
for
part
in
stuff:
57
if
part !=
""
:
58
sum +=
"_"
+part
59
60
if
self.
passed
: sum +=
"_DTE"
61
62
self.
sum
= sum
63
64
def
__str__
(self) :
65
return
self.
summary
()
66
67
# provide the summary
68
def
summary
( self ):
69
return
self.
sum
70
71
# printout if needed
72
def
printchain
( self ):
73
print
(
" head: "
, self.
head
)
74
print
(
" tail: "
, self.
tail
)
75
print
(
" vtx: "
, self.
vtx
)
76
print
(
" roi: "
, self.
roi
)
77
print
(
" te: "
, self.
element
)
78
print
(
" extra: "
, self.
extra
)
79
print
(
" passed: "
, self.
passed
)
80
print
(
" sum: "
, self.
sum
)
81
82
83
# provide the summary without needing the
84
# intermediate class instance
85
86
def
summarise
( input ) :
87
return
chainString
( input ).summary()
88
print
void print(char *figname, TCanvas *c1)
Definition
TRTCalib_StrawStatusPlots.cxx:26
python.chainString.chainString
Definition
chainString.py:13
python.chainString.chainString.__init__
__init__(self, input)
Definition
chainString.py:15
python.chainString.chainString.roi
str roi
Definition
chainString.py:18
python.chainString.chainString.tail
str tail
Definition
chainString.py:17
python.chainString.chainString.vtx
str vtx
Definition
chainString.py:19
python.chainString.chainString.passed
str passed
Definition
chainString.py:22
python.chainString.chainString.element
str element
Definition
chainString.py:20
python.chainString.chainString.summary
summary(self)
Definition
chainString.py:68
python.chainString.chainString.head
str head
Definition
chainString.py:16
python.chainString.chainString.extra
str extra
Definition
chainString.py:21
python.chainString.chainString.sum
sum
Definition
chainString.py:62
python.chainString.chainString.__str__
__str__(self)
Definition
chainString.py:64
python.chainString.chainString.printchain
printchain(self)
Definition
chainString.py:72
python.chainString.summarise
summarise(input)
Definition
chainString.py:86
Generated on
for ATLAS Offline Software by
1.17.0