Belle II Software development
trainTrackFilter.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 tracks encountered at the TrackRejecter and retrain its mva method"""
24
25
26 n_events = 3000
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_TrackFilter.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 trackFilter=filterName,
61 trackFilterParameters={
62 "rootFileName": self.sample_file_name,
63 })
64
65 return path
66
67 def postprocess(self):
68 """Post-process the results for MC-truth acceptance"""
69 if self.task == "eval":
70 self.truthtruth = "truth_accept"
71 super().postprocess()
72
73
74def main():
76 run.configure_and_execute_from_commandline()
77
78
79if __name__ == "__main__":
80 import logging
81 logging.basicConfig(stream=sys.stdout, level=logging.INFO, format='%(levelname)s:%(message)s')
82 main()
truth
Modify degree of MC truth-matching.
task
Process each event according to the user's desired task (train, eval, explore)
str truth
degree of MC truth-matching
Definition: main.py:1