Belle II Software development
AsicBackgroundLibraryGenerator.py
1
8
9import basf2
10import sys
11import rawdata
12import tracking
13
14"""
15 Sample script to generate ASIC cross-talk library. Usage:
16
17 basf2 AsicBackgroundLibraryGenerator.py <cosmic_raw_data_file> <output_asicbg_root_file> <data_type>
18
19 cosmic_raw_data_file : input raw data files
20
21 output_asicbg_root_file: output root files
22
23 data_type: 'mc' or 'data'
24 """
25
26
27def main():
28
29 GT = ['patch_main_release-07'][0]
30 basf2.B2WARNING(f'Current global tag is {GT}, please update the proper global tag to match the data')
31 basf2.conditions.prepend_globaltag(GT)
32 path = basf2.create_path()
33 path.add_module("Progress")
34
35 if len(sys.argv) != 4:
36 sys.exit("Three arguments are required: input_root, output_root, and data_type")
37 # Input raw data file
38 inputFilename = sys.argv[1]
39 # Output file
40 file_name = sys.argv[2]
41 # data or mc
42 sample_name = sys.argv[3]
43 print(inputFilename, '\n', file_name, '\n', sample_name)
44
45 cdc_type = {'data': 'RawCDCs', 'mc': 'CDCHits'}
46 branches = ['EventMetaData', cdc_type[f'{sample_name}']]
47 path.add_module("RootInput", inputFileNames=inputFilename, branchNames=branches)
48 path.add_module("Gearbox")
49 path.add_module("Geometry", useDB=True)
50
51 if sample_name == 'data':
52 rawdata.add_unpackers(path, components=['CDC'])
53
54 tracking.add_track_finding(path, components=['CDC'])
55
56 path.add_module("AsicBackgroundLibraryCreator",
57 inputTracks="CDCTrackVector",
58 inputWireHits="CDCWireHitVector",
59 AsicLibraryFileName=file_name,
60 # maximalDistanceSignal=100.2,
61 # minimalDistanceBackground=0.0,
62 # useAxialHitsOnly=False,
63 # minimalHitsOnTrack=0,
64 writeExtraVars=True
65 )
66
67 basf2.print_path(path)
68
69 # Run the execution path
70 basf2.process(path)
71
72 print(basf2.statistics)
73
74
75if __name__ == "__main__":
76 main()
Definition: main.py:1
def add_unpackers(path, components=None, writeKLMDigitRaws=False, addTOPRelations=False)
Definition: rawdata.py:67
def add_track_finding(path, components=None, reco_tracks="RecoTracks", prune_temporary_tracks=True, use_second_cdc_hits=False, use_mc_truth=False, svd_ckf_mode="SVD_after", add_both_directions=True, svd_standalone_mode="VXDTF2", use_svd_to_cdc_ckf=True, use_ecl_to_cdc_ckf=False, add_cdcTrack_QI=True, add_vxdTrack_QI=False, pxd_filtering_offline=False, use_HLT_ROIs=False, create_intercepts_for_pxd_ckf=False)
Definition: __init__.py:443