Belle II Software  release-08-01-10
trainBackgroundClusterFilter.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 from tracking.run.event_generation import ReadOrGenerateEventsRun
17 from trackfindingcdc.run.training import TrainingRunMixin
18 
19 
21  """Run to record clusters encountered at the ClusterBackgroundDetector and retrain its mva method"""
22 
23 
24  n_events = 1000
25 
26  generator_module = "generic"
27 
28  bkg_files = os.path.join(os.environ["VO_BELLE2_SW_DIR"], "bkg")
29 
30  def create_path(self):
31  """Setup the recording path after the simulation"""
32  path = super().create_path()
33  path.add_module("TFCDC_WireHitPreparer",
34  flightTimeEstimation="outwards")
35 
36 
37  if self.tasktask == "train":
38  varSets = [
39  "basic",
40  "bkg_truth",
41  ]
42 
43  elif self.tasktask == "eval":
44  varSets = [
45  "filter(mva_bkg)",
46  "bkg_truth",
47  ]
48 
49  elif self.tasktask == "explore":
50  # Change me.
51  varSets = [
52  "basic",
53  "bkg_truth",
54  "filter(mva_bkg)",
55  ]
56 
57  path.add_module("TFCDC_ClusterPreparer",
58  ClusterFilter="unionrecording",
59  ClusterFilterParameters={
60  "rootFileName": self.sample_file_name,
61  "varSets": varSets,
62  })
63 
64  return path
65 
66 
67 def main():
69  run.configure_and_execute_from_commandline()
70 
71 
72 if __name__ == "__main__":
73  import logging
74  logging.basicConfig(stream=sys.stdout, level=logging.INFO, format='%(levelname)s:%(message)s')
75  main()
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