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