This repository was archived by the owner on May 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdark_brem.py
More file actions
103 lines (82 loc) · 2.96 KB
/
Copy pathdark_brem.py
File metadata and controls
103 lines (82 loc) · 2.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
"""Configuration module for dark brem simulation"""
class DarkBremModel() :
"""Storage for parameters of a dark brem model
All other models should inherit from this class
in order to keep the correct internal parameters.
Parameters
----------
name : str
Name of this dark brem model
"""
def __init__(self,name) :
self.name = name
def __str__(self) :
string = '%s {'%self.name
for key in self.__dict__ :
if key is not self.name :
string += ' %s=%s'%( key , self.__dict__[key] )
string += ' }'
return string
class VertexLibraryModel(DarkBremModel) :
"""Configuration for the vertex library dark brem model
Parameters
----------
library_path : str
Path to directory of LHE files containing dark brem vertices
Attributes
----------
method : str
Interpretation method for LHE files
threshold : float
Minimum energy [GeV] that electron should have for dark brem to have nonzero xsec
epsilon : float
Epsilon for dark brem xsec calculation
"""
def __init__(self, library_path) :
super().__init__('vertex_library')
self.library_path = library_path
self.method = 'forward_only'
self.threshold = 2.0 #GeV
self.epsilon = 0.01
class DarkBrem:
"""Storage for parameters of dark brem process
Attributes
----------
ap_mass : float
Mass of A' in MeV
enable : bool
Should we use the custom Geant4 dark brem process? (Default: No)
only_one_per_event : bool
Should we deactivate the process after one dark brem or allow for more than one? (Default: No)
cache_xsec : bool
Should we cache the xsec's computed from the model? (Default: yes)
model : DarkBremModel
The model that should be use for dark bremming
"""
def __init__(self) :
self.ap_mass = 0.
self.only_one_per_event = False
self.enable = False #off by default
self.cache_xsec = True
self.model = DarkBremModel('UNDEFINED')
def activate(self, ap_mass, model) :
"""Activate the dark brem process with the input A' mass [MeV] and dark brem model"""
self.enable = True
self.ap_mass = ap_mass
if not isinstance(model,DarkBremModel) :
raise Exception('Dark brem process needs to be configured with an associated model.')
self.model = model
def __str__(self):
"""Stringify the DarkBrem configuration
Returns
-------
str
A human-readable version of all its attributes
"""
string = "{ Enabled: %r"%self.enable
if self.enable :
string += ", Mass: %.1f MeV"%self.ap_mass
string += ", Only One Per Event: %r"%self.only_one_per_event
string += ", Model: %s"%self.model
string += " }"
return string