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