 |
ATLAS Offline Software
|
|
| def | worst_status (iovs, *dummy_args) |
| |
| def | worst (iterable) |
| |
| def | first (iterable) |
| |
| def | best (iterable, priorities=[3, 2, 1, -1, 0]) |
| |
| def | best_status (iovs, *dummy_args) |
| |
| def | iovs_in_time (wanted_start_time, wanted_end_time) |
| |
| def | get_root_version () |
| |
| def | fix_iovkey (iovkey) |
| |
| def | make_functor (expression, location, global_env={}, input_translation=None) |
| |
| def | make_floats_pretty (x) |
| |
| def | pprint_objects (objects, where=stdout) |
| |
| def | describe_colour (colour) |
| |
| def | tree (key_wrapper=None) |
| |
| def | directory_like (*key) |
| |
| def | get_array (hist) |
| |
| AthConfigFlags | getFlagsForActiveConfig (AthConfigFlags flags, str config_name, logging.Logger log) |
| |
| AthConfigFlags | cloneFlagsToActiveConfig (AthConfigFlags flags, str config_name, logging.Logger log) |
| |
| AthConfigFlags | _cloneFlagsToActiveConfig (AthConfigFlags flags, str config_name) |
| |
|
| dictionary | BUILTIN_NAMES = {"True", "False"} |
| |
| | WHITE = None |
| |
| int | GREY = 0 |
| |
| string | TAIL = lambda s: u' └── {} '.format(s) |
| |
| string | BRANCH = lambda s: u' ├── {} '.format(s) |
| |
| string | LINE = lambda s: u' │ {} '.format(s) |
| |
| string | SPACE = lambda s: u' {} '.format(s) |
| |
◆ _cloneFlagsToActiveConfig()
| AthConfigFlags python.utils._cloneFlagsToActiveConfig |
( |
AthConfigFlags |
flags, |
|
|
str |
config_name |
|
) |
| |
|
private |
Definition at line 71 of file Trigger/TrigTools/TrigInDetConfig/python/utils.py.
73 prefix =
"Trigger.InDetTracking."
74 if flags.Detector.GeometryITk:
75 prefix =
"Trigger.ITkTracking."
76 if flags.Trigger.useActsTracking:
77 prefix =
"Trigger.ActsTracking."
79 return flags.cloneAndReplace(
80 "Tracking.ActiveConfig",
◆ best()
| def python.utils.best |
( |
|
iterable, |
|
|
|
priorities = [3, 2, 1, -1, 0] |
|
) |
| |
a min() function whose priorities can be chosen
Definition at line 49 of file DataQuality/DQUtils/python/utils.py.
49 def best(iterable, priorities=[3, 2, 1, -1, 0]):
51 a min() function whose priorities can be chosen
53 return worst(iterable, [3, 2, 1, -1, 0])
◆ best_status()
| def python.utils.best_status |
( |
|
iovs, |
|
|
* |
dummy_args |
|
) |
| |
Return the worst status. (Different from worst_of).
Definition at line 55 of file DataQuality/DQUtils/python/utils.py.
57 Return the worst status. (Different from worst_of).
59 if len(iovs) == 1:
return iovs[0][2]
60 statuses = zip(*iovs)[2]
◆ cloneFlagsToActiveConfig()
| AthConfigFlags python.utils.cloneFlagsToActiveConfig |
( |
AthConfigFlags |
flags, |
|
|
str |
config_name, |
|
|
logging.Logger |
log |
|
) |
| |
InDet/ITk specific clone and replace of ActiveConfig without checking flags vs config_name
this function should be used only high up in the menu creation where a context of tracking flags
does not exist yet and is created for the first time in generateChainConfigs function
or there are multiple contexts for ActiveConfig like in LRT
in other cases getFlagsForActiveConfig should be used instead
Definition at line 54 of file Trigger/TrigTools/TrigInDetConfig/python/utils.py.
55 flags: AthConfigFlags, config_name: str, log: logging.Logger) -> AthConfigFlags:
58 InDet/ITk specific clone and replace of ActiveConfig without checking flags vs config_name
60 this function should be used only high up in the menu creation where a context of tracking flags
61 does not exist yet and is created for the first time in generateChainConfigs function
62 or there are multiple contexts for ActiveConfig like in LRT
64 in other cases getFlagsForActiveConfig should be used instead
68 log.info(f
"Cloning tracking config for {config_name} to flags.Tracking.ActiveConfig")
◆ describe_colour()
| def python.utils.describe_colour |
( |
|
colour | ) |
|
◆ directory_like()
| def python.utils.directory_like |
( |
* |
key | ) |
|
◆ first()
| def python.utils.first |
( |
|
iterable | ) |
|
Return the first filled (and not grey) flag
Definition at line 37 of file DataQuality/DQUtils/python/utils.py.
39 Return the first filled (and not grey) flag
42 for element
in iterable:
43 if element
not in [WHITE, GREY]:
◆ fix_iovkey()
| def python.utils.fix_iovkey |
( |
|
iovkey | ) |
|
If an IoV starts on the 0th lumiblock, then move it forward one.
Definition at line 93 of file DataQuality/DQUtils/python/utils.py.
95 If an IoV starts on the 0th lumiblock, then move it forward one.
97 return iovkey
if iovkey & 0xFFFFFFFF
else iovkey+1
◆ get_array()
| def python.utils.get_array |
( |
|
hist | ) |
|
◆ get_root_version()
| def python.utils.get_root_version |
( |
| ) |
|
Return ROOT version tuple
Definition at line 85 of file DataQuality/DQUtils/python/utils.py.
87 Return ROOT version tuple
89 from ROOT
import gROOT
90 version_code = gROOT.RootVersionCode()
91 return (version_code >> 16, version_code >> 8 & 0xFF, version_code & 0xFF)
◆ getFlagsForActiveConfig()
| AthConfigFlags python.utils.getFlagsForActiveConfig |
( |
AthConfigFlags |
flags, |
|
|
str |
config_name, |
|
|
logging.Logger |
log |
|
) |
| |
Get the flags for the named config, ensure that they are set to be active
Parameters
----------
flags : AthConfigFlags
The instance of the flags to check
config_name : str
The name of the desired tracking config
log : logging.Logger
Logger to print related messages
Returns
-------
Either the current flags instance if all the ActiveConfig is correct or a new
version with cloned flags
the flags correspond to InDet/ITk format
Definition at line 9 of file Trigger/TrigTools/TrigInDetConfig/python/utils.py.
10 flags: AthConfigFlags, config_name: str, log: logging.Logger) -> AthConfigFlags:
12 """Get the flags for the named config, ensure that they are set to be active
16 flags : AthConfigFlags
17 The instance of the flags to check
19 The name of the desired tracking config
21 Logger to print related messages
25 Either the current flags instance if all the ActiveConfig is correct or a new
26 version with cloned flags
28 the flags correspond to InDet/ITk format
31 if flags.hasFlag(
"Tracking.ActiveConfig.input_name"):
32 if flags.Tracking.ActiveConfig.input_name == config_name:
34 "flags.Tracking.ActiveConfig is for %s",
35 flags.Tracking.ActiveConfig.input_name,
40 "flags.Tracking.ActiveConfig is not for %s but %s",
42 flags.Tracking.ActiveConfig.input_name,
47 "Menu code invoked ID config without flags.Tracking.ActiveConfig for %s",
◆ iovs_in_time()
| def python.utils.iovs_in_time |
( |
|
wanted_start_time, |
|
|
|
wanted_end_time |
|
) |
| |
Return a function which selects iovs dependent on they occured
in the desired time
Definition at line 63 of file DataQuality/DQUtils/python/utils.py.
65 Return a function which selects iovs dependent on they occured
73 start_time, end_time, status = iov
77 start_time <= wanted_start_time <= end_time
or
78 start_time <= wanted_end_time <= end_time
or
80 wanted_start_time <= start_time <= wanted_end_time
or
81 wanted_start_time <= end_time <= wanted_end_time)
◆ make_floats_pretty()
| def python.utils.make_floats_pretty |
( |
|
x | ) |
|
◆ make_functor()
| def python.utils.make_functor |
( |
|
expression, |
|
|
|
location, |
|
|
|
global_env = {}, |
|
|
|
input_translation = None |
|
) |
| |
Compile an expression, returning the variables used and a functor which can
be called with the namespace in which the expression is run
`expression` is a single python expression to be evaluated
`location` is a string describing where the snippet of code came from
(in case of exceptions, for debugging)
`global_env` is the global environment in which the expression is executed
`input_translation` is an optional function which is executed on the
functor's arguments before it is executed.
Definition at line 99 of file DataQuality/DQUtils/python/utils.py.
99 def make_functor(expression, location, global_env={}, input_translation=None):
101 Compile an expression, returning the variables used and a functor which can
102 be called with the namespace in which the expression is run
104 `expression` is a single python expression to be evaluated
105 `location` is a string describing where the snippet of code came from
106 (in case of exceptions, for debugging)
107 `global_env` is the global environment in which the expression is executed
108 `input_translation` is an optional function which is executed on the
109 functor's arguments before it is executed.
111 compiled = compile(expression, location,
"eval")
113 provided_vars =
set(global_env.keys())
114 variables =
sorted(
set(compiled.co_names) - BUILTIN_NAMES - provided_vars)
115 if input_translation:
116 def functor(locals_={}):
117 return eval(compiled, global_env, input_translation(locals_))
119 def functor(locals_={}):
120 return eval(compiled, global_env, locals_)
121 return variables, functor
◆ pprint_objects()
| def python.utils.pprint_objects |
( |
|
objects, |
|
|
|
where = stdout |
|
) |
| |
Pretty print a list of IoV-results
Definition at line 128 of file DataQuality/DQUtils/python/utils.py.
130 Pretty print a list of IoV-results
133 since, until = obj[:2]
134 args = since, until,
"(%s)" %
", ".
join(map(str, map(make_floats_pretty, obj[2:])))
135 print(
"[%r -> %r) : %s" % args, file=where)
◆ tree()
| def python.utils.tree |
( |
|
key_wrapper = None | ) |
|
◆ worst()
| def python.utils.worst |
( |
|
iterable | ) |
|
Definition at line 21 of file DataQuality/DQUtils/python/utils.py.
22 states =
set(iterable)
24 if not states:
return None
25 if -1
in states:
return -1
26 elif 1
in states:
return 1
27 elif 2
in states:
return 2
28 elif 3
in states:
return 3
29 elif 0
in states:
return 0
30 elif None in states:
return None
32 raise RuntimeError(
"Invalid Code present on database?")
◆ worst_status()
| def python.utils.worst_status |
( |
|
iovs, |
|
|
* |
dummy_args |
|
) |
| |
Return the worst status of multiple IoVs. (Different from worst_of).
Definition at line 13 of file DataQuality/DQUtils/python/utils.py.
15 Return the worst status of multiple IoVs. (Different from worst_of).
17 if len(iovs) == 1:
return iovs[0][2]
18 statuses = zip(*iovs)[2]
19 return worst(statuses)
◆ BRANCH
| string python.utils.BRANCH = lambda s: u' ├── {} '.format(s) |
◆ BUILTIN_NAMES
| dictionary python.utils.BUILTIN_NAMES = {"True", "False"} |
◆ GREY
| int python.utils.GREY = 0 |
◆ LINE
| string python.utils.LINE = lambda s: u' │ {} '.format(s) |
◆ SPACE
| string python.utils.SPACE = lambda s: u' {} '.format(s) |
◆ TAIL
| string python.utils.TAIL = lambda s: u' └── {} '.format(s) |
◆ WHITE
| python.utils.WHITE = None |
std::vector< typename R::value_type > sorted(const R &r, PROJ proj={})
Helper function to create a sorted vector from an unsorted range.
def make_floats_pretty(x)
def worst_status(iovs, *dummy_args)
def describe_colour(colour)
AthConfigFlags getFlagsForActiveConfig(AthConfigFlags flags, str config_name, logging.Logger log)
def pprint_objects(objects, where=stdout)
AthConfigFlags cloneFlagsToActiveConfig(AthConfigFlags flags, str config_name, logging.Logger log)
def best(iterable, priorities=[3, 2, 1, -1, 0])
def best_status(iovs, *dummy_args)
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
void print(char *figname, TCanvas *c1)
std::string join(const std::vector< std::string > &v, const char c=',')
def iovs_in_time(wanted_start_time, wanted_end_time)
AthConfigFlags _cloneFlagsToActiveConfig(AthConfigFlags flags, str config_name)
def make_functor(expression, location, global_env={}, input_translation=None)