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