Belle II Software development
SVDCrossTalkCalibrationsCAF.py
1
8
9
13
14import basf2 as b2
15
16import os
17import multiprocessing
18
19from ROOT import Belle2
20from ROOT.Belle2 import SVDCrossTalkCalibrationsAlgorithm
21
22from caf.framework import CAF, Calibration, CentralDatabase
23from caf import backends
24from caf import strategies
25
26import rawdata as raw
27
28
29b2.set_log_level(b2.LogLevel.INFO)
30input_branches = [
31 'RawSVDs'
32]
33
34
35def SVDCrossTalkCalibrations(files, tags):
36
37 # Set-up re-processing path
38 path = b2.create_path()
39
40 path.add_module('Progress')
41 path.add_module('RootInput', branchNames=input_branches)
42
43 path.add_module("Gearbox")
44 path.add_module("Geometry")
45
46 raw.add_unpackers(path, components=['SVD'])
47
48 collector = b2.register_module('SVDCrossTalkCalibrationsCollector')
49 algorithm = SVDCrossTalkCalibrationsAlgorithm("SVDCrossTalkCAF")
50
51 calibration = Calibration('SVDCrossTalk',
52 collector=collector,
53 algorithms=algorithm,
54 input_files=files,
55 pre_collector_path=path,
56 database_chain=[CentralDatabase(tag) for tag in tags],
57 output_patterns=None,
58 max_files_per_collector_job=-1,
59 backend_args=None
60 )
61
62 calibration.strategies = strategies.SequentialRunByRun
63
64 return calibration
65
66
67if __name__ == "__main__":
68 # input_files = [os.path.abspath(file) for file in [
69 # "/group/belle2/dataprod/Data/Raw/e0008/r01309/sub00/physics.0008.01309.HLT5.f00098.root"]]
70 input_files = [os.path.abspath(file) for file in Belle2.Environment.Instance()
71 .getInputFilesOverride()]
72
73 print(" ")
74 print("INPUT FILES")
75 print(" ")
76 print(input_files)
77 print(" ")
78
79 svdCrossTalkCAF = SVDCrossTalkCalibrations(input_files,
80 ['data_reprocessing_prompt',
81 'svd_basic', 'online'])
82
83 cal_fw = CAF()
84 cal_fw.add_calibration(svdCrossTalkCAF)
85 cal_fw.backend = backends.LSF()
86
87 # Try to guess if we are at KEKCC and change the backend to Local if not
88 if multiprocessing.cpu_count() < 10:
89 cal_fw.backend = backends.Local(8)
90
91 cal_fw.run()
static Environment & Instance()
Static method to get a reference to the Environment instance.
Definition: Environment.cc:28