Belle II Software light-2601-hyperion
sampler.py
1#!/usr/bin/env python
2
3
10import argparse
11import basf2 as b2
12import modularAnalysis as ma
13from tflat.flavorTagger import flavorTagger
14
15
16def reconstructB2nunubar(path):
17 """
18 Defines the procedure to create a B0 list for the benchmark channel 'B0 -> nu_tau anti-nu_tau'
19 """
20 ma.fillParticleListFromMC('nu_tau:MC', '', path=path)
21 ma.reconstructMCDecay('B0:sig -> nu_tau:MC anti-nu_tau:MC', '', writeOut=True, path=path)
22
23
24def buildROE(path):
25 """
26 Creates the rest of event for the signal particle list.'
27 """
28 # perform MC matching (MC truth association).
29 ma.matchMCTruth(list_name='B0:sig', path=path)
30
31 # build the rest of the event associated to the B0
32 ma.buildRestOfEvent(target_list_name='B0:sig', path=path)
33
34
35if __name__ == '__main__':
36 '''
37 Samples a chunk of training data for TFlat
38 '''
39 parser = argparse.ArgumentParser(description='Sample TFlat')
40 parser.add_argument( # input parser
41 '--uniqueIdentifier',
42 metavar='uniqueIdentifier',
43 dest='uniqueIdentifier',
44 type=str,
45 default="TFlaT_MC16rd_light_2601_hyperion",
46 help='Name of both the config .yaml to be used and the produced weightfile'
47 )
48 args = parser.parse_args()
49 uniqueIdentifier = args.uniqueIdentifier
50
51 b2.set_log_level(b2.LogLevel.ERROR)
52 b2.conditions.prepend_globaltag(ma.getAnalysisGlobaltag())
53 path = b2.Path()
54
55 ma.inputMdstList(environmentType="default", filelist='', path=path)
56 reconstructB2nunubar(path)
57 buildROE(path)
58
60 'B0:sig',
61 mode='Sampler',
62 working_dir='',
63 uniqueIdentifier=uniqueIdentifier,
64 path=path)
65 ma.summaryOfLists(particleLists=['B0:sig'], path=path)
66 b2.process(path)
67 print(b2.statistics)