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