Belle II Software  release-06-01-15
CRYGenerationOnly.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 import basf2
13 from ROOT import Belle2
14 
15 # Set the global log level
16 basf2.set_log_level(basf2.LogLevel.INFO)
17 
18 # Set random seed
19 basf2.set_random_seed(888)
20 
21 main = basf2.create_path()
22 
23 main.add_module('EventInfoSetter',
24  evtNumList=[100], # we want to process 100 events
25  runList=[1], # from run number 1
26  expList=[0], # and experiment number 0
27  )
28 
29 # Register the CRY module
30 cry = main.add_module('CRYInput')
31 # acceptance half-lengths - at least one particle has to enter that box
32 # (without simulation, based on generator kinematics only!) to use that
33 # event. All values in cm
34 # 1 Parameter: sphere with the given radius around the origin
35 # 2 parameters: xy radius and z half-length of a cylinder along the z-axis
36 # 3 parameters: x, y and z half-lengths of a box at the origin.
37 cry.param('acceptance', [125, 125])
38 # How many trials to generate a cosmic per event?
39 cry.param('maxTrials', 100000)
40 # minimal kinetic energy in GeV - all particles below that energy are ignored
41 cry.param('kineticEnergyThreshold', 0.01)
42 
43 main.add_module('Progress')
44 main.add_module('RootOutput', outputFileName='./cry-outfile-test.root')
45 # uncomment the following line if you want event by event info
46 main.add_module("PrintMCParticles", logLevel=basf2.LogLevel.DEBUG, onlyPrimaries=False)
47 
48 # generate events
49 basf2.process(main)
50 
51 # show call statistics
52 print(basf2.statistics)