HPS-MC
 
Loading...
Searching...
No Matches
tritrig_beam_slic_to_reco_job.py
Go to the documentation of this file.
1"""!
2@file tritrig_beam_job.py
3
4Merge tritrig and beam events, simulate signal events, and detector readout.
5"""
6import os
7from hpsmc.tools import SLIC, JobManager, LCIOCount, LCIOMerge, ExtractEventsWithHitAtHodoEcal
8
9
10inputs = list(job.input_files.values())
11
12job.description = 'tritrig beam slic to reco'
13
14if 'nevents' in job.params:
15 nevents = job.params['nevents']
16else:
17 nevents = 10000
18
19
20tritrig_file_name = 'tritrig_events.stdhep'
21
22
23beam_file_names = []
24beam_slic_file_names = []
25for i in range(len(inputs)):
26 if inputs[i] != tritrig_file_name:
27 beam_file_names.append(inputs[i])
28 filename, file_extension = os.path.splitext(inputs[i])
29 beam_slic_file = filename + '.slcio'
30 beam_slic_file_names.append(beam_slic_file)
31
32
33tritrig_name = 'tritrig'
34
35
36beam_name = 'beam'
37
38
39tritrig_beam_name = 'tritrig_beam'
40
41
42slic = SLIC(inputs=[tritrig_file_name],
43 outputs=['%s.slcio' % tritrig_name])
44
45
46filter_bunches = ExtractEventsWithHitAtHodoEcal(inputs=slic.output_files(),
47 outputs=['%s_filt.slcio' % tritrig_name],
48 event_interval=250, num_hodo_hits=0)
49
50
51count_filter = LCIOCount(inputs=filter_bunches.output_files())
52
53
54slic_beams = []
55for i in range(len(beam_file_names)):
56 slic_beams.append(SLIC(inputs=[beam_file_names[i]],
57 outputs=[beam_slic_file_names[i]],
58 nevents=nevents * 250,
59 ignore_job_params=['nevents'])
60 )
61
62
63slic_beam_cat = ExtractEventsWithHitAtHodoEcal(inputs=beam_slic_file_names,
64 outputs=['beam_cat.slcio'],
65 event_interval=0, num_hodo_hits=0)
66
67
68merge = LCIOMerge(inputs=[filter_bunches.output_files()[0],
69 slic_beam_cat.outputs[0]],
70 outputs=['%s.slcio' % tritrig_beam_name],
71 ignore_job_params=['nevents'])
72
73
74count_merge = LCIOCount(inputs=merge.output_files())
75
76
77readout = JobManager(steering='readout',
78 inputs=merge.output_files(),
79 outputs=['%s_readout.slcio' % tritrig_beam_name])
80
81
82count_readout = LCIOCount(inputs=readout.output_files())
83
84
85recon = JobManager(steering='recon',
86 inputs=readout.output_files(),
87 outputs=['%s_recon.slcio' % tritrig_beam_name])
88
89
90count_recon = LCIOCount(inputs=recon.output_files())
91
92comps = [slic, filter_bunches, count_filter]
93for i in range(len(slic_beams)):
94 comps.append(slic_beams[i])
95comps.extend([slic_beam_cat, merge, count_merge, readout, count_readout, recon, count_recon])
96job.add(comps)
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
Run the SLIC Geant4 simulation.
Definition tools.py:15
Tools that can be used in HPSMC jobs.
Definition tools.py:1