if beam_input not in params.input_files: raise Exception("Missing '%s' input file." % beam_input) if wab_input not in params.input_files: raise Exception("Missing '%s' input file." % wab_input) if tri_input not in params.input_files: raise Exception("Missing '%s' input file." % tri_input) # get run params run_params = RunParameters(key=params.run_params) # calculate mu for tri sampling mu = func.mu(tri_input, run_params) # convert tri events to stdhep stdhep_tri = StdHepConverter(run_params=run_params, inputs=[tri_input], outputs=["tri.stdhep"]) # rotate tri events into beam coords rot_tri = StdHepTool(name="beam_coords", inputs=["tri.stdhep"], outputs=["tri_rot.stdhep"], args=["-z", str(params.z)]) # sample tris using poisson distribution sample_tri = StdHepTool(name="merge_poisson", inputs=["tri_rot.stdhep"], outputs=["tri_sampled"], args=["-m", str(mu), "-N", "1", "-n", "500000"]) # calculate mu for wab sampling
from hpsmc.generators import MG5, StdHepConverter from hpsmc.tools import BeamCoords, AddMother, SLIC job.description = 'tritrig from generation to slic' # Get job input file targets inputs = list(job.input_files.values()) if 'nevents' in job.params: nevents = job.params['nevents'] else: nevents = 10000 # Generate tritrig in MG5 mg = MG5(name='tritrig', event_types=['unweighted']) # Convert LHE output to stdhep cnv = StdHepConverter() # Add mother particle to tag trident particles mom = AddMother() # Rotate events into beam coords rot = BeamCoords() # Simulate signal events slic = SLIC(nevents=nevents+1) # run the job job.add([mg, cnv, mom, rot, slic])
if tritrig_file_name not in inputs: raise Exception("Missing required input file '%s'" % tritrig_file_name) if beam_file_name not in inputs: raise Exception("Missing required input file '%s'" % beam_file_name) # Base name of intermediate tritrig files tritrig_name = 'tritrig' # Base name of intermediate beam files beam_name = 'beam' # Base name of merged files tritrig_beam_name = 'tritrig-beam' # Convert LHE output to stdhep cnv = StdHepConverter(inputs=[tritrig_file_name], outputs=['%s.stdhep' % tritrig_name]) # Add mother particle to tag trident particles mom = AddMother(inputs=cnv.output_files(), outputs=['%s_mom.stdhep' % tritrig_name]) # Rotate events into beam coords rot = BeamCoords(inputs=mom.output_files(), outputs=['%s_rot.stdhep' % tritrig_name]) # Simulate signal events slic = SLIC(inputs=rot.output_files(), outputs=['%s.slcio' % tritrig_name]) # Space signal events before merging filter_bunches = FilterBunches(inputs=slic.output_files(), outputs=['%s_filt.slcio' % tritrig_name])
from hpsmc.generators import MG5, StdHepConverter from hpsmc.job import Job from hpsmc.run_params import RunParameters mg5 = MG5(description="Generate tritrig events using MG5", name="tritrig", run_card="run_card_1pt05.dat", outputs=["tritrig"], nevents=1000) stdhep_cnv = StdHepConverter( description="Convert LHE events to StdHep using EGS5", run_params=RunParameters(key="1pt05"), inputs=["tritrig_events.lhe.gz"], outputs=["tritrig.stdhep"]) job = Job(name="MG5 test", components=[mg5, stdhep_cnv]) job.params = {} job.run()
mg = MG5( name=procname, #run_card="run_card_"+params.run_params+".dat", run_card="run_card.dat", param_card="param_card.dat", params={ "map": params.map, "mpid": params.mpid, "mrhod": params.mrhod }, outputs=[procname], nevents=params.nevents) # convert LHE output to stdhep stdhep_cnv = StdHepConverter(run_params=RunParameters(key=params.run_params), inputs=[procname + "_unweighted_events.lhe.gz"], outputs=[procname + ".stdhep"]) # rotate events into beam coords rot = StdHepTool(name="beam_coords", inputs=[procname + ".stdhep"], outputs=[procname + "_rot.stdhep"]) # print out rotated simp events dump = StdHepTool(name="print_stdhep", inputs=[procname + "_rot.stdhep"]) # generate events in slic slic = SLIC(detector=params.detector, inputs=[procname + "_rot.stdhep"], outputs=[procname + ".slcio"], nevents=params.nevents,
job.description = 'rad from generation to slic' # Get job input file targets inputs = list(job.input_files.values()) if 'nevents' in job.params: nevents = job.params['nevents'] else: nevents = 10000 # Generate rad in MG5 mg = MG5(name='RAD', event_types=['unweighted']) # Convert LHE output to stdhep cnv = StdHepConverter(name="lhe_rad", inputs=mg.output_files()) # Unzip the LHE events to a local file unzip = Unzip(inputs=mg.output_files(), outputs=["rad.lhe"]) # Add mother particle to tag trident particles mom = AddMotherFullTruth( inputs=[cnv.output_files()[0], unzip.output_files()[0]], outputs=["rad_mom.stdhep"]) # Rotate events into beam coords rot = BeamCoords(inputs=mom.output_files(), outputs=["rad_rot.stdhep"]) # Simulate signal events slic = SLIC(nevents=nevents + 1,
if beam_input not in params.input_files: raise Exception("Missing expected beam file '%s' in input files." % beam_input) if wab_input not in params.input_files: raise Exception("Missing expected WAB file '%s' in input files." % wab_input) # get run params run_params = RunParameters(key=params['run_params']) # calculate mu for wab sampling mu = func.mu(wab_input, run_params) # convert wab events to stdhep stdhep_cnv = StdHepConverter(run_params=run_params, inputs=[wab_input], outputs=["wab.stdhep"]) # rotate wab events into beam coords rot_wab = StdHepTool(name="beam_coords", inputs=["wab.stdhep"], outputs=["wab_rot.stdhep"], args=["-z", str(params['z'])]) # sample wabs using poisson distribution sample_wab = StdHepTool( name="merge_poisson", inputs=["wab_rot.stdhep"], outputs=["wab_sampled"], args=["-m", str(mu), "-N", "1", "-n", str(params['nevents'])])
from hpsmc.generators import MG5, StdHepConverter from hpsmc.tools import Unzip, AddMotherFullTruth, BeamCoords job.description = 'Generate tritrig events using MadGraph5 and convert to StdHep using EGS5' # Generate tritrig in MG5 mg = MG5(name='tritrig') # Unzip the LHE events to a local file unzip = Unzip(inputs=mg.output_files(), outputs=["tritrig.lhe"]) # Convert LHE output to stdhep cnv = StdHepConverter(inputs=mg.output_files(), outputs=['tritrig.stdhep']) # Add mother particle to tag trident particles mom = AddMotherFullTruth( inputs=[cnv.output_files()[0], unzip.output_files()[0]], outputs=['tritrig_mom.stdhep']) # Rotate events into beam coords rot = BeamCoords() # run the job job.add([mg, unzip, cnv, mom, rot])