HPS-MC
signal_beam_merge_to_recon_job.py
Go to the documentation of this file.
1 """!
2 @file signal_beam_merge_to_recon_job.py
3 
4 Merging of signal and beam events, simulation of readout,
5 and reconstruction of events.
6 """
7 from hpsmc.tools import ExtractEventsWithHitAtHodoEcal, JobManager, LCIOCount, LCIOMerge
8 
9 job.description = 'signal-beam from merge to recon'
10 
11 
12 inputs = list(job.input_files.values())
13 
14 
15 signal_file_name = []
16 
17 
18 beam_file_name = []
19 
20 for input in inputs:
21  if "signal" in input:
22  signal_file_name.append(input)
23  if "beam" in input:
24  beam_file_name.append(input)
25 
26 
27 if len(signal_file_name) == 0:
28  raise Exception("Missing required input file(s) for signal")
29 if len(beam_file_name) == 0:
30  raise Exception("Missing required input file(s) for beam")
31 
32 
33 signal_name = 'signal'
34 
35 
36 beam_name = 'beam'
37 
38 
39 signal_beam_name = 'signal-beam'
40 
41 
42 filter_events = ExtractEventsWithHitAtHodoEcal(inputs=signal_file_name,
43  outputs=['%s_filt.slcio' % signal_name],
44  event_interval=250, num_hodo_hits=1)
45 
46 
47 count_filter = LCIOCount(inputs=filter_events.output_files())
48 
49 
50 catenate_beam = ExtractEventsWithHitAtHodoEcal(inputs=beam_file_name,
51  outputs=['%s_filt.slcio' % beam_name],
52  event_interval=0, num_hodo_hits=0)
53 
54 
55 count_beam = LCIOCount(inputs=catenate_beam.output_files())
56 
57 
58 merge = LCIOMerge(inputs=[filter_events.output_files()[0],
59  catenate_beam.output_files()[0]],
60  outputs=['%s.slcio' % signal_beam_name],
61  ignore_job_params=['nevents'])
62 
63 
64 count_merge = LCIOCount(inputs=merge.output_files())
65 
66 
67 readout = JobManager(steering='readout',
68  inputs=merge.output_files(),
69  outputs=['%s_readout.slcio' % signal_beam_name])
70 
71 
72 count_readout = LCIOCount(inputs=readout.output_files())
73 
74 
75 recon = JobManager(steering='recon',
76  inputs=readout.output_files(),
77  outputs=['%s_recon.slcio' % signal_beam_name])
78 
79 
80 count_recon = LCIOCount(inputs=recon.output_files())
81 
82 
83 job.add([filter_events, count_filter, catenate_beam, count_beam, merge,
84  count_merge, readout, count_readout, recon, count_recon])
Apply hodo-hit filter and space MC events to process before readout.
Definition: tools.py:1160
Run the hps-java JobManager class.
Definition: tools.py:160
Count events in LCIO files.
Definition: tools.py:1487
Merge LCIO files.
Definition: tools.py:1530
Tools that can be used in HPSMC jobs.
Definition: tools.py:1