DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
timinglibs.hsi_app_confgen Namespace Reference

Functions

 generate (PARTITION="hsi_readout_test", RUN_NUMBER=333, CONNECTIONS_FILE="${TIMING_SHARE}/config/etc/connections.xml", READOUT_PERIOD=1e3, HSI_DEVICE_NAME="BOREAS_FMC", int TTCM_S1=1, int TTCM_S2=2, UHAL_LOG_LEVEL="notice", OUTPUT_PATH=".")
 
 cli (partition, run_number, connections_file, readout_period, hsi_device_name, ttcm_s1, ttcm_s2, uhal_log_level, output_path, json_file)
 

Variables

 default_load_path
 
 CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
 

Function Documentation

◆ cli()

timinglibs.hsi_app_confgen.cli ( partition,
run_number,
connections_file,
readout_period,
hsi_device_name,
ttcm_s1,
ttcm_s2,
uhal_log_level,
output_path,
json_file )
  JSON_FILE: Input raw data file.
  JSON_FILE: Output json configuration file.

Definition at line 150 of file hsi_app_confgen.py.

150 def cli(partition, run_number, connections_file, readout_period, hsi_device_name, ttcm_s1, ttcm_s2, uhal_log_level, output_path, json_file):
151 """
152 JSON_FILE: Input raw data file.
153 JSON_FILE: Output json configuration file.
154 """
155
156 with open(json_file, 'w') as f:
157 f.write(generate(
158 PARTITION=partition,
159 RUN_NUMBER = run_number,
160 CONNECTIONS_FILE=connections_file,
161 READOUT_PERIOD = readout_period,
162 HSI_DEVICE_NAME = hsi_device_name,
163 TTCM_S1 = ttcm_s1,
164 TTCM_S2 = ttcm_s2,
165 UHAL_LOG_LEVEL = uhal_log_level,
166 OUTPUT_PATH = output_path,
167 ))
168
169 print(f"'{json_file}' generation completed.")
170

◆ generate()

timinglibs.hsi_app_confgen.generate ( PARTITION = "hsi_readout_test",
RUN_NUMBER = 333,
CONNECTIONS_FILE = "${TIMING_SHARE}/config/etc/connections.xml",
READOUT_PERIOD = 1e3,
HSI_DEVICE_NAME = "BOREAS_FMC",
int TTCM_S1 = 1,
int TTCM_S2 = 2,
UHAL_LOG_LEVEL = "notice",
OUTPUT_PATH = "." )

Definition at line 31 of file hsi_app_confgen.py.

41 ):
42
43 # network connection
44 nw_specs = [nwmgr.Connection(name=PARTITION + ".hsievent",topics=[], address="tcp://127.0.0.1:12344")]
45
46 # Define modules and queues
47 queue_bare_specs = [
48 app.QueueSpec(inst="trigger_candidate_q", kind='FollySPSCQueue', capacity=2000),
49
50 ]
51
52 # Only needed to reproduce the same order as when using jsonnet
53 queue_specs = app.QueueSpecs(sorted(queue_bare_specs, key=lambda x: x.inst))
54
55 mod_specs = [
56 mspec("hsi", "HSIReadout", []),
57
58 mspec("ttcm", "TimingTriggerCandidateMaker", [
59 app.QueueInfo(name="output", inst="trigger_candidate_q", dir="output"),
60 ]),
61 ]
62
63 init_specs = app.Init(queues=queue_specs, modules=mod_specs, nwconnections=nw_specs)
64
65 jstr = json.dumps(init_specs.pod(), indent=4, sort_keys=True)
66 print(jstr)
67
68 initcmd = rcif.RCCommand(
69 id=cmdlib.CmdId("init"),
70 entry_state="NONE",
71 exit_state="INITIAL",
72 data=init_specs
73 )
74
75 mods = [
76 ("hsi", hsi.ConfParams(
77 connections_file=CONNECTIONS_FILE,
78 readout_period=READOUT_PERIOD,
79 hsi_device_name=HSI_DEVICE_NAME,
80 uhal_log_level=UHAL_LOG_LEVEL,
81 hsievent_connection_name = f"{PARTITION}.hsievent",
82 )),
83
84 ("ttcm", ttcm.Conf(
85 s1=ttcm.map_t(signal_type=TTCM_S1,
86 time_before=100000,
87 time_after=200000),
88 s2=ttcm.map_t(signal_type=TTCM_S2,
89 time_before=100000,
90 time_after=200000),
91 hsievent_connection_name = PARTITION+".hsievent",
92 )),
93 ]
94
95 confcmd = mrccmd("conf", "INITIAL", "CONFIGURED", mods)
96
97 jstr = json.dumps(confcmd.pod(), indent=4, sort_keys=True)
98 print(jstr)
99
100 startpars = rcif.StartParams(run=1, disable_data_storage=False)
101
102 startcmd = mrccmd("start", "CONFIGURED", "RUNNING", [
103 ("hsi", None),
104 ("ttcm", startpars),
105 ])
106
107 jstr = json.dumps(startcmd.pod(), indent=4, sort_keys=True)
108 print("="*80+"\nStart\n\n", jstr)
109
110 stopcmd = mrccmd("stop", "RUNNING", "CONFIGURED", [
111 ("hsi", None),
112 ("ttcm", None),
113 ])
114
115 jstr = json.dumps(stopcmd.pod(), indent=4, sort_keys=True)
116 print("="*80+"\nStop\n\n", jstr)
117
118
119 scrapcmd = mcmd("scrap", [
120 ("", None)
121 ])
122
123 jstr = json.dumps(scrapcmd.pod(), indent=4, sort_keys=True)
124 print("="*80+"\nScrap\n\n", jstr)
125
126 # Create a list of commands
127 cmd_seq = [initcmd, confcmd, startcmd, stopcmd]
128
129 # Print them as json (to be improved/moved out)
130 jstr = json.dumps([c.pod() for c in cmd_seq], indent=4, sort_keys=True)
131 return jstr
132

Variable Documentation

◆ CONTEXT_SETTINGS

timinglibs.hsi_app_confgen.CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])

Definition at line 135 of file hsi_app_confgen.py.

◆ default_load_path

timinglibs.hsi_app_confgen.default_load_path

Definition at line 4 of file hsi_app_confgen.py.