Belle II Software development
trainSegmentTrackFilter.py
1#!/usr/bin/env python3
2
3
10
11import os
12import sys
13import os.path
14
15
16from tracking.path_utils import add_cdc_track_finding
17from tracking.run.event_generation import ReadOrGenerateEventsRun
18from trackfindingcdc.run.training import TrainingRunMixin
19from tracking.adjustments import adjust_module
20
21
23 """Run to record segment track combinations encountered at the SegmentTrackSelector and retrain its mva method"""
24
25
26 n_events = 2000
27
28 generator_module = "generic"
29
30 bkg_files = os.path.join(os.environ["VO_BELLE2_SW_DIR"], "bkg")
31
32
33 truth = "truth"
34
35 @property
36 def identifier(self):
37 """Database identifier of the filter being trained"""
38 return "trackfindingcdc_SegmentTrackFilter.xml"
39
40 def create_path(self):
41 """Setup the recording path after the simulation"""
42 path = super().create_path()
43
44 add_cdc_track_finding(path)
45
46
47 if self.task == "train":
48 filterName = "recording"
49
50 elif self.task == "eval":
51 filterName = "eval"
52
53 self.truthtruth = "truth_accepted"
54
55 elif self.task == "explore":
56 # Change me.
57 filterName = "recording"
58
59 adjust_module(path, "TFCDC_SegmentTrackCombiner",
60 segmentTrackFilter=filterName,
61 segmentTrackFilterParameters={
62 "rootFileName": self.sample_file_name,
63 },
64 trackFilter="all",
65 trackFilterParameters={})
66
67 return path
68
69 def postprocess(self):
70 """Post-process the results for MC-truth acceptance"""
71 if self.task == "eval":
72 self.truthtruth = "truth_accept"
73 super().postprocess()
74
75
76def main():
78 run.configure_and_execute_from_commandline()
79
80
81if __name__ == "__main__":
82 import logging
83 logging.basicConfig(stream=sys.stdout, level=logging.INFO, format='%(levelname)s:%(message)s')
84 main()
task
Process each event according to the user's desired task (train, eval, explore)
Definition: main.py:1