outputs=["wab-beam-tri.slcio"], nevents=params.nevents, ignore_returncode=True) # run simulated events in readout to generate triggers readout = JobManager( description="Run the readout simulation to create triggers", steering_resource=params.readout_steering, java_args=["-DdisableSvtAlignmentConstants"], run=params.run, detector=params.detector, inputs=["wab-beam-tri.slcio"], outputs=["wab-beam-tri_readout"]) # run physics reconstruction recon = JobManager(description="Run the MC recon", steering_resource=params.recon_steering, java_args=["-DdisableSvtAlignmentConstants"], run=params.run, detector=params.detector, inputs=["wab-beam-tri_readout.slcio"], outputs=["wab-beam-tri_recon"]) # run the job job.components = [ stdhep_tri, rot_tri, sample_tri, stdhep_wab, rot_wab, sample_wab, rot_beam, sample_beam, merge, slic, readout, recon ] job.run()
inputs=[procname + ".slcio"], outputs=[procname + "_filt.slcio"], ecal_hit_ecut=0.05, enable_ecal_energy_filter=True, nevents=2000000, event_interval=250) # run simulated events in readout to generate triggers readout = JobManager(steering_resource=params.readout_steering, java_args=["-DdisableSvtAlignmentConstants"], run=params.run, detector=params.detector, inputs=[procname + "_filt.slcio"], outputs=[procname + "_readout"]) # run physics reconstruction recon = JobManager(steering_resource=params.recon_steering, java_args=["-DdisableSvtAlignmentConstants"], defs={ "detector": params.detector, "run": params.run }, inputs=[procname + "_readout.slcio"], outputs=[procname + "_recon"]) # run the job job.components = [ mg, stdhep_cnv, rot, dump, slic, filter_bunches, readout, recon ] job.run()
""" If no output file mapping is provided explicitly, then an auto-naming scheme is used which concatenates the start and end file numbers onto the base name of the first input file. """ if not len(job.params.output_files): output_basename,start_filenum = split_file_number(job.params.input_files[input_files[0]]) dontcare,end_filenum = split_file_number(job.params.input_files[input_files[-1]]) print output_basename print start_filenum print end_filenum try: int(start_filenum) except: raise Exception("Start file number '%s' has bad format." % start_filenum) try: int(end_filenum) except: raise Exception("End file number '%s' has bad format." % end_filenum) output_src = output_basename + "_" + start_filenum + "-" + end_filenum + ".slcio" job.params.output_files[output_src] = output_src else: output_src = job.params.output_files.keys()[0] concat = LCIOConcat(inputs=input_files, outputs=[output_src]) job.components = [concat] job.run()
#!/usr/bin/env python from hpsmc.job import Job from hpsmc.generators import EGS5 from hpsmc.run_params import RunParameters # default params with 1.05 GeV beam params and 500 bunches of electrons default_params = {"run_params": "1pt05", "bunches": 500} job = Job(name="EGS5 beam_v5 job") job.set_default_params(default_params) job.initialize() params = job.params # generates a file called 'beam.stdhep' egs5 = EGS5(name="beam_v5", bunches=params['bunches'], run_params=RunParameters(key=params['run_params']), outputs=["beam.stdhep"]) job.components = [egs5] job.run()
outputs=["wab-beam_filter.slcio"], event_interval=0, enable_ecal_energy_filter=False, args=["-a"]) # merge the files together merge = LCIOTool(name="merge", args=[ "-f", "tritrig_filter.slcio", "-f", "wab-beam_filter.slcio", "-o", "merged.slcio" ]) # run simulated events in readout to generate triggers readout = JobManager(steering_resource=params.readout_steering, java_args=["-DdisableSvtAlignmentConstants"], run=params.run, detector=params.detector, inputs=["merged.slcio"], outputs=["readout"]) # run physics reconstruction recon = JobManager(steering_resource=params.recon_steering, java_args=["-DdisableSvtAlignmentConstants"], run=params.run, detector=params.detector, inputs=["readout.slcio"], outputs=["tritrig-wab-beam"]) job.components = [filter_tritrig, filter_wab, merge, readout, recon] job.run()
# unzip the LHE events to local file unzip = Unzip(inputs=[filename + "_events.lhe.gz"]) # displace the time of decay using ctau param displ = StdHepTool(name="lhe_tridents_displacetime", inputs=[filename + "_events.lhe"], outputs=[filename + ".stdhep"], args=["-l", str(params['ctau'])]) # rotate events into beam coordinates and move vertex by 5 mm rot = StdHepTool(name="beam_coords", inputs=[filename + ".stdhep"], outputs=[filename + "_rot.stdhep"], args=["-z", str(params['z'])]) # print rotated AP events dump = StdHepTool(name="print_stdhep", inputs=[filename + "_rot.stdhep"]) # define job components job.components = [ap, unzip, displ, rot, dump] # move final StdHep file to user-defined output file name if output_files is set in JSON params if len(params.output_files): mv = MoveFiles(inputs=[filename + "_rot.stdhep"], outputs=[params.output_files.keys()[0]]) job.components.append(mv) # run the job job.run()
#!/usr/bin/env python import os from hpsmc.job import Job from hpsmc.tools import LCIOCount job = Job(name="LCIO count job") job.initialize() output_files = sorted(job.params.output_files.keys()) if len(output_files) < 1: raise Exception( "Not enough output files were provided (at least 1 required).") nevents = job.params.nevents count = LCIOCount(minevents=nevents, inputs=output_files) job.components = [count] job.enable_copy_output_files = False job.run()
params = job.params input_files = params.input_files simp_files = [] for input_file in input_files: simp_files.append(input_file) procname = "simp" # insert empty bunches expected by pile-up simulation filter_bunches = FilterMCBunches(java_args=["-DdisableSvtAlignmentConstants"], inputs=simp_files, outputs=[procname + "_filt.slcio"], ecal_hit_ecut=0.05, enable_ecal_energy_filter=True, nevents=2000000, event_interval=250) # run simulated events in readout to generate triggers readout = JobManager(steering_resource=params.readout_steering, java_args=["-DdisableSvtAlignmentConstants"], run=params.run, detector=params.detector, inputs=[procname + "_filt.slcio"], outputs=[procname + "_readout"]) # run the job job.components = [filter_bunches, readout] job.run()
# 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'])]) # rotate beam background events into beam coordinates rot_beam = StdHepTool(name="beam_coords", inputs=["beam.stdhep"], outputs=["beam_rot.stdhep"], args=["-z", str(params['z'])]) # sample beam background events sample_beam = StdHepTool(name="random_sample", inputs=["beam_rot.stdhep"], outputs=["beam_sampled"], args=["-s", str(params['seed'])]) # merge beam and wab events merge = StdHepTool(name="merge_files", inputs=["beam_sampled_1.stdhep", "wab_sampled_1.stdhep"], outputs=["wab-beam.stdhep"]) # run the job job.components = [ stdhep_cnv, rot_wab, sample_wab, rot_beam, sample_beam, merge ] job.run()
enable_ecal_energy_filter=True, nevents=2000000, event_interval=250) # run simulated events in readout to generate triggers readout = JobManager(steering_resource=params.readout_steering, java_args=["-DdisableSvtAlignmentConstants"], run=params.run, detector=params.detector, inputs=[filename + "_filt.slcio"], outputs=[filename + "_readout"]) # run physics reconstruction recon = JobManager(steering_resource=params.recon_steering, java_args=["-DdisableSvtAlignmentConstants"], run=params.run, detector=params.detector, inputs=[filename + "_readout.slcio"], outputs=[filename + "_recon"]) # count output recon events count = LCIOTool(name="count", args=["-f", filename + "_recon.slcio"]) # define job components job.components = [ ap, unzip, displ, rot, dump, slic, filter_bunches, readout, recon, count ] # run the job job.run()
from hpsmc.job import Job from hpsmc.tools import JobManager job = Job(name="Job Manager Test") job.initialize() params = job.params mgr = JobManager(steering_file=params.steering_file, inputs=params.input_files) job.components = [mgr] job.run()
from hpsmc.job import Job from hpsmc.tools import SLIC, JobManager, FilterMCBunches job = Job(name="simp job") job.initialize() params = job.params input_files = params.input_files simp_files = [] for input_file in input_files: simp_files.append(input_file) procname = "simp" # run physics reconstruction recon = JobManager( steering_resource=params.recon_steering, java_args=["-DdisableSvtAlignmentConstants"], defs={ "detector": params.detector, "run": params.run }, #inputs=[procname+"_readout.slcio"], inputs=simp_files, outputs=[procname + "_recon"]) # run the job job.components = [recon] job.run()