Belle II Software development
SmartBKGEvtGen.py
1
8import basf2 as b2
9import generators as ge
10import simulation as si
11import reconstruction as re
12from skim.WGs.fei import feiHadronicB0
13import modularAnalysis as ma
14import mdst
15
16from smartBKG.b2modules.NN_filter_module import NNFilterModule
17
18num_events = 1000
19out_dir = "./"
20
21# create path
22main = b2.create_path()
23
24# default to early phase 3 (exp=1003), run 0
25main.add_module("EventInfoSetter", expList=1003, runList=0, evtNumList=num_events)
26
27# generate BBbar (or Continuum) events
28ge.add_evtgen_generator(path=main, finalstate='mixed')
29# ge.add_continuum_generator(path=main, finalstate='ccbar')
30
31# GAT prediction
32NNFilterModule_m = NNFilterModule(
33 extra_info_var='GAT_AfterGen'
34 )
35dead_path = b2.create_path()
36NNFilterModule_m.if_false(dead_path)
37main.add_module(NNFilterModule_m)
38
39# Create the mDST output file directly after EvtGen, can be used for training NN
41 path=main,
42 filename=f'{out_dir}AfterGen.root',
43 additionalBranches=["EventExtraInfo"]
44)
45
46# detector simulation
47si.add_simulation(path=main)
48
49# reconstruction
50re.add_reconstruction(path=main)
51
52# FEI skims from Leptonic WG
53fei_skim = feiHadronicB0(udstOutput=False, analysisGlobaltag=ma.getAnalysisGlobaltag())
54fei_skim(path=main)
55
56# Create the mDST output file after Skim
58 path=main,
59 filename=f'{out_dir}AfterFEI.root',
60 additionalBranches=["EventExtraInfo"]
61)
62
63b2.process(path=main)
64print(b2.statistics)
def add_mdst_output(path, mc=True, filename='mdst.root', additionalBranches=[], dataDescription=None)
Definition: mdst.py:38