Beispiel #1
0
                         inputs=["beam_rot.stdhep"],
                         outputs=["beam_sampled"],
                         args=["-N", "1"])

# merge beam, wab and tri events
merge = StdHepTool(name="merge_files",
                   inputs=[
                       "beam_sampled_1.stdhep", "wab_sampled_1.stdhep",
                       "tri_sampled_1.stdhep"
                   ],
                   outputs=["wab-beam-tri.stdhep"])

# generate events in slic
slic = SLIC(description="Run detector simulation using SLIC",
            detector=params.detector,
            inputs=["wab-beam-tri.stdhep"],
            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",
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])
Beispiel #3
0
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])

# Count filtered events
count_filter = LCIOCount(inputs=filter_bunches.output_files())

# Transform beam events
rot_beam = BeamCoords(inputs=[beam_file_name],
                      outputs=['%s_rot.stdhep' % beam_name])

# Sample the beam events
sample_beam = RandomSample(inputs=rot_beam.output_files(),
                           outputs=['%s_sampled.stdhep' % beam_name],
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,
            ignore_returncode=True)

# insert empty bunches expected by pile-up simulation
filter_bunches = FilterMCBunches(java_args=["-DdisableSvtAlignmentConstants"],
                                 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"],
Beispiel #5
0
if (len(params.input_files) != len(params.output_files)) and len(
        params.output_files) != 1:
    raise Exception("Input and output file lists are not the same length!")

# create a SLIC component for each input file
output_files = []
for io in zip(sorted(params.input_files.keys()),
              sorted(params.output_files.keys())):
    # each output file is named from the JSON list
    fname = os.path.splitext(io[1])[0] + ".slcio"
    output_files.append(fname)

    # generate events in slic using the input stdhep file
    slic = SLIC(description="Run detector simulation using SLIC",
                detector=params['detector'],
                inputs=[io[0]],
                outputs=[fname],
                nevents=params['nevents'],
                ignore_returncode=True)

    job.components.append(slic)

# concatenate LCIO files if a single output file was given in the JSON
if len(params.input_files) > 1 and len(params.output_files) == 1:
    concat = LCIOConcat(
        inputs=[output_files],
        outputs=[os.path.splitext(params.output_files.keys()[0])[0]])
    job.components.append(concat)

job.run()
Beispiel #6
0
from hpsmc.generators import StdHepConverter
from hpsmc.tools import BeamCoords, AddMother, MergePoisson, RandomSample, MergeFiles
from hpsmc.tools import SLIC, JobManager, ExtractEventsWithHitAtHodoEcal, HPSTR, LCIOCount, LCIOMerge, StdHepCount

job.description = 'slic to anaMC'

# Simulate signal events
slic = SLIC()

# Convert LCIO to ROOT
tuple = HPSTR(cfg='mcTuple')

# Run an analysis on the ROOT file
ana = HPSTR(cfg='ana')

# Add the components
job.add([slic, tuple, ana])
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,
            inputs=rot.output_files(),
            outputs=["rad.slcio"])

# run the job
job.add([mg, cnv, unzip, mom, rot, slic])
Beispiel #8
0
from hpsmc.tools import SLIC, LCIOCount, LCIODumpEvent

job.description = 'SLIC'

job.add(SLIC())

job.add(LCIOCount())

job.add(LCIODumpEvent())
Beispiel #9
0
    beam_slic_file_names.append('beam_%i.slcio' % i)

# Check for expected input file targets
if beam_file_names[nbeams - 1] not in inputs:
    raise Exception("Missing required input file '%s'" %
                    beam_file_names[nbeams - 1])

# Base name of intermediate beam files
beam_name = 'beam'

# Simulate beam events
slic_beams = []
for i in range(len(beam_file_names)):
    slic_beams.append(
        SLIC(inputs=[beam_file_names[i]],
             outputs=[beam_slic_file_names[i]],
             nevents=nevents * event_int,
             ignore_job_params=['nevents']))

# concatonate beam events before merging
slic_beam_cat = ExtractEventsWithHitAtHodoEcal(inputs=beam_slic_file_names,
                                               outputs=['beam_cat.slcio'],
                                               event_interval=0,
                                               num_hodo_hits=0)

# Run simulated events in readout to generate triggers
readout = JobManager(steering='readout',
                     inputs=slic_beam_cat.output_files(),
                     outputs=['fee_readout.slcio'])

# Run physics reconstruction
recon = JobManager(steering='recon',
Beispiel #10
0
if tritrig_file_name not in inputs:
    raise Exception("Missing required input file '%s'" % tritrig_file_name)
if beam_file_names[1] not in inputs:
    raise Exception("Missing required input file '%s'" % beam_file_names[1])

# 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'

# Simulate signal events
slic_tt = SLIC(inputs=[tritrig_file_name], outputs=['%s.slcio' % tritrig_name])

# Space signal events before merging
filter_bunches_tt = ExtractEventsWithHitAtHodoEcal(
    inputs=slic_tt.output_files(),
    outputs=['%s_filt.slcio' % tritrig_name],
    event_interval=event_int,
    num_hodo_hits=0)

# Simulate beam events
slic_beams = []
for i in range(len(beam_file_names)):
    slic_beams.append(
        SLIC(inputs=[beam_file_names[i]],
             outputs=[beam_slic_file_names[i]],
             nevents=nevents * event_int,