psdaq.control.control¶
The DAQ control process (control command). CollectionManager runs the
state machine (states and transitions from ControlDef), talks to the DRP,
TEB and MEB processes over ZMQ, answers client requests (DaqControl,
daqstate, the GUI) and drives the XPM through DaqXPM. RunParams reads
the run-parameter PVs recorded at BeginRun; main() parses the command line.
See DAQ control.
psdaq.control.control ¶
DAQ collection manager.
Defines CollectionManager, a transitions.Machine-based state machine that talks to
DAQ processes over ZMQ, to XPMs through PVA PVs (DaqXPM, DaqPVA) and to the logbook
web service over HTTP, plus helper functions and the main command-line entry point.
PvInfo ¶
PvInfo(name, desc)
RunParams ¶
RunParams(path, collection, platform, pva)
Run Parameters
updateFileSet ¶
updateFileSet(fileSet)
Return fileSet plus the files included by lines starting with '<' in those files.
In each file, text after '#' is dropped; a line starting with '<' is parsed as a
comma-separated list of file names. Relative names are prefixed with the directory of
self.path. Errors opening/reading a file are logged and skipped.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fileSet
|
set of str
|
Files to scan. |
required |
Returns:
| Type | Description |
|---|---|
set of str
|
Union of |
updatePvSet ¶
updatePvSet()
Parse the files in self.fileSet and set self.pvaList and self.caList.
Lines starting with '' or '#' set the description used for the following PV lines;
'<' lines, blank lines and other '#' lines reset it to None. Any other line is a PV
name, stored as a PvInfo in pvaList if followed by 'pva', else in caList.
configure ¶
configure()
Collect the run-parameter files and PVs starting from self.path.
If self.path is not '/dev/null' and does not exist, an error is reported via
collection.report_error. Otherwise include files are followed recursively with
updateFileSet, and missing files are reported and dropped. Then updatePvSet is
called if any files were found and recordedExperiments is reset to an empty set.
beginrun ¶
beginrun(experiment_name)
Read run parameters and post them to the logbook for experiment_name.
Does nothing in simulator mode. Reads the PVA PVs via pva.pv_get and the CA PVs via
epics.caget_many (failed reads and nan/inf floats are reported as warnings and
skipped), adds 'partition' and, for each active non-monitor drp alias of the form
'
Notes
The parameters are sent with collection.add_run_params; PV descriptions are sent
with collection.add_update_run_param_descriptions only the first time an experiment is
seen. Errors are reported if fewer items were recorded than sent.
ControlError ¶
Bases: Exception
Base class for exceptions in this module.
ConfigDBError ¶
ConfigDBError(message)
Bases: ControlError
Exception raised for ConfigDB errors. Attributes: message -- explanation of the error
DaqPVA ¶
DaqPVA(*, report_error)
Thin wrapper around a p4p 'pva' client Context for PV gets and puts.
report_error is a callable used to report failed puts.
pv_get ¶
pv_get(pvList)
Get one or more PVA PVs without raising on errors.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pvList
|
list of str, str or None
|
PV name(s); a single name is wrapped in a list. |
required |
Returns:
| Type | Description |
|---|---|
list
|
Values or exception objects from |
pv_put ¶
pv_put(pvName, val)
Put a value to one or more PVA PVs without waiting.
If pvName is a list and val is not, val is repeated for each name. Timeouts and
other exceptions are reported with report_error.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pvName
|
str or list of str
|
PV name(s). |
required |
val
|
Value or list of values. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the put call did not raise, else False. |
DaqXPM ¶
DaqXPM(*, platform, xpm_master, pv_base, pva, zctxt, xpm_host, report_error)
Encapsulate control-to-XPM communication.
PV names are built from pv_base + ':XPM:<xpm_master>'. Register writes go through
PVA puts when xpm_host is None; otherwise some are sent as JSON messages on a ZMQ
PUSH socket connected to xpm_host at xpm_pull_port.
allocate ¶
allocate(groups)
Build per-group PV name lists and put groups to each group's L0Groups PV.
For each bit g set in groups, ':PART:pvListMsgHeader, pvListXPM and
pvListL0Groups. An error is reported if the put fails.
Returns:
| Type | Description |
|---|---|
bool
|
Result of |
setup_common ¶
setup_common(platform, groups)
Configure the common group for platform.
Puts groups ^ (1 << platform) to ':PART:
Returns:
| Type | Description |
|---|---|
bool
|
False if a put fails (or the get returns None), else True. |
deallocate ¶
deallocate(groups)
Put 0 to all L0Groups PVs in pvListL0Groups and return the put result; groups is unused.
recording ¶
recording(recording, groups)
Put recording to ':PART:groups.
clear_readout ¶
clear_readout(groups)
Write groups to the group L0 reset, insert a ClearReadout transition and sleep 1 s.
The reset is a PVA put to ':GroupL0Reset' or, when using the XPM host, a ZMQ 'set_reg' message for register 'groupL0Reset'.
set_master ¶
set_master(groups)
Put 1 to every ':PART:pvListXPM.
Returns:
| Type | Description |
|---|---|
bool
|
False at the first failed put, else True. |
set_common ¶
set_common(common)
Put 2 to ':PART:
group_run ¶
group_run(groups, enable)
Enable or disable L0 triggering for groups.
Writes groups to ':GroupL0Enable' (or ':GroupL0Disable') by PVA put, or sends a ZMQ
'set_reg' message for 'groupL0Enable'/'groupL0Disable' when using the XPM host.
Returns:
| Type | Description |
|---|---|
bool
|
The put result, or True when the ZMQ message was sent. |
insert_transition ¶
insert_transition(groups, id)
Insert transition id for groups.
With PVA, puts id to all MsgHeader PVs and then, if that succeeded, groups to
':GroupMsgInsert'. Otherwise sends 'set_idx_reg' (reg 'msgHdr') and 'set_reg'
(reg 'groupMsgInsert') ZMQ messages.
Returns:
| Type | Description |
|---|---|
bool
|
The PVA put result, or True when ZMQ messages were sent. |
setup_step ¶
setup_step(group, mask, readout)
Set up step-end counting for readout group group.
Writes readout to ':PART:mask to ':PART:pvStepDone.
Returns:
| Type | Description |
|---|---|
bool
|
Result of the StepGroups put, or True on the ZMQ path. |
step_groups_clear ¶
step_groups_clear(groups)
Put 0 to ':PART:groups.
Returns:
| Type | Description |
|---|---|
bool
|
False (and logs an error) if the put fails, else True. |
monitor_StepDone ¶
monitor_StepDone(*, callback)
Start a PVA monitor on pvStepDone with callback and return the subscription.
CollectionManager ¶
CollectionManager(args)
DAQ collection manager state machine.
The constructor binds the back PULL/PUB, front REP/PUB and fast REP ZMQ sockets,
creates DAQ helper objects, registers the transitions with a transitions.Machine,
starts the fast-reply (and optional slow-update) threads and then runs the main loop
run(); when it returns, the threads are stopped and joined.
Notes
Each transition calls its condition_* method; the state changes only if it returns
True, after which report_status is called (enable also calls after_enable).
'slowupdate' is an internal transition in 'running' with no state change or report.
cmstate_levels ¶
cmstate_levels()
Return a dict with only the cmstate entries whose keys are in level_keys.
level_keys is {'drp', 'teb', 'meb', 'control', 'tpr'}.
service_requests ¶
service_requests()
Receive one request on the front REP socket and handle it.
Keys 'setstate.phase1Info) and 'setconfig.handle_setstate/
handle_setconfig, which send their own replies. A transition key gets an 'ok' reply
before handle_trigger runs; other keys use handle_request.
Notes
'slowupdate' is dropped while slow updates are disabled. A KeyError produces an
'error' reply. For a transition with a non-empty body the code uses key[1] and an
undefined name phase1Info, which would raise.
service_fast ¶
service_fast()
Receive one request on the fast REP socket and handle it.
'setrecord.<0|1>' and 'setbypass.<0|1>' call handle_setrecord/handle_setbypass
(any value other than '0' means True), which reply themselves. Other keys are looked up
in handle_fast and the result is sent as the reply; a KeyError sends an 'error' reply.
register_file ¶
register_file(body)
Publish a fileReport and register the data file with the logbook.
Does nothing in simulator mode. Sends fileReport_msg(path) on the front PUB socket
and POSTs body as JSON to '
Raises:
| Type | Description |
|---|---|
ConfigDBError
|
If |
confirm_response ¶
confirm_response(socket, wait_time, msg_id, ids, *, progress_txt=None)
Collect replies from ids on socket until all respond, an error arrives or time runs out.
Uses wait_for_answers in 1 s slices up to wait_time ms; if progress_txt is given,
progressReport is called each slice. A message whose body has 'err_info' (key other
than 'warning') ends the wait and resets the pending list to that sender only.
Returns:
| Type | Description |
|---|---|
tuple
|
(ids still pending, list of reply messages, list of report messages). After an error the pending list is empty if the error came in a regular reply and holds the sender if it came in a report. |
process_reports ¶
process_reports(report_list)
Handle report messages.
'fileReport' calls register_file (which may raise ConfigDBError), 'error'/'warning'
are re-published with report_error/report_warning, and 'chunkRequest' calls
handle_chunkrequest. KeyErrors are logged.
service_status ¶
service_status()
Receive one JSON message on the back PULL socket and pass it to process_reports.
run ¶
run()
Main loop: poll the front REP and back PULL sockets and service whichever is ready.
Runs until KeyboardInterrupt, which is logged.
handle_trigger ¶
handle_trigger(key, *, stateChange=True)
Fire state-machine trigger key and build a reply.
MachineError and AttributeError from the trigger are turned into an error text. With
stateChange True, an unchanged state is also an error.
Returns:
| Type | Description |
|---|---|
dict
|
Message keyed by the current state with body |
next_transition ¶
next_transition(oldstate, newstate)
Return the next transition from next_dict to move from oldstate toward newstate, or 'error'.
handle_setstate ¶
handle_setstate(newstate)
Reply on the front REP socket and step the state machine toward newstate.
An unknown state gets an 'error' reply. Otherwise an 'ok' reply is sent first and
transitions from next_transition are triggered until the state matches; it stops at
the first error, which is reported with report_error.
Returns:
| Type | Description |
|---|---|
dict
|
The last reply/answer message built. |
handle_setconfig ¶
handle_setconfig(newconfig)
Set the config alias and reply on the front REP socket.
In 'running' or 'paused' an 'error' reply is sent. Otherwise, if newconfig differs
from config_alias, it is stored and report_status is called; then 'ok' is sent.
handle_setrecord ¶
handle_setrecord(newrecording)
Set the recording flag and reply on the fast REP socket.
In 'running', 'paused' or 'starting' an 'error' reply is sent. Otherwise, if the value
changed, recording is updated and report_status is called; then 'ok' is sent.
handle_setbypass ¶
handle_setbypass(newbypass)
Set the bypass_activedet flag and reply on the fast REP socket.
Only allowed in 'reset' or 'unallocated'; otherwise an 'error' reply is sent. If the
value changed, bypass_activedet is updated and report_status is called; then 'ok' is sent.
status_msg ¶
status_msg()
Return a 'status' message.
The body has 'state', 'transition' (last transition), 'platform' (cmstate_levels()),
'config_alias', 'recording', 'bypass_activedet', 'experiment_name' ('None' if unset),
'run_number' and 'last_run_number'.
check_answers ¶
check_answers(answers)
Report each answer that contains body['err_info'] and return how many there were.
Each error is reported as 'get_aliases.
get_phase2_replies ¶
get_phase2_replies(transition)
Wait for phase-2 replies to transition from active drp and meb processes.
Uses confirm_response on the back PULL socket with phase2_timeout, then processes
reports; a ConfigDBError from them is reported.
Returns:
| Type | Description |
|---|---|
bool
|
False if report processing raised ConfigDBError or any process did not respond (each is reported), else True. |
condition_alloc ¶
condition_alloc()
Condition for the 'alloc' transition.
Publishes 'alloc' (body: active ids plus cmstate), waits up to 15 s for replies and
merges them into cmstate. Assigns 'drp_id', 'teb_id' and 'meb_id' numbers, computes
the readout-group mask groups and (outside simulator mode) disables L0, clears step
groups, allocates XPM PVs and optionally sets up the common group.
Returns:
| Type | Description |
|---|---|
bool
|
True on success. False if a client does not respond, there is no active drp or teb,
no drp uses readout group |
condition_dealloc ¶
condition_dealloc()
Condition for the 'dealloc' transition.
Publishes 'dealloc', waits up to 30 s for replies and, if all answered without errors, puts 0 to the L0Groups PVs (outside simulator mode).
Returns:
| Type | Description |
|---|---|
bool
|
True on success. On a deallocate failure the code formats an undefined name |
condition_beginrun ¶
condition_beginrun()
Condition for the 'beginrun' transition.
Looks up the experiment; when recording, starts a run in the logbook and records run
parameters, otherwise uses run number 0. Puts run/monitor info in
phase1Info['beginrun'], advertises recording to the XPM, runs phase 1 via
condition_common and, outside simulator mode, clears readout and inserts BeginRun.
Returns:
| Type | Description |
|---|---|
bool
|
False if the experiment lookup, start_run, phase 1 or phase 2 replies fail, else True. |
condition_endrun ¶
condition_endrun()
Condition for the 'endrun' transition.
Ends the logbook run if recording, runs phase 1, then (outside simulator mode)
inserts EndRun and sets XPM recording to False before collecting phase-2 replies. On
success moves run_number to last_run_number if it is > 0.
Returns:
| Type | Description |
|---|---|
bool
|
False if phase 1 or phase 2 fails, else True. |
condition_beginstep ¶
condition_beginstep()
Condition for 'beginstep': phase 1 (30 s timeout), insert BeginStep (outside simulator mode), phase-2 replies.
Returns:
| Type | Description |
|---|---|
bool
|
False if phase 1 or phase 2 fails, else True. |
condition_endstep ¶
condition_endstep()
Condition for 'endstep': phase 1 (6 s timeout), insert EndStep (outside simulator mode), phase-2 replies.
Returns:
| Type | Description |
|---|---|
bool
|
False if phase 1 or phase 2 fails, else True. |
condition_slowupdate ¶
condition_slowupdate()
Condition for 'slowupdate': insert transition 0x80 | SlowUpdate (outside simulator mode).
The code comment says 0x80 means "throw away transition if there is deadtime".
Returns:
| Type | Description |
|---|---|
bool
|
Result of |
condition_connect ¶
condition_connect()
Condition for the 'connect' transition.
Outside simulator mode sets the XPM master (and common group if enabled). Then
publishes 'connect' with the active part of cmstate_levels() and waits up to 20 s
for replies without errors.
Returns:
| Type | Description |
|---|---|
bool
|
True on success. On an XPM failure the code calls |
condition_disconnect ¶
condition_disconnect()
Condition for 'disconnect': publish 'disconnect' and wait up to 30 s for error-free replies.
Returns:
| Type | Description |
|---|---|
bool
|
False if any client did not respond or replied with an error, else True. |
handle_getstate ¶
handle_getstate(body)
Return a message keyed by the current state with body cmstate_levels(); body is unused.
handle_chunkrequest ¶
handle_chunkrequest(body)
Trigger 'disable' then 'enable' if in 'running'.
Returns:
| Type | Description |
|---|---|
dict
|
'ok' message on success; the failing trigger's answer on error; an 'error' message if not in 'running'. |
handle_storejsonconfig ¶
handle_storejsonconfig(body)
Write body (as text) to the active detectors file unless it is '/dev/null', and return {}.
File errors are not caught.
handle_getinstrument ¶
handle_getinstrument(body)
Return an 'instrument' message with body {'instrument': ..., 'station': ...}.
handle_getblock ¶
handle_getblock(body)
Build an xtc block from body using the CyDgram object and return it hex-encoded.
Adds a detector from the 'detname', 'dettype', 'serial_number', 'namesid',
'alg_name', 'alg_version' and 'motors' fields, then calls getSelect with 'timestamp',
'transitionid', 'add_names' and 'add_shapes_data'. The dgram work is done in
psana.dgramCreate; not visible here.
Returns:
| Type | Description |
|---|---|
dict
|
'block' message whose body is the hex of the bytes after the first 12, or an
|
handle_selectplatform ¶
handle_selectplatform(body)
Update 'active', 'monitor' and drp/tpr readout groups in cmstate from body.
Only allowed in 'unallocated'. Attempts to clear a control-level active flag are reverted with a warning, and monitor-only entries produce a warning.
Returns:
| Type | Description |
|---|---|
dict
|
'ok' message, or an |
on_enter_reset ¶
on_enter_reset()
Clear cmstate and ids.
The transitions package calls a model method named on_enter_<state> when that
state is entered; that dispatch is not visible here.
subtract_clients ¶
subtract_clients(missing_set)
Remove 'cmstate_levels() from missing_set in place.
read_json_file ¶
read_json_file(filename)
Read a JSON file and return its contents.
Returns:
| Type | Description |
|---|---|
dict
|
Parsed JSON, or {} if the file is missing (a warning for '/dev/null', else an error), empty, or fails to parse (errors are reported). |
get_active_and_inactive ¶
get_active_and_inactive(d)
Split the entries under d['activedet'] into active and inactive '
Returns:
| Type | Description |
|---|---|
tuple of set
|
(active_set, inactive_set); a KeyError is logged and the partial sets returned. |
progressReport ¶
progressReport(begin_time, end_time, *, progress_txt)
Publish a progress message for progress_txt once at least 1 s has elapsed since begin_time.
condition_rollcall ¶
condition_rollcall()
Condition for the 'rollcall' transition.
Reads the active detectors file (unless bypassed), then repeatedly publishes
'rollcall' until all expected clients answer or rollcall_timeout expires, filling
cmstate and ids. Active flags and readout groups come from the file, history or
defaults; a 'control' entry is added if missing.
Returns:
| Type | Description |
|---|---|
bool
|
Always True; missing clients and duplicate aliases are only reported. |
check_for_dups ¶
check_for_dups()
Return the set of 'cmstate_levels().
filter_active_set ¶
filter_active_set(ids)
Return the subset of ids whose cmstate_levels() entry has 'active' equal to 1.
filter_active_dict ¶
filter_active_dict(oldstate)
Return a new level -> id dict with shallow copies of the entries whose 'active' is 1.
filter_level ¶
filter_level(prefix, ids)
Return the subset of ids found under levels whose name starts with prefix.
get_aliases ¶
get_aliases(id_list)
Return the aliases of the clients in id_list.
Entries without 'proc_info' are skipped; if 'alias' is missing,
'
report_error ¶
report_error(msg)
Log msg as an error and publish an error_msg on the front PUB socket.
report_warning ¶
report_warning(msg)
Log msg as a warning and publish a warning_msg on the front PUB socket.
start_run ¶
start_run(experiment_name)
Start a run in the logbook and return its number.
POSTs to 'runType to the default. In simulator mode returns the seconds since the EPICS epoch.
Returns:
| Type | Description |
|---|---|
int
|
The run number from |
Raises:
| Type | Description |
|---|---|
Exception
|
'start_run error' if the request fails or does not report success. |
add_run_params ¶
add_run_params(experiment_name, params)
POST params as JSON to '
Returns:
| Type | Description |
|---|---|
int
|
len(params) on success (or if |
add_update_run_param_descriptions ¶
add_update_run_param_descriptions(experiment_name, param_descs)
POST param_descs to '
Returns:
| Type | Description |
|---|---|
int
|
len(param_descs) on success (or if empty), else 0 after reporting an error. |
end_run ¶
end_run(experiment_name)
POST to '
Does nothing in simulator mode. Returns None.
get_last_run_number ¶
get_last_run_number()
Return the current run number of experiment_name from the logbook.
GETs '
Returns:
| Type | Description |
|---|---|
int
|
|
get_experiment ¶
get_experiment()
Return the active experiment name for this instrument and station.
GETs '.../lgbk/ws/activeexperiment_for_instrument_station' (URL with 'ws-auth'/
'ws-kerb' replaced by 'ws'). In simulator mode returns '
Returns:
| Type | Description |
|---|---|
str or None
|
|
condition_common ¶
condition_common(transition, timeout, body=None)
Run phase 1 of transition: publish it to the partition and wait for replies.
Any phase1Info[transition] is added to the body as 'phase1Info' and then removed.
Replies are awaited from active drp, teb and meb processes for timeout ms.
Returns:
| Type | Description |
|---|---|
bool
|
True if no replies are expected or all replied without errors, else False. |
condition_configure ¶
condition_configure()
Condition for the 'configure' transition.
Reads optional 'readout_count', 'step_group', 'seqpv_name'/'seqpv_val' and
'seqpv_done' from phase1Info['configure'] and fetches the trigger config from the
configdb (a dummy dict in simulator mode). Runs phase 1 with 'config_alias',
'trigger_config' and 'trigger_body', configures runParams and, outside simulator
mode, clears readout, inserts Configure, sets up steps and may start the step-done thread.
Returns:
| Type | Description |
|---|---|
bool
|
False if the configdb fetch, phase 1 or phase 2 fails, else True. |
condition_unconfigure ¶
condition_unconfigure()
Condition for 'unconfigure': clear phase1Info, unconfigure runParams, phase 1, insert Unconfigure, phase-2 replies.
The step_exit.set() call after return False is unreachable.
Returns:
| Type | Description |
|---|---|
bool
|
False if phase 1 or phase 2 fails, else True. |
set_slow_update_enabled ¶
set_slow_update_enabled(enabled)
Set slow_update_enabled and log whether slowupdate transitions are enabled.
condition_enable ¶
condition_enable()
Condition for the 'enable' transition.
Runs phase 1; outside simulator mode adds phase1Info['enable']['readout_count'] (if
0) to the cumulative StepEnd count and inserts Enable. After phase-2 replies it may issue one slow update (first Enable after BeginRun), then enables L0 and optionally puts 1 to
seqpv_name.
Returns:
| Type | Description |
|---|---|
bool
|
False if any step fails, else True. |
condition_disable ¶
condition_disable()
Condition for the 'disable' transition.
Outside simulator mode puts 0 to seqpv_name (if set) and disables L0 first; slow
updates are then disabled. Runs phase 1, inserts 0x180 | Disable (outside simulator
mode) and collects phase-2 replies.
Returns:
| Type | Description |
|---|---|
bool
|
False if any step fails, else True. |
condition_reset ¶
condition_reset()
Condition for the 'reset' transition.
Clears phase1Info, disables L0 if running (outside simulator mode), disables slow
updates, sets step_exit and publishes 'reset' to all clients.
Returns:
| Type | Description |
|---|---|
bool
|
Always True. |
slow_update_func ¶
slow_update_func()
Thread body: send 'slowupdate' requests to this manager's front REP port while enabled.
Uses its own REQ socket to localhost and runs at slow_update_rate Hz until
threads_exit is set.
fast_reply_func ¶
fast_reply_func()
Thread body: poll the fast REP socket and call service_fast until threads_exit is set.
It also creates a REP socket that is never used.
step_done_func ¶
step_done_func()
Thread body: publish a 'step' message when the StepDone PV reports done.
Creates a new ZMQ context (replacing self.context) and a PUB socket bound to
step_pub_port. Outside simulator mode it monitors the StepDone PV and, while
step_exit is not set, sends step_msg(1) each time the callback sets step_done
in 'running' or 'paused'. In simulator mode sub is never assigned, so sub.close()
raises NameError.
set2csv ¶
set2csv(seg_set)
Return the sorted elements of seg_set as a comma-separated string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
seg_set
|
iterable
|
Elements to join; each is formatted with an f-string. |
required |
Returns:
| Type | Description |
|---|---|
str
|
E.g. '0,1,3'; empty string for an empty input. |
detector_name ¶
detector_name(drp_alias)
Return drp_alias with its last '_' suffix removed (e.g. 'cam_1' -> 'cam').
segment_count ¶
segment_count(det_name, platform_dict, *, only_active=False)
Count drp entries in platform_dict whose alias maps to det_name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
det_name
|
str
|
Detector name compared with |
required |
platform_dict
|
dict
|
Dict with a 'drp' level mapping ids to entries with |
required |
only_active
|
bool
|
If True, count only entries whose 'active' value is 1. |
False
|
Returns:
| Type | Description |
|---|---|
int
|
The count; counting stops (keeping the partial count) at the first KeyError. |
timestampStr ¶
timestampStr()
Return the current UTC time as '%010d-%09d' % (sec, nsec) with seconds since the EPICS epoch.
get_readout_group_mask ¶
get_readout_group_mask(body)
Return a bitmask of the readout groups used by 'drp' and 'tpr' entries in body.
For each entry, bit node_info['det_info']['readout'] is set; entries without that
key are skipped.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
body
|
dict
|
Mapping of level name to {id: node_info}. |
required |
Returns:
| Type | Description |
|---|---|
int
|
The readout-group bitmask. |
wait_for_answers ¶
wait_for_answers(socket, wait_time, msg_id)
Wait and return all messages from socket that match msg_id
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
socket
|
|
required | |
wait_time
|
|
required | |
msg_id
|
|
required |
levels_to_activedet ¶
levels_to_activedet(src)
Convert a platform/cmstate dict to the active-detectors file layout.
The 'control' level is skipped. Each remaining entry is stored under its alias with its 'active' value and a copy of 'det_info' if present.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
src
|
dict
|
Mapping of level -> id -> entry with |
required |
Returns:
| Type | Description |
|---|---|
dict
|
|
main ¶
main()
Parse command-line arguments, configure SysLog logging and run a CollectionManager.
Outside simulator mode -x and -B are required (an error is printed and it returns if missing); in simulator mode they are ignored with a warning.