10Airflow script for TOP pre-tracking calibration:
14from prompt import CalibrationSettings, INPUT_DATA_FILTERS
15from caf.utils import IoV
16from caf.strategies import SequentialBoundaries
17from top_calibration import channel_mask_calibration
18from prompt.utils import filter_by_max_files_per_run
20## Required variable - tells the automated system some details of this script
21settings = CalibrationSettings(
22 name="TOP pre-tracking calibration",
23 expert_username=
"skohani",
25 input_data_formats=[
"raw"],
26 input_data_names=[
"hadron_calib"],
29 INPUT_DATA_FILTERS[
"Data Tag"][
"hadron_calib"],
30 INPUT_DATA_FILTERS[
"Run Type"][
"physics"],
31 INPUT_DATA_FILTERS[
"Data Quality Tag"][
"Good Or Recoverable"]]},
34 "max_files_per_run": 20,
35 "payload_boundaries":
None,
36 "request_memory":
"8 GB"
41def get_calibrations(input_data, **kwargs):
43 Returns a list of calibration objects.
44 :input_data (dict): Contains every file name from the
'input_data_names' as a key.
45 :**kwargs: Configuration options to be sent
in.
47 file_to_iov = input_data["hadron_calib"]
48 expert_config = kwargs.get(
"expert_config")
49 max_files_per_run = expert_config[
"max_files_per_run"]
50 min_events_per_file = 1
52 reduced_file_to_iov = filter_by_max_files_per_run(file_to_iov, max_files_per_run, min_events_per_file, random_select=
True)
53 inputFiles = list(reduced_file_to_iov.keys())
54 basf2.B2INFO(f
"Total number of files actually used as input = {len(inputFiles)}")
55 requested_iov = kwargs.get(
"requested_iov",
None)
56 output_iov = IoV(requested_iov.exp_low, requested_iov.run_low, -1, -1)
58 cal = [channel_mask_calibration(inputFiles)]
62 if c.strategies[0] == SequentialBoundaries:
65 payload_boundaries = [[output_iov.exp_low, output_iov.run_low]]
68 if expert_config[
"payload_boundaries"]
is not None:
69 payload_boundaries = expert_config[
"payload_boundaries"]
72 for alg
in c.algorithms:
73 alg.params = {
"iov_coverage": output_iov,
"payload_boundaries": payload_boundaries}
77 for alg
in c.algorithms:
78 alg.params = {
"iov_coverage": output_iov}