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