Belle II Software  release-06-02-00
vertexDisplacer.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 from basf2 import *
13 from simulation import add_simulation
14 from reconstruction import add_reconstruction, add_mdst_output
15 from ROOT import Belle2
16 import modularAnalysis as ma
17 
18 main = create_path()
19 
20 eventinfosetter = main.add_module("EventInfoSetter", evtNumList=[100], expList=[1003])
21 
22 # Generate decay with your favourite generator, using EvtGen as example
23 # the decay file should include the particle(s) to be displaced
24 dec_file = None
25 if len(sys.argv) > 1:
26  dec_file = os.path.abspath(sys.argv[1])
27  print("using following decay file: " + dec_file)
28 
29 main.add_module('EvtGenInput', ParentParticle='Upsilon(4S)', userDECFile=dec_file)
30 
31 # initialise the displacer module
32 displacer = register_module("GeneratedVertexDisplacer")
33 
34 # list of pdg values for particles to be displaced, here 100
35 displacer.param("pdgVal", (100))
36 
37 # list of lifetimes corresponding to the particles to be displaced, here c*tau = 10cm
38 displacer.param("lifetime", (10))
39 # pass the lifetime in units of [ns]: displacer.param("ctau", False)
40 
41 # specifying exponential decay option
42 displacer.param("lifetimeOption", "exponential")
43 
44 # add displacer module between generator and detector simulation
45 main.add_module(displacer)
46 
47 # print the MC particles for verification
48 ma.printMCParticles(onlyPrimaries=False, maxLevel=-1, path=main)
49 
50 # detector simulation
51 add_simulation(main)
52 
53 # reconstruction
54 add_reconstruction(main)
55 
56 # save to file
57 add_mdst_output(main, filename='displacerOut.root')
58 
59 process(main)