Belle II Software  release-08-01-10
first_data_analysis_script.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 import os
13 
14 import basf2
15 import rawdata
16 
17 from tracking import add_track_finding, add_track_fit_and_track_creator
18 from tracking.harvesting_validation import recorded_data_module
19 from tracking.path_utils import add_hit_preparation_modules
20 
21 
22 def get_output_file_name(file_name):
23  input_file_names = os.environ["FILE_NAMES"].split()
24  assert len(input_file_names) == 1
25  input_file_name = input_file_names[0]
26  input_file_name = os.path.splitext(os.path.basename(input_file_name))[0]
27 
28  return input_file_name + "_" + file_name
29 
30 
31 if __name__ == "__main__":
32  basf2.conditions.override_globaltags([os.environ["BASF2_GDT"]])
33 
34  path = basf2.create_path()
35 
36  input_file_names = os.environ["FILE_NAMES"].split()
37  print(f"Using input files {input_file_names}")
38 
39  path.add_module("RootInput", inputFileNames=input_file_names)
40 
41  path.add_module("Gearbox")
42  path.add_module("Geometry", useDB=True)
43 
45 
46  add_hit_preparation_modules(path)
47  path.add_module('SetupGenfitExtrapolation', energyLossBrems=False, noiseBrems=False)
48 
49  add_track_finding(path, svd_ckf_mode="VXDTF2_before_with_second_ckf", prune_temporary_tracks=False)
50 
51  add_track_fit_and_track_creator(path)
52 
53  # Resetting MinClusterTime parameter to turn of cut on cluster time
54  for m in path.modules():
55  if m.name() == "SVDSpacePointCreator":
56  m.param("MinClusterTime", -999)
57 
58  path.add_module("RootOutput", outputFileName=get_output_file_name("reconstructed.root"))
59 
60  path.add_module(recorded_data_module.TrackInfoHarvester(output_file_name=get_output_file_name('trackLevelInformation.root')))
61  path.add_module(recorded_data_module.HitInfoHarvester(output_file_name=get_output_file_name('hitLevelInformation.root')))
62  path.add_module(recorded_data_module.EventInfoHarvester(output_file_name=get_output_file_name('eventLevelInformation.root')))
63 
64  basf2.print_path(path)
65  basf2.process(path)
66  print(basf2.statistics)
def add_unpackers(path, components=None, writeKLMDigitRaws=False, addTOPRelations=False)
Definition: rawdata.py:67