ATLAS Offline Software
Loading...
Searching...
No Matches
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
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:
25 parts = input.split( ":" )
26 else:
27 parts = [ input ]
28
29 for part in parts :
30 if part[-4:]==";DTE":
31 self.passed = True
32 part = part[0:-4]
33 if self.head == "":
34 self.head = part
35 continue
36 if "key=" in part:
37 self.tail = part[4:]
38 if "roi=" in part:
39 self.roi = part[4:]
40 if "vtx=" in part:
41 self.vtx = part[4:]
42 if "te=" in part:
43 self.element = part[3:]
44 if "extra=" in part:
45 self.extra = part[6:]
46
47 stuff = [ self.roi, self.vtx, self.element, self.extra ]
48
49 sum = self.head
50
51 if self.tail != "" :
52 if sum == "" :
53 sum = self.tail
54 else:
55 sum += "_" + self.tail
56
57
58 for part in stuff:
59 if part != "":
60 sum += "_"+part
61
62 if self.passed:
63 sum += "_DTE"
64
65 self.sum = sum
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 print( "" )
82
83
84# provide the summary without needing the
85# intermediate class instance
86
87def summarise( input ) :
88 return chainString( input ).summary()
89
void print(char *figname, TCanvas *c1)