Skip to content

Commit

Permalink
Merge pull request #14 from amanmdesai/update-ecm-print
Browse files Browse the repository at this point in the history
update
  • Loading branch information
amanmdesai authored Jul 13, 2023
2 parents 5449528 + c2274c2 commit 851f74e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 10 deletions.
4 changes: 2 additions & 2 deletions pymcabc/cross_section.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def xsection(self, w_max):
w_max = w_i
return w_i, w_max

def integrate_xsec(self, N=20000):
def integrate_xsec(self, N=40000):
w_sum = 0
w_max = 0
w_square = 0
Expand All @@ -140,7 +140,7 @@ def integrate_xsec(self, N=20000):
json.dump(library, f)
return None

def calc_xsection(self, N: int = 20000):
def calc_xsection(self, N: int = 40000):
self.integrate_xsec(N)
with open("library.json", "r") as f:
library = json.load(f)
Expand Down
28 changes: 21 additions & 7 deletions pymcabc/identify_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def __init__(
self.masses()
self.identify_mediator()
self.identify_decay()
self.ECM()
self._ECM()
self.final_momenta()
self.bw()

Expand Down Expand Up @@ -147,7 +147,7 @@ def masses(self):
json.dump(self.library, f)
return None

def ECM(self):
def _ECM(self):
#center of mass energy
with open("library.json", "r") as f:
library = json.load(f)
Expand All @@ -156,10 +156,19 @@ def ECM(self):
E1 = math.sqrt(m1**2 + self.p_i**2)
E2 = math.sqrt(m2**2 + self.p_i**2)
Ecm = E1 + E2
if len(self.library["Ecm"]) == 0:
self.library["Ecm"].append(Ecm)
self.library["Ecm"].append(Ecm)
with open("library.json", "w") as f:
json.dump(self.library, f)
return E1, E2, Ecm

def ECM(self):
with open("library.json", "r") as f:
library = json.load(f)
m1 = library["m1"][0]
m2 = library["m2"][0]
E1 = math.sqrt(m1**2 + self.p_i**2)
E2 = math.sqrt(m2**2 + self.p_i**2)
Ecm = E1 + E2
print(
"\n",
"Energy Beam 1 : ", E1,
Expand All @@ -169,7 +178,8 @@ def ECM(self):
"Energy CM : ", Ecm,
)
return E1, E2, Ecm




def identify_mediator(self):
"""identify the mediator of the process"""
Expand Down Expand Up @@ -212,8 +222,12 @@ def final_momenta(self):
json.dump(self.library, f)

def bw(self):
deno = 8*math.pi*(self.library["mx"][0])**2
self.library["bw"].append((pymcabc.constants.g**2*self.library["outgoing_p"][0])/deno)
if self.library["mx"][0] > 0:
deno = 8*math.pi*(self.library["mx"][0])**2
_bw = (pymcabc.constants.g**2*self.library["outgoing_p"][0])/deno
else:
_bw = 0.0
self.library["bw"].append(_bw)
with open("library.json", "w") as f:
json.dump(self.library, f)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="pymcabc",
version="0.7.0",
version="0.8.0",
description="Monte Carlo Event Generator for the ABC theory",
author="Aman Desai",
author_email="[email protected]",
Expand Down

0 comments on commit 851f74e

Please sign in to comment.