12import modularAnalysis
as ma
14from b2biiConversion
import convertBelleMdstToBelleIIMdst
18def reconstructMCB2nunubar(path):
20 Defines the procedure to create a B0 list for the benchmark channel 'B0 -> nu_tau anti-nu_tau'
22 ma.fillParticleListFromMC(
'nu_tau:MC',
'', path=path)
23 ma.reconstructMCDecay(
'B0:sig -> nu_tau:MC anti-nu_tau:MC',
'', writeOut=
True, path=path)
26 ma.matchMCTruth(list_name=
'B0:sig', path=path)
29def reconstructB2jpsiks(path, is_belle=False):
31 Defines the procedure to create a B0 list for the benchmark channel 'B0 -> Jpsi KS'
33 ma.fillParticleList(
'mu+:all', cut=
'', path=path)
34 ma.reconstructDecay(
'J/psi:mumu -> mu+:all mu-:all', cut=
'abs(dM) < 0.11', path=path)
35 ma.matchMCTruth(
'J/psi:mumu', path=path)
38 ma.matchMCTruth(
'K_S0:mdst', path=path)
39 ma.reconstructDecay(
'B0:sig -> J/psi:mumu K_S0:mdst', cut=
'Mbc > 5.25 and abs(deltaE) < 0.15', path=path)
41 ma.fillParticleList(
'pi+:all', cut=
'', path=path)
42 ma.reconstructDecay(
'K_S0:pipi -> pi+:all pi-:all', cut=
'abs(dM) < 0.25', path=path)
43 ma.matchMCTruth(
'K_S0:pipi', path=path)
44 ma.reconstructDecay(
'B0:sig -> J/psi:mumu K_S0:pipi', cut=
'Mbc > 5.25 and abs(deltaE) < 0.15', path=path)
47 ma.matchMCTruth(list_name=
'B0:sig', path=path)
50 ma.applyCuts(list_name=
'B0:sig', cut=
'[isSignal == 1]', path=path)
53def main(uniqueIdentifier, inputfile='', working_dir='', is_belle=False, sampler_id=0, channel='nunu'):
55 Samples a chunk of training data for TFlat
58 b2.set_log_level(b2.LogLevel.ERROR)
62 b2.conditions.prepend_globaltag(ma.getAnalysisGlobaltag())
63 ma.inputMdstList(environmentType=
"default", filelist=
'', path=path)
66 os.environ[
'USE_GRAND_REPROCESS_DATA'] =
'1'
67 os.environ[
'PGUSER'] =
'g0db'
70 convertBelleMdstToBelleIIMdst(
71 inputBelleMDSTFile=inputfile,
74 generatorLevelMCMatching=
False,
77 ma.setAnalysisConfigParams({
'mcMatchingVersion':
'Belle'}, path=path)
78 b2.conditions.prepend_globaltag(ma.getAnalysisGlobaltagB2BII())
81 reconstructMCB2nunubar(path)
82 elif channel ==
'jpsiks':
83 reconstructB2jpsiks(path, is_belle)
85 raise ValueError(
"Unknown sampler channel!")
88 ma.buildRestOfEvent(target_list_name=
'B0:sig', path=path)
93 working_dir=working_dir,
94 uniqueIdentifier=uniqueIdentifier,
95 sampler_id=sampler_id,
97 ma.summaryOfLists(particleLists=[
'B0:sig'], path=path)
102if __name__ ==
'__main__':
104 Samples a chunk of training data for TFlat
106 parser = argparse.ArgumentParser(description=
'Sample TFlat')
108 '--uniqueIdentifier',
109 metavar=
'uniqueIdentifier',
110 dest=
'uniqueIdentifier',
112 default=
"TFlaT_MC16rd_light_2601_hyperion",
113 help=
'Name of both the config .yaml to be used and the produced weightfile'
121 help=
'Inputfile to sample'
125 metavar=
'working_dir',
137 help=
'Indicate if Belle or Belle II files are to be processed'
141 metavar=
'sampler_id',
153 help=
'Sampler channel: nunu or jpsiks'
156 args = parser.parse_args()
157 uniqueIdentifier = args.uniqueIdentifier
158 inputfile = args.inputfile
159 working_dir = args.working_dir
160 is_belle = args.BELLE
161 sampler_id = args.sampler_id
162 channel = args.channel
164 main(uniqueIdentifier, inputfile, working_dir, is_belle, sampler_id, channel)