Belle II Software prerelease-11-00-00a
testTOPBackSplashTimingfullmc.py
1#!/usr/bin/env python3
2
3
10
11# ---------------------------------------------------------------------------------
12# Example steering script that generates B0B0bar events with BGx1 overlay
13# and applies the TOPBackSplashTiming module
14# ---------------------------------------------------------------------------------
15
16import basf2 as b2
17import simulation as si
18import reconstruction as re
19from generators import add_evtgen_generator
20import mdst
21import glob
22import argparse
23
24parser = argparse.ArgumentParser(description="Generates BB events and save TOP timing fits to neutral clusters")
25parser.add_argument('--saveFits', action='store_true', default=False, help='Flag to save plots of RooFits')
26parser.add_argument('--minClusterE', type=float, default=0.5, help='Minimum (incl.) clusterE to be considered for timing')
27parser.add_argument('--minNphotons', type=int, default=2, help='Minimum (incl.) no. of Cherenkov photons for fit')
28parser.add_argument('--minClusterNHits', type=float, default=1, help='Minimum (incl.) no. of crystals in cluster required')
29parser.add_argument('--includeSlotsWithTracks', action='store_true', default=False, help='Flag to save plots of RooFits')
30parser.add_argument('--saveMoreFitParams', action='store_true', default=False,
31 help='Development flag to save more RooFit params (e.g. RooFit errors, fit params)')
32
33args = parser.parse_args()
34
35# bg = glob.glob('/group/belle2/dataprod/BGOverlay/run2/prerelease-08-00-00a/new_overlay/BGx1/set2/BGforOverlay-6*.root')
36bg = glob.glob('/group/belle2/dataprod/BGOverlay/run2/prerelease-08-00-00a/new_overlay/BGx1/set?/*.root')
37
38path = b2.create_path()
39
40path.add_module("EventInfoSetter", evtNumList=1000, expList=1004)
41path.add_module("EventInfoPrinter")
42
43# EvtGen
44add_evtgen_generator(path=path, finalstate='mixed')
45
46# detector and L1 trigger simulation and reco
47si.add_simulation(path=path, bkgfiles=bg)
48re.add_reconstruction(path=path)
49
50# call module and plot timing fits
51path.add_module("TOPBackSplashTiming",
52 saveFits=args.saveFits,
53 minClusterE=args.minClusterE,
54 minNphotons=args.minNphotons,
55 minClusterNHits=args.minClusterNHits,
56 includeSlotsWithTracks=args.includeSlotsWithTracks,
57 saveMoreFitParams=args.saveMoreFitParams,
58 )
59
60# Save mdst with timing, no. of fitted photons and chi-2/dof
61mdst.add_mdst_output(path, mc=True, additionalBranches=['TOPBackSplashFitResults'])
62
63# run
64path.add_module("Progress")
65
66
67# generate events
68b2.process(path, calculateStatistics=True)
69
70# show call statistics
71print(b2.statistics)
add_mdst_output(path, mc=True, filename='mdst.root', additionalBranches=[], dataDescription=None)
Definition mdst.py:37