Belle II Software
release-08-01-10
trainSegmentTrackFilter.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
17
from
tracking.path_utils
import
add_cdc_track_finding
18
from
tracking.run.event_generation
import
ReadOrGenerateEventsRun
19
from
trackfindingcdc.run.training
import
TrainingRunMixin
20
from
tracking.adjustments
import
adjust_module
21
22
23
class
SegmentTrackFilterTrainingRun
(TrainingRunMixin,
ReadOrGenerateEventsRun
):
24
"""Run to record segment track combinations encountered at the SegmentTrackSelector and retrain its mva method"""
25
26
27
n_events = 2000
28
29
generator_module =
"generic"
30
31
bkg_files = os.path.join(os.environ[
"VO_BELLE2_SW_DIR"
],
"bkg"
)
32
33
34
truth =
"truth"
35
36
@property
37
def
identifier
(self):
38
"""Database identifier of the filter being trained"""
39
return
"trackfindingcdc_SegmentTrackFilter.xml"
40
41
def
create_path
(self):
42
"""Setup the recording path after the simulation"""
43
path = super().
create_path
()
44
45
add_cdc_track_finding(path)
46
47
48
if
self.
task
task ==
"train"
:
49
filterName =
"recording"
50
51
elif
self.
task
task ==
"eval"
:
52
filterName =
"eval"
53
54
self.
truth
truth
truth =
"truth_accepted"
55
56
elif
self.
task
task ==
"explore"
:
57
# Change me.
58
filterName =
"recording"
59
60
adjust_module(path,
"TFCDC_SegmentTrackCombiner"
,
61
segmentTrackFilter=filterName,
62
segmentTrackFilterParameters={
63
"rootFileName"
: self.sample_file_name,
64
},
65
trackFilter=
"all"
,
66
trackFilterParameters={})
67
68
return
path
69
70
def
postprocess
(self):
71
"""Post-process the results for MC-truth acceptance"""
72
if
self.
task
task ==
"eval"
:
73
self.
truth
truth
truth =
"truth_accept"
74
super().
postprocess
()
75
76
77
def
main
():
78
run =
SegmentTrackFilterTrainingRun
()
79
run.configure_and_execute_from_commandline()
80
81
82
if
__name__ ==
"__main__"
:
83
import
logging
84
logging.basicConfig(stream=sys.stdout, level=logging.INFO, format=
'%(levelname)s:%(message)s'
)
85
main
()
tracking.run.event_generation.ReadOrGenerateEventsRun
Definition:
event_generation.py:35
trainSegmentTrackFilter.SegmentTrackFilterTrainingRun
Definition:
trainSegmentTrackFilter.py:23
trainSegmentTrackFilter.SegmentTrackFilterTrainingRun.truth
string truth
degree of MC truth-matching
Definition:
trainSegmentTrackFilter.py:34
trainSegmentTrackFilter.SegmentTrackFilterTrainingRun.create_path
def create_path(self)
Definition:
trainSegmentTrackFilter.py:41
trainSegmentTrackFilter.SegmentTrackFilterTrainingRun.truth
truth
modify degree of MC truth-matching
Definition:
trainSegmentTrackFilter.py:54
trainSegmentTrackFilter.SegmentTrackFilterTrainingRun.task
task
Process each event according to the user's desired task (train, eval, explore)
Definition:
trainSegmentTrackFilter.py:48
trainSegmentTrackFilter.SegmentTrackFilterTrainingRun.postprocess
def postprocess(self)
Definition:
trainSegmentTrackFilter.py:70
trainSegmentTrackFilter.SegmentTrackFilterTrainingRun.identifier
def identifier(self)
Definition:
trainSegmentTrackFilter.py:37
main
Definition:
main.py:1
tracking.adjustments
Definition:
adjustments.py:1
tracking.path_utils
Definition:
path_utils.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
trainSegmentTrackFilter.py
Generated on Mon Sep 23 2024 14:06:22 for Belle II Software by
1.9.1