Belle II Software development
trainRealisticTrackRelationFilter.py
1#!/usr/bin/env python3
2
3
10
11import os
12import sys
13import os.path
14
15from tracking.run.event_generation import ReadOrGenerateEventsRun
16from trackfindingcdc.run.training import TrainingRunMixin
17
18
20 """Run to record track relations encountered at the TrackLinker after the feasible filter and retrain its mva method"""
21
22
23 n_events = 10000
24
25 generator_module = "generic"
26
27 bkg_files = os.path.join(os.environ["VO_BELLE2_SW_DIR"], "bkg")
28
29
30 truth = "truth_positive"
31
32 @property
33 def identifier(self):
34 """Database identifier of the filter being trained"""
35 return "trackfindingcdc_RealisticTrackRelationFilter.xml"
36
37 def create_path(self):
38 """Setup the recording path after the simulation"""
39 path = super().create_path()
40 path.add_module("TFCDC_WireHitPreparer",
41 flightTimeEstimation="outwards")
42
43 path.add_module('TFCDC_ClusterPreparer',
44 SuperClusterDegree=3,
45 SuperClusterExpandOverApogeeGap=True)
46
47 path.add_module("TFCDC_SegmentFinderFacetAutomaton")
48
49
50 if self.task == "train":
51 varSets = [
52 "realistic",
53 "filter(truth)",
54 ]
55 skim = "feasible"
56
57 elif self.task == "eval":
58 varSets = [
59 "filter(feasible)",
60 "filter(realistic)",
61 "filter(truth)",
62 ]
63 skim = ""
64
65 elif self.task == "explore":
66 varSets = [
67 "realistic",
68 "hit_gap",
69 "fit",
70 "filter(truth)",
71 ]
72 skim = "feasible"
73
74 else:
75 raise ValueError("Unknown task " + self.task)
76
77 path.add_module("TFCDC_TrackFinderSegmentPairAutomaton",
78 TrackRelationFilter="unionrecording",
79 TrackRelationFilterParameters={
80 "rootFileName": self.sample_file_name,
81 "varSets": varSets,
82 "skim": skim,
83 })
84
85 return path
86
87
88def main():
90 run.configure_and_execute_from_commandline()
91
92
93if __name__ == "__main__":
94 import logging
95 logging.basicConfig(stream=sys.stdout, level=logging.INFO, format='%(levelname)s:%(message)s')
96 main()
task
Process each event according to the user's desired task (train, eval, explore)
Definition: main.py:1