From 6335d9de8a9bf72ebab6f25c6ac9ba5d68c0e63e Mon Sep 17 00:00:00 2001 From: amanmdesai Date: Wed, 12 Jul 2023 22:49:23 +0530 Subject: [PATCH 1/2] update --- pymcabc/cross_section.py | 4 ++-- pymcabc/identify_process.py | 28 +++++++++++++++++++++------- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/pymcabc/cross_section.py b/pymcabc/cross_section.py index aa107d6..d93b4f2 100644 --- a/pymcabc/cross_section.py +++ b/pymcabc/cross_section.py @@ -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 @@ -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) diff --git a/pymcabc/identify_process.py b/pymcabc/identify_process.py index 0f8e5ee..1af53d6 100644 --- a/pymcabc/identify_process.py +++ b/pymcabc/identify_process.py @@ -88,7 +88,7 @@ def __init__( self.masses() self.identify_mediator() self.identify_decay() - self.ECM() + self._ECM() self.final_momenta() self.bw() @@ -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) @@ -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, @@ -169,7 +178,8 @@ def ECM(self): "Energy CM : ", Ecm, ) return E1, E2, Ecm - + + def identify_mediator(self): """identify the mediator of the process""" @@ -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) From c2274c201579a1b94684525e00d3cbecd326b403 Mon Sep 17 00:00:00 2001 From: amanmdesai Date: Thu, 13 Jul 2023 10:39:01 +0530 Subject: [PATCH 2/2] update setup --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 1521c65..5b8daa7 100644 --- a/setup.py +++ b/setup.py @@ -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="amanmukeshdesai@gmail.com",