Belle II Software development
evaluateVXDTF2.py
1#!/usr/bin/env python3
2
3
10
11
20
21
22import basf2 as b2
23import sys
24import argparse
25# Import custom module chain for VXDTF2
26from setup_modules import setup_VXDTF2
27from tracking.harvesting_validation.combined_module import CombinedTrackingValidationModule
28
29# ---------------------------------------------------------------------------------------
30# Argument parser for input of trained Sector Map.
31arg_parser = argparse.ArgumentParser(description='VXDTF2 evaluation:\
32 Applies VXDTF2 to selected dataset \n\
33 Usage: basf2 testVXDTF2.py -i <inputFileName> -- --secmap <secmapFile>')
34
35arg_parser.add_argument('--secmap', '-s', type=str,
36 help='Inclusion of the root file containing the trained SecMap for the application of the VXDTF2.')
37
38arguments = arg_parser.parse_args(sys.argv[1:])
39sec_map_file = arguments.secmap
40
41
42# ---------------------------------------------------------------------------------------
43# Settings
44usePXD = False
45
46# these are the "default" settings
47setup_name = 'SVDOnlyDefault'
48if usePXD:
49 setup_name = 'SVDPXDDefault'
50
51performFit = False
52
53# Logging and Debug Levels
54b2.set_log_level(b2.LogLevel.ERROR)
55b2.log_to_file('logVXDTF2Evaluation.log', append=False)
56
57
58# ---------------------------------------------------------------------------------------
59path = b2.create_path()
60
61# Input
62rootInput = b2.register_module('RootInput')
63path.add_module(rootInput)
64
65# Event Info Module
66eventinfoprinter = b2.register_module('EventInfoPrinter')
67path.add_module(eventinfoprinter)
68
69# Gearbox
70gearbox = b2.register_module('Gearbox')
71path.add_module(gearbox)
72
73# puts gearbox and geometry into the path
74# Geometry
75geometry = b2.register_module('Geometry')
76geometry.param('components', ['BeamPipe',
77 'MagneticFieldConstant4LimitedRSVD',
78 'PXD',
79 'SVD'])
80path.add_module(geometry)
81
82# VXDTF2: Including actual VXDTF2 Modul Chain
83setup_VXDTF2(path=path,
84 use_pxd=usePXD,
85 sec_map_file=sec_map_file,
86 setup_name=setup_name,
87 overlap_filter='hopfield',
88 quality_estimator='circleFit')
89
90if performFit:
91 genFitExtrapolation = b2.register_module('SetupGenfitExtrapolation')
92 path.add_module(genFitExtrapolation)
93
94 fitter = b2.register_module('DAFRecoFitter')
95 path.add_module(fitter)
96 path.add_module('TrackCreator', pdgCodes=[211, 13, 321, 2212])
97
98# Matching
99mcTrackMatcherModule = b2.register_module('MCRecoTracksMatcher')
100mcTrackMatcherModule.param({
101 'UseCDCHits': False,
102 'UseSVDHits': True,
103 'UsePXDHits': usePXD,
104 'mcRecoTracksStoreArrayName': 'MCRecoTracks',
105 'MinimalPurity': .66,
106})
107path.add_module(mcTrackMatcherModule)
108
109# Evaluation of matching
110trackingValidationModule = CombinedTrackingValidationModule(
111 "",
112 contact="",
113 output_file_name="VXDTF2Validation.root",
114 expert_level=2)
115path.add_module(trackingValidationModule)
116
117path.add_module('Progress')
118b2.process(path)
119print(b2.statistics)