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