Belle II Software  release-05-01-25
gen_dimuon_detectoroutput.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 import basf2 as b2
5 from generators import add_kkmc_generator
6 from simulation import add_simulation
7 from reconstruction import add_reconstruction
8 from beamparameters import add_beamparameters
9 from rawdata import add_packers, add_raw_seqoutput
10 
11 b2.set_random_seed(5433)
12 
13 b2.use_central_database('production')
14 
15 # Show the Trigger cuts and their properties that are in the database
16 # from softwaretrigger import db_access
17 #
18 # B2RESULT("Currently, there are the following cuts in the global condition database:")
19 # for base_identifier, cut_identifier in db_access.get_all_cuts_in_database():
20 # B2RESULT(base_identifier + " " + cut_identifier)
21 # cut = db_access.download_cut_from_db(base_identifier, cut_identifier, False)
22 # B2RESULT("Cut condition: " + cut.decompile())
23 # B2RESULT("Cut is a reject cut: " + str(cut.isRejectCut()))
24 
25 main = b2.create_path()
26 
27 # specify number of events to be generated
28 eventinfosetter = b2.register_module('EventInfoSetter')
29 eventinfosetter.param('evtNumList', [100])
30 eventinfosetter.param('runList', [1])
31 eventinfosetter.param('expList', [1])
32 main.add_module(eventinfosetter)
33 
34 # set the BeamParameters for running at Y(4S)
35 beamparameters = add_beamparameters(main, "Y4S")
36 
37 add_kkmc_generator(main, 'mu-mu+')
38 
39 # Print out list of generated particles to check decay is correct
40 # printMCParticles(path=main)
41 
42 # detector simulation, digitisers and clusterisers
43 add_simulation(main)
44 
45 # reconstruction for HLT
46 add_reconstruction(main)
47 
48 # pack raw data
49 add_packers(main)
50 
51 # Check what is currently in the datastore before pruning for output
52 # printDataStore(path=main)
53 
54 # SROOT raw data output
55 
56 # If you want MC Truth Relations later
57 add_raw_seqoutput(main, 'raw.sroot', additionalObjects=['SoftwareTriggerResult', 'MCParticles'])
58 # add_raw_seqoutput(main, 'raw.sroot', additionalObjects=['SoftwareTriggerResult'])
59 
60 # Go!
61 b2.process(main)
62 
63 # Print call statistics
64 print(b2.statistics)