Skip to content
Snippets Groups Projects
Commit 9f5b3263 authored by Dave Casper's avatar Dave Casper
Browse files

Merge branch 'fasernu04-mctzero' into 'FASERNU-04'

Implement axial timing in the currently used version of FORESEE

See merge request faser/calypso!369
parents 7ade25e0 955203cb
No related branches found
No related tags found
No related merge requests found
......@@ -148,7 +148,7 @@ if __name__ == '__main__':
#
if args.geom == "TI12MC":
# 2022 TI12 geometry
ConfigFlags.GeoModel.FaserVersion = "FASERNU-03" # Geometry set-up
ConfigFlags.GeoModel.FaserVersion = "FASERNU-04" # Geometry set-up
ConfigFlags.IOVDb.GlobalTag = "OFLCOND-FASER-03" # Conditions set-up
# TI12 detectors
detectors = ['Veto', 'VetoNu', 'Preshower', 'FaserSCT', 'Ecal',
......@@ -156,7 +156,7 @@ if __name__ == '__main__':
elif args.geom == "TestBeamMC":
# Define 2021 test beam geometry
ConfigFlags.GeoModel.FaserVersion = "FASER-TB00" # Geometry set-up
ConfigFlags.GeoModel.FaserVersion = "FASER-TB01" # Geometry set-up
ConfigFlags.IOVDb.GlobalTag = "OFLCOND-FASER-TB00" # Conditions set-up
# Testbeam detectors (trigger layers are actually veto counters)
detectors = ['Veto', 'Preshower', 'FaserSCT', 'Ecal']
......
......@@ -9,7 +9,7 @@ class ForeseeGenerator(object):
Generate LLP particles within FASER acceptance from FORESEE
"""
def __init__(self, modelname, energy, mass, couplings, daughter1_pid, daughter2_pid, outdir = None, path = '.', randomSeed = 12345, t0 = 0, notime = False, suffix = ""):
def __init__(self, modelname, energy, mass, couplings, daughter1_pid, daughter2_pid, outdir = None, path = '.', randomSeed = 12345, t0Shift = 0, zFront = -1.5, notime = False, suffix = ""):
self.modelname = modelname
self.energy = energy
......@@ -21,7 +21,8 @@ class ForeseeGenerator(object):
self.path = path
self.version = 3 # Forsee "version"
self.seed = randomSeed
self.t0 = t0
self.zfront = zFront
self.t0 = t0Shift + zFront
self.notime = notime
self.suffix = f"_{suffix}" if suffix else ""
self.nbinsample = 1
......@@ -447,7 +448,7 @@ class ForeseeGenerator(object):
filename = f"{self.outdir}/events_{self.energy}TeV_m{self.mass}GeV_c{self.couplings[0]:.1e}to_{self.daughter1_pid}_{self.daughter2_pid}{self.suffix}.hepmc"
_, weights, _ = self.foresee.write_events(self.mass, self.couplings[0], self.energy, filename, nevents, zfront = -1.5, seed = self.seed, decaychannels = [self.mode],
_, weights, _ = self.foresee.write_events(self.mass, self.couplings[0], self.energy, filename, nevents, zfront = self.zfront, seed = self.seed, decaychannels = [self.mode],
notime = self.notime, t0 = self.t0, nsample = self.nbinsample, return_data = True)
cfgname = f"{self.foresee.dirpath}/Models/{self.modelname}/" + filename.replace(".hepmc", ".cfg")
......@@ -538,7 +539,7 @@ def production(args):
for m in masses:
print(f">>> {nrun}: {data['model']} ({m} GeV) -> {data['pid1']} + {data['pid2']} with couplings = {couplings[0]:.2e} @ Ecom = {args.Ecom} TeV")
f = ForeseeGenerator(data["model"], args.Ecom, m, couplings, data["pid1"], data["pid2"], path = args.path, randomSeed = args.randomSeed, t0 = args.t0, notime = args.notime, suffix = data["name"])
f = ForeseeGenerator(data["model"], args.Ecom, m, couplings, data["pid1"], data["pid2"], path = args.path, randomSeed = args.randomSeed, t0Shift = args.t0, zFront = args.zfront, notime = args.notime, suffix = data["name"])
with open("events.txt", "a") as fout:
f.events(40, fout)
......@@ -591,6 +592,7 @@ if __name__ == "__main__":
parser.add_argument("--nevents", "-n", default = 10, type = int, help = "Number of HepMC events ")
parser.add_argument("--randomSeed", "-s", default = 1234, type = int, help = "Random seed for HepMC generation")
parser.add_argument("--t0", "-t", default = 0, type = int, help = "Time offset for start of decay volume")
parser.add_argument("--zfront", "-z", default = -1.5, help = "Minimum FASER z coordinate for decays (in meters)")
parser.add_argument("--notime", action = "store_true", help = "Set all vertex times to 0 rather than calculating from start of decay volume")
parser.add_argument("--suffix", default = "", help = "Filename suffix")
args = parser.parse_args()
......@@ -614,7 +616,7 @@ if __name__ == "__main__":
print(f" decay = {args.pid1} {args.pid2}")
print(f" couplings = {couplings}")
f = ForeseeGenerator(args.model, args.Ecom, args.mass, couplings, args.pid1, args.pid2, outdir = args.outdir, path = args.path, randomSeed = args.randomSeed, t0 = args.t0, notime = args.notime, suffix = args.suffix)
f = ForeseeGenerator(args.model, args.Ecom, args.mass, couplings, args.pid1, args.pid2, outdir = args.outdir, path = args.path, randomSeed = args.randomSeed, t0Shift = args.t0, zFront = args.zfront, notime = args.notime, suffix = args.suffix)
if args.hepmc:
f.write_hepmc(args.nevents)
......
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