14import modularAnalysis
as ma
16from vertex
import treeFit, kFit
24 environmentType='default',
31 main = b2.create_path()
33 if not os.path.exists(working_dir)
and working_dir !=
'':
34 os.makedirs(working_dir)
36 ma.inputMdstList(environmentType=environmentType, filelist=file_names, path=main)
38 ma.fillParticleListFromMC(
'nu_tau:MC',
'', path=main)
39 ma.reconstructMCDecay(
'B0:sig -> nu_tau:MC anti-nu_tau:MC',
'', writeOut=
True, path=main)
41 ma.buildRestOfEvent(
'B0:sig', path=main)
43 DeepFlavorTagger(
'B0:sig', mode, working_dir, identifier, variable_list, target=target, overwrite=overwrite,
44 path=main, *args, **kwargs)
46 main.add_module(
'ProgressBar')
48 b2.process(main, max_events)
52def test_expert(working_dir, file_names, identifier, output_variable='networkOutput', environmentType='default',
54 main = b2.create_path()
56 ma.inputMdstList(file_names, environmentType=environmentType, path=main)
58 ma.fillParticleListFromMC(
'nu_tau:MC',
'', path=main)
59 ma.reconstructMCDecay(
'B0:sig -> nu_tau:MC anti-nu_tau:MC',
'', writeOut=
True, path=main)
61 ma.buildRestOfEvent(
'B0:sig', path=main)
63 DeepFlavorTagger(
'B0:sig',
'expert', working_dir, identifier, path=main)
66 output_variable_name =
''.join(
'extraInfo(', output_variable,
')')
68 ma.variablesToNtuple(
'B0:sig', [
'extraInfo(qrCombined)', output_variable_name],
69 filename=os.path.join(working_dir, identifier +
'_test_output.root'),
72 main.add_module(
'ProgressBar')
74 b2.process(main, max_events)
78def test_expert_jpsi(working_dir, file_names, prefix, environmentType='default', max_events=0):
79 main = b2.create_path()
81 ma.inputMdstList(file_names, environmentType=environmentType, path=main)
83 ma.fillParticleList(
'pi+:highPID',
'pionID >= .1', path=main)
84 ma.fillParticleList(
'mu+:highPID',
'muonID >= .1', path=main)
88 ma.reconstructDecay(
'K_S0:pipi -> pi+:highPID pi-:highPID',
'.25 <= M <= .75', path=main)
91 treeFit(
'K_S0:pipi', 0., path=main)
94 ma.reconstructDecay(
'J/psi:mumu -> mu+:highPID mu-:highPID',
'3.0 <= M <= 3.2 ', path=main)
97 treeFit(
'J/psi:mumu', 0., massConstraint=[
'J/psi'], path=main)
100 ma.reconstructDecay(
'B0:jpsiks -> J/psi:mumu K_S0:pipi',
'5.2 <= M <= 5.4', path=main)
103 kFit(
'B0:jpsiks', 0.,
'vertex', decay_string=
'B0 -> [J/psi -> ^mu+ ^mu-] K_S0', path=main)
106 ma.matchMCTruth(
'B0:jpsiks', path=main)
109 ma.buildRestOfEvent(
'B0:jpsiks', path=main)
110 ma.applyCuts(
'B0:jpsiks',
'isSignal > 0.5', path=main)
112 DeepFlavorTagger(
'B0:jpsiks',
'Expert', working_dir, prefix, transform_to_probability=
True, path=main)
113 ma.variablesToNtuple(
'B0:jpsiks', [
'extraInfo(qrCombined)',
'extraInfo(qrMC)',
'extraInfo(B0Probability)',
114 'extraInfo(BOProbabilityMC)'],
115 filename=os.path.join(working_dir,
'test_output.root'), path=main)
117 main.add_module(
'ProgressBar')
119 b2.process(main, max_events)