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