Belle II Software
release-08-01-10
trainRealisticSegmentPairRelationFilter.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
RealisticSegmentPairRelationFilterTrainingRun
(TrainingRunMixin,
ReadOrGenerateEventsRun
):
21
"""Run to record segment pair relations encountered at the SegmentPairRelationCreator and retrain its mva method"""
22
23
24
n_events = 10000
25
26
generator_module =
"generic"
27
28
bkg_files = os.path.join(os.environ[
"VO_BELLE2_SW_DIR"
],
"bkg"
)
29
30
31
truth =
"truth_positive"
32
33
@property
34
def
identifier
(self):
35
"""Database identifier of the filter being trained"""
36
return
"trackfindingcdc_RealisticSegmentPairRelationFilter.xml"
37
38
def
create_path
(self):
39
"""Setup the recording path after the simulation"""
40
path = super().
create_path
()
41
path.add_module(
"TFCDC_WireHitPreparer"
,
42
flightTimeEstimation=
"outwards"
)
43
44
path.add_module(
'TFCDC_ClusterPreparer'
,
45
SuperClusterDegree=3,
46
SuperClusterExpandOverApogeeGap=
True
)
47
48
path.add_module(
"TFCDC_SegmentFinderFacetAutomaton"
)
49
50
51
if
self.
task
task ==
"train"
:
52
varSets = [
53
"realistic"
,
54
"filter(truth)"
,
55
"truth"
,
56
]
57
58
elif
self.
task
task ==
"eval"
:
59
varSets = [
60
"filter(simple)"
,
61
"filter(realistic)"
,
62
"filter(truth)"
,
63
]
64
65
elif
self.
task
task ==
"explore"
:
66
varSets = [
67
"basic"
,
68
"fit"
,
69
"filter(simple)"
,
70
"filter(truth)"
,
71
]
72
73
else
:
74
raise
ValueError(
"Unknown task "
+ self.
task
task)
75
76
path.add_module(
"TFCDC_TrackFinderSegmentPairAutomaton"
,
77
SegmentPairRelationFilter=
"unionrecording"
,
78
SegmentPairRelationFilterParameters={
79
"rootFileName"
: self.sample_file_name,
80
"varSets"
: varSets,
81
})
82
83
return
path
84
85
86
def
main
():
87
run =
RealisticSegmentPairRelationFilterTrainingRun
()
88
run.configure_and_execute_from_commandline()
89
90
91
if
__name__ ==
"__main__"
:
92
import
logging
93
logging.basicConfig(stream=sys.stdout, level=logging.INFO, format=
'%(levelname)s:%(message)s'
)
94
main
()
tracking.run.event_generation.ReadOrGenerateEventsRun
Definition:
event_generation.py:35
trainRealisticSegmentPairRelationFilter.RealisticSegmentPairRelationFilterTrainingRun
Definition:
trainRealisticSegmentPairRelationFilter.py:20
trainRealisticSegmentPairRelationFilter.RealisticSegmentPairRelationFilterTrainingRun.create_path
def create_path(self)
Definition:
trainRealisticSegmentPairRelationFilter.py:38
trainRealisticSegmentPairRelationFilter.RealisticSegmentPairRelationFilterTrainingRun.task
task
Process each event according to the user's desired task (train, eval, explore)
Definition:
trainRealisticSegmentPairRelationFilter.py:51
trainRealisticSegmentPairRelationFilter.RealisticSegmentPairRelationFilterTrainingRun.identifier
def identifier(self)
Definition:
trainRealisticSegmentPairRelationFilter.py:34
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
trainRealisticSegmentPairRelationFilter.py
Generated on Mon Sep 23 2024 14:06:21 for Belle II Software by
1.9.1