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