Skip to content
Snippets Groups Projects
Commit 771f81f0 authored by Carl Gwilliam's avatar Carl Gwilliam
Browse files

Update foresee generation to allow testing with new version. Old version default for now

parent 91798887
No related branches found
No related tags found
1 merge request!215Update foresee generation to allow testing with new version. Old version default for now
...@@ -4,8 +4,6 @@ import numpy as np ...@@ -4,8 +4,6 @@ import numpy as np
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import matplotlib import matplotlib
from foresee import Foresee, Model, Utility
class ForeseeGenerator(object): class ForeseeGenerator(object):
""" """
Generate LLP particles within FASER acceptance from FORESEE Generate LLP particles within FASER acceptance from FORESEE
...@@ -328,6 +326,11 @@ def setup_foresee(path): ...@@ -328,6 +326,11 @@ def setup_foresee(path):
return return
def add_to_python_path(path):
if path in sys.path: return
path = os.path.expandvars(os.path.expanduser(path))
os.sys.path.append(path)
return
def parse_couplings(data, write_hepMC = False): def parse_couplings(data, write_hepMC = False):
...@@ -364,6 +367,10 @@ if __name__ == "__main__": ...@@ -364,6 +367,10 @@ if __name__ == "__main__":
parser.add_argument("--nevents", "-n", default = 10, type = int, help = "Number of HepMC events ") parser.add_argument("--nevents", "-n", default = 10, type = int, help = "Number of HepMC events ")
args = parser.parse_args() args = parser.parse_args()
add_to_python_path(f"{args.path}/src")
from foresee import Foresee, Model, Utility
# Create PIDs # Create PIDs
if args.pid2 is None: if args.pid2 is None:
args.pid2 = -args.pid1 args.pid2 = -args.pid1
...@@ -373,7 +380,7 @@ if __name__ == "__main__": ...@@ -373,7 +380,7 @@ if __name__ == "__main__":
print(f"Generating {args.model} events at Ecom = {args.Ecom}") print(f"Generating {args.model} events at Ecom = {args.Ecom}")
print(f" mother mass = {args.mass} GeV") print(f" mother mass = {args.mass} GeV")
print(f" decay = {args.pid1} {args.pid2}") print(f" decay = {args.pid1} {args.pid2}")
print(f" couplings = {couplings}") print(f" couplings = {couplings}")
f = ForeseeGenerator(args.model, args.Ecom, args.mass, couplings, args.pid1, args.pid2, outdir = args.outdir, path = args.path) f = ForeseeGenerator(args.model, args.Ecom, args.mass, couplings, args.pid1, args.pid2, outdir = args.outdir, path = args.path)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment