Belle II Software development
MonopolePair.py
1#!/usr/bin/env python3
2
3
10
11'''
12Example creating small sample of monopole anti-monopole pairs
13with given magnetic charge (in e+ units), electric charge and mass (in GeV/c^2)
14'''
15import basf2 as b2
16from simulation import add_simulation
17from reconstruction import add_reconstruction
18import pdg
19import sys
20
21if len(sys.argv) < 3:
22 print("Expected args: magCharge elCharge mass\
23 Using default: 1 0 4.5")
24 mag = 1
25 el = 0
26 mass = 4.5
27else:
28 mag = float(sys.argv[1])
29 el = float(sys.argv[2])
30 mass = float(sys.argv[3])
31
32num_events = 100
33
34main = b2.create_path()
35main.add_module("EventInfoSetter", expList=0, runList=1, evtNumList=num_events)
36
37pdg.add_particle('monopole', 99666, mass, 1.0, el, 0.0)
38pdg.add_particle('anti-monopole', -99666, mass, 1.0, -el, 0.0)
39# add_particle (name, pdgCode, mass, width, charge, spin, max_width=None, lifetime=0, pythiaID=0)
40
41# generate events
42pairgen = b2.register_module('PairGen')
43pairgen.param('pdgCode', 99666)
44pairgen.param('saveBoth', True)
45main.add_module(pairgen)
46
47# Phase 2 geometry
48gearbox = b2.register_module('Gearbox')
49gearbox.param('fileName', '/geometry/Beast2_phase2.xml')
50main.add_module(gearbox)
51
52geometry = b2.register_module('Geometry')
53main.add_module(geometry)
54
55# detector simulation
56g4sim = b2.register_module('FullSim')
57g4sim.param('RegisterMonopoles', True)
58g4sim.param('MonopoleMagCharge', mag)
59g4sim.param('trajectoryStore', 1)
60main.add_module(g4sim)
61
62add_simulation(main)
63add_reconstruction(main)
64
65# Save output of simulation
66output = b2.register_module('RootOutput') # Set output filename
67output.param('outputFileName', 'MonopolePair.root')
68main.add_module(output)
69
70b2.process(main)
71print(b2.statistics)
def add_particle(name, pdgCode, mass, width, charge, spin, max_width=None, lifetime=0, pythiaID=0, define_anti_particle=False)
Definition: pdg.py:135