Belle II Software  release-05-02-19
trainBackgroundClusterFilter.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 import os
5 import sys
6 import os.path
7 
8 from tracking.run.event_generation import ReadOrGenerateEventsRun
9 from trackfindingcdc.run.training import TrainingRunMixin
10 
11 
13  """Run to record clusters encountered at the ClusterBackgroundDetector and retrain its mva method"""
14 
15 
16  n_events = 1000
17 
18  generator_module = "generic"
19 
20  bkg_files = os.path.join(os.environ["VO_BELLE2_SW_DIR"], "bkg")
21 
22  def create_path(self):
23  """Setup the recording path after the simulation"""
24  path = super().create_path()
25  path.add_module("TFCDC_WireHitPreparer",
26  flightTimeEstimation="outwards")
27 
28 
29  if self.task == "train":
30  varSets = [
31  "basic",
32  "bkg_truth",
33  ]
34 
35  elif self.task == "eval":
36  varSets = [
37  "filter(mva_bkg)",
38  "bkg_truth",
39  ]
40 
41  elif self.task == "explore":
42  # Change me.
43  varSets = [
44  "basic",
45  "bkg_truth",
46  "filter(mva_bkg)",
47  ]
48 
49  path.add_module("TFCDC_ClusterPreparer",
50  ClusterFilter="unionrecording",
51  ClusterFilterParameters={
52  "rootFileName": self.sample_file_name,
53  "varSets": varSets,
54  })
55 
56  return path
57 
58 
59 def main():
61  run.configure_and_execute_from_commandline()
62 
63 
64 if __name__ == "__main__":
65  import logging
66  logging.basicConfig(stream=sys.stdout, level=logging.INFO, format='%(levelname)s:%(message)s')
67  main()
trainBackgroundClusterFilter.BackgroundClusterFilterTrainingRun
Definition: trainBackgroundClusterFilter.py:12
tracking.run.event_generation.ReadOrGenerateEventsRun
Definition: event_generation.py:26
main
int main(int argc, char **argv)
Run all tests.
Definition: test_main.cc:77
trainBackgroundClusterFilter.BackgroundClusterFilterTrainingRun.task
task
Process each event according to the user's desired task (train, eval, explore)
Definition: trainBackgroundClusterFilter.py:29
tracking.run.event_generation
Definition: event_generation.py:1
trainBackgroundClusterFilter.BackgroundClusterFilterTrainingRun.create_path
def create_path(self)
Definition: trainBackgroundClusterFilter.py:22