Belle II Software
development
Toggle main menu visibility
Main Page
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
z
Variables
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
v
w
x
z
Typedefs
a
b
c
d
e
g
i
k
l
m
n
p
r
s
t
u
v
w
Enumerations
Enumerator
c
d
f
p
t
v
Classes
Class List
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Enumerations
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
Enumerator
a
b
c
d
e
f
g
h
k
l
m
n
o
p
r
s
t
u
v
w
z
Related Functions
b
c
d
g
i
o
r
s
t
Files
File List
File Members
All
Functions
Typedefs
Macros
train_K_L0_classifier.py
1
#!/usr/bin/env python3
2
3
10
11
import
sys
12
import
os
13
14
# USE THIS TO TRAIN AND UPLOAD A NEW CLASSIFIER FOR THE KLONG ID
15
# USE THE OTHER SCRIPT TO GENERATE DATA. THEN TRAIN AND UPLOAD WITH &THIS.
16
# only thing to set is the path were you have the data to train the classifier on.
17
18
try
:
19
data_path = sys.argv[1]
20
except
BaseException:
21
data_path =
"root_files/training/*.root"
22
try
:
23
identifier = sys.argv[2]
24
except
BaseException:
25
# the default name used in KLMExpert
26
identifier =
"KLM_fBDT_10xbkg100k.xml"
27
28
ex_b = 0
# experiment begin, 0 for all of them
29
ex_e = -1
# experiment end, -1 for all of them
30
run_b = 0
# run begin, 0 for all
31
run_e = -1
# run end, -1 for all of them
32
33
training_string = f
'basf2_mva_teacher --datafiles {data_path} --treename KLMdata --identifier {identifier} '
+ \
34
'--variable "KLMnLayer" "KLMnInnermostlayer" "KLMglobalZ" "KLMtime" "KLMdistToNextCl" '
+ \
35
'"KLMenergy" "KLMTrackSepDist" "KLMInitialtrackSepAngle" "KLMTrackRotationAngle" '
+ \
36
'"KLMTrackSepAngle" "KLMhitDepth" "KLMECLenergy" "KLMECLE9oE25" "KLMECLtiming" '
+ \
37
'"KLMECLmintrackDist" "KLMECLZMVA" "KLMECLZ40" "KLMECLZ51" --target_variable isSignal '
+ \
38
'--method FastBDT --nTrees 400 --nCutLevels 8 --nLevels 4'
39
40
os.system(training_string)
41
42
# "upload" to localdb
43
os.system(
44
f
"basf2_mva_add_to_local_database --weight_file_name {identifier} --db_identifier {identifier.split('.xml')[0]} "
+
45
f
"--begin_experiment {ex_b} --end_experiment {ex_e} --begin_run {run_b} --end_run {run_e}"
)
reconstruction
examples
klongID
train_K_L0_classifier.py
Generated on Wed Apr 9 2025 02:44:26 for Belle II Software by
1.9.6