36 fields = argv[i].split(
"=")
40 current.append(argv[i])
41 current.append(argv[i + 1])
44 elif len(fields) == 2:
46 current.append(argv[i])
50 raise RuntimeError(f
"Invalid argument: {argv[i]}")
62 if argv[i].startswith(
"--digi-smear-volume"):
64 blocks.append(current)
68 blocks.append(current)
75 argp = argparse.ArgumentParser()
77 "--digi-smear-volume", help=
"Sensitive volume identifiers", required=
True
80 "--digi-smear-indices",
81 help=
"Smear parameter indices for this volume",
86 help=
"Smear function types as 0 (gauss), 1 (truncated gauss), 2 (clipped gauss), 3 (uniform), 4 (digital)",
90 "--digi-smear-parameters",
91 help=
"Smear parameters depending on the smearing type, 1 parameter for simple gauss, 3 for all others (1 parameter, 2 range values)",
112 blocks.append(params[icur : icur + n])
118 top_data = {
"volume": int(args.digi_smear_volume),
"value": {
"smearing": []}}
120 indices = [int(x)
for x
in args.digi_smear_indices.split(
":")]
121 types = [int(x)
for x
in args.digi_smear_types.split(
":")]
122 params = [float(x)
for x
in args.digi_smear_parameters.split(
":")]
125 for i, t, ps
in zip(indices, types, param_blocks):
129 data[
"stddev"] = ps[0]
130 data[
"type"] =
"Gauss"
133 data[
"stddev"] = ps[0]
134 data[
"range"] = ps[1:]
135 data[
"type"] =
"GaussTrunc"
138 data[
"stddev"] = ps[0]
139 data[
"range"] = ps[1:]
140 data[
"type"] =
"GaussClipped"
142 data[
"type"] =
"Uniform" if t == 3
else "Digitial"
151 (high - low) / pitch,
156 raise RuntimeError(f
"Unrecognized type: {t}")
158 top_data[
"value"][
"smearing"].append(data)
165 "acts-geometry-hierarchy-map": {
167 "value-identifier":
"digitization-configuration",
177 if __name__ ==
"__main__":