8 from modularAnalysis
import *
11 if __name__ ==
"__main__":
12 from basf2
import conditions
14 conditions.testing_payloads = [
15 'localdb/database.txt'
18 variables = [
'M',
'p',
'pt',
'pz',
'phi',
19 'daughter(0, p)',
'daughter(0, pz)',
'daughter(0, pt)',
'daughter(0, phi)',
20 'daughter(1, p)',
'daughter(1, pz)',
'daughter(1, pt)',
'daughter(1, phi)',
21 'daughter(2, p)',
'daughter(2, pz)',
'daughter(2, pt)',
'daughter(2, phi)',
22 'chiProb',
'dr',
'dz',
'dphi',
23 'daughter(0, dr)',
'daughter(1, dr)',
'daughter(0, dz)',
'daughter(1, dz)',
24 'daughter(0, dphi)',
'daughter(1, dphi)',
25 'daughter(0, chiProb)',
'daughter(1, chiProb)',
'daughter(2, chiProb)',
'daughter(2, M)',
26 'daughter(0, atcPIDBelle(3,2))',
'daughter(1, atcPIDBelle(3,2))',
27 'daughterAngle(0, 1)',
'daughterAngle(0, 2)',
'daughterAngle(1, 2)',
28 'daughter(2, daughter(0, E))',
'daughter(2, daughter(1, E))',
29 'daughter(2, daughter(0, clusterLAT))',
'daughter(2, daughter(1, clusterLAT))',
30 'daughter(2, daughter(0, clusterHighestE))',
'daughter(2, daughter(1, clusterHighestE))',
31 'daughter(2, daughter(0, clusterNHits))',
'daughter(2, daughter(1, clusterNHits))',
32 'daughter(2, daughter(0, clusterE9E25))',
'daughter(2, daughter(1, clusterE9E25))',
33 'daughter(2, daughter(0, minC2HDist))',
'daughter(2, daughter(1, minC2HDist))',
34 'daughterInvariantMass(1, 2)']
37 general_options = basf2_mva.GeneralOptions()
38 general_options.m_datafiles = basf2_mva.vector(
"train_mc.root")
39 general_options.m_identifier =
"MVAFull"
40 general_options.m_treename =
"tree"
41 general_options.m_variables = basf2_mva.vector(*variables)
42 general_options.m_target_variable =
"isSignal"
44 fastbdt_options = basf2_mva.FastBDTOptions()
47 fastbdt_options.m_nTrees = 100
48 fastbdt_options.m_randRatio = 1.0
49 basf2_mva.teacher(general_options, fastbdt_options)
51 general_options.m_identifier =
"MVAOrdinary"
52 general_options.m_variables = basf2_mva.vector(*variables[1:])
53 basf2_mva.teacher(general_options, fastbdt_options)
55 meta_options = basf2_mva.MetaOptions()
56 meta_options.m_use_splot =
True
57 meta_options.m_splot_variable =
"M"
62 general_options.m_datafiles = basf2_mva.vector(
"train_data.root")
63 meta_options.m_splot_mc_files = basf2_mva.vector(
"train_mc.root")
66 general_options.m_identifier =
"MVASPlot"
67 meta_options.m_splot_combined =
False
68 meta_options.m_splot_boosted =
False
69 basf2_mva.teacher(general_options, fastbdt_options, meta_options)
72 general_options.m_identifier =
"MVASPlotCombined"
73 meta_options.m_splot_combined =
True
74 meta_options.m_splot_boosted =
False
75 basf2_mva.teacher(general_options, fastbdt_options, meta_options)
78 general_options.m_identifier =
"MVASPlotBoosted"
79 meta_options.m_splot_combined =
False
80 meta_options.m_splot_boosted =
True
81 basf2_mva.teacher(general_options, fastbdt_options, meta_options)
84 general_options.m_identifier =
"MVASPlotCombinedBoosted"
85 meta_options.m_splot_combined =
True
86 meta_options.m_splot_boosted =
True
87 basf2_mva.teacher(general_options, fastbdt_options, meta_options)
90 pdf_options = basf2_mva.PDFOptions()
91 general_options.m_method =
'PDF'
92 general_options.m_identifier =
"MVAPdf"
93 general_options.m_variables = basf2_mva.vector(
'M')
94 basf2_mva.teacher(general_options, pdf_options)
97 basf2_mva.expert(basf2_mva.vector(
'MVAPdf',
'MVAFull',
'MVAOrdinary',
'MVASPlot',
98 'MVASPlotCombined',
'MVASPlotBoosted',
'MVASPlotCombinedBoosted'),
99 basf2_mva.vector(
'train.root'),
'tree',
'expert.root')
103 inputMdstList('MC6', ['/storage/jbod/tkeck/MC6/evtgen-charged/sub00/mdst_0001*.root'], path=path)
104 fillParticleLists([('K-', 'kaonID > 0.5'), ('pi+', 'pionID > 0.5')], path=path)
105 reconstructDecay('D0 -> K- pi+', '1.8 < M < 1.9', path=path)
106 KFit('D0', 0.1, path=path)
107 applyCuts('D0', '1.8 < M < 1.9', path=path)
108 matchMCTruth('D0', path=path)
110 path.add_module('MVAExpert', listNames=['D0'], extraInfoName='Pdf', identifier='MVAPdf')
111 path.add_module('MVAExpert', listNames=['D0'], extraInfoName='Full', identifier='MVAFull')
112 path.add_module('MVAExpert', listNames=['D0'], extraInfoName='Ordinary', identifier='MVAOrdinary')
113 path.add_module('MVAExpert', listNames=['D0'], extraInfoName='SPlot', identifier='MVASPlot')
114 path.add_module('MVAExpert', listNames=['D0'], extraInfoName='SPlotCombined', identifier='MVASPlotCombined')
115 path.add_module('MVAExpert', listNames=['D0'], extraInfoName='SPlotBoosted', identifier='MVASPlotBoosted')
116 path.add_module('MVAExpert', listNames=['D0'], extraInfoName='SPlotCombinedBoosted', identifier='MVASPlotCombinedBoosted')
117 variablesToNtuple('D0', ['isSignal', 'extraInfo(Pdf)', 'extraInfo(Full)', 'extraInfo(Ordinary)', 'extraInfo(SPlot)',
118 'extraInfo(SPlotCombined)', 'extraInfo(SPlotBoosted)', 'extraInfo(SPlotCombinedBoosted)'], path=path)