Belle II Software
development
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 Nov 13 2024 02:41:08 for Belle II Software by
1.9.6