Belle II Software development
trainFeasibleTrackRelationFilter.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 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_FeasibleTrackRelationFilter.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 "feasible",
53 "filter(truth)",
54 ]
55
56 elif self.task == "eval":
57 varSets = [
58 "filter(feasible)",
59 "filter(truth)",
60 ]
61
62 elif self.task == "explore":
63 varSets = [
64 "basic",
65 "hit_gap",
66 "filter(truth)",
67 ]
68
69 else:
70 raise ValueError("Unknown task " + self.task)
71
72 path.add_module("TFCDC_TrackFinderSegmentPairAutomaton",
73 TrackRelationFilter="unionrecording",
74 TrackRelationFilterParameters={
75 "rootFileName": self.sample_file_name,
76 "varSets": varSets,
77 })
78
79 return path
80
81
82def main():
84 run.configure_and_execute_from_commandline()
85
86
87if __name__ == "__main__":
88 import logging
89 logging.basicConfig(stream=sys.stdout, level=logging.INFO, format='%(levelname)s:%(message)s')
90 main()
task
Process each event according to the user's desired task (train, eval, explore)
Definition: main.py:1