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