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
20
class
BackgroundClusterFilterTrainingRun
(TrainingRunMixin,
ReadOrGenerateEventsRun
):
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.
task
task ==
"train"
:
38
varSets = [
39
"basic"
,
40
"bkg_truth"
,
41
]
42
43
elif
self.
task
task ==
"eval"
:
44
varSets = [
45
"filter(mva_bkg)"
,
46
"bkg_truth"
,
47
]
48
49
elif
self.
task
task ==
"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
():
68
run =
BackgroundClusterFilterTrainingRun
()
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
()
tracking.run.event_generation.ReadOrGenerateEventsRun
Definition:
event_generation.py:35
trainBackgroundClusterFilter.BackgroundClusterFilterTrainingRun
Definition:
trainBackgroundClusterFilter.py:20
trainBackgroundClusterFilter.BackgroundClusterFilterTrainingRun.create_path
def create_path(self)
Definition:
trainBackgroundClusterFilter.py:30
trainBackgroundClusterFilter.BackgroundClusterFilterTrainingRun.task
task
Process each event according to the user's desired task (train, eval, explore)
Definition:
trainBackgroundClusterFilter.py:37
main
Definition:
main.py:1
tracking.run.event_generation
Definition:
event_generation.py:1
main
int main(int argc, char **argv)
Run all tests.
Definition:
test_main.cc:91
tracking
trackFindingCDC
train
trainBackgroundClusterFilter.py
Generated on Mon Sep 23 2024 14:06:21 for Belle II Software by
1.9.1