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