-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathhit.smk
59 lines (54 loc) · 2 KB
/
hit.smk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
"""
Snakemake rules for processing hit tier. This is done in 4 steps:
- extraction of calibration curves(s) for each channel from cal data
- extraction of psd calibration parameters for each channel from cal data
- combining of all channels into single pars files with associated plot and results files
- running build hit over all channels using par file
"""
from legenddataflow.create_pars_keylist import ParsKeyResolve
from legenddataflow.pars_loading import ParsCatalog
from pathlib import Path
from legenddataflow.patterns import (
get_pattern_tier,
get_pattern_log,
get_pattern_pars_tmp,
)
from legenddataflow.execenv import execenv_pyexe
hit_par_catalog = ParsKeyResolve.get_par_catalog(
["-*-*-*-cal"],
get_pattern_tier(config, "raw", check_in_cycle=False),
{"cal": ["par_hit"], "lar": ["par_hit"]},
)
build_merge_rules("hit", lh5_merge=False)
rule build_hit:
input:
dsp_file=get_pattern_tier(config, "dsp", check_in_cycle=False),
pars_file=lambda wildcards: hit_par_catalog.get_par_file(
config, wildcards.timestamp, "hit"
),
output:
tier_file=get_pattern_tier(config, "hit", check_in_cycle=check_in_cycle),
params:
timestamp="{timestamp}",
datatype="{datatype}",
tier="hit",
ro_input=lambda _, input: {k: ro(v) for k, v in input.items()},
table_map=lambda wildcards: get_table_mapping(
channelmap_textdb, wildcards.timestamp, wildcards.datatype, "dsp"
),
log:
get_pattern_log(config, "tier_hit", time),
group:
"tier-hit"
resources:
runtime=300,
shell:
execenv_pyexe(config, "build-tier-hit") + f"--configs {ro(configs)} "
"--table-map '{params.table_map}' "
"--tier {params.tier} "
"--datatype {params.datatype} "
"--timestamp {params.timestamp} "
"--pars-file {params.ro_input[pars_file]} "
"--output {output.tier_file} "
"--input {params.ro_input[dsp_file]} "
"--log {log}"