HPS-MC
slic_to_recon_job.py
Go to the documentation of this file.
1 """!
2 @file slic_to_recon_job.py
3 
4 Simulation of signals in detector (using SLIC) and readout.
5 The simulation is followed by reconstruction of the events.
6 """
7 import os
8 from hpsmc.tools import SLIC, JobManager, ExtractEventsWithHitAtHodoEcal
9 
10 
11 inputs = list(job.input_files.values())
12 
13 job.description = 'slic to recon'
14 
15 
16 if 'event_interval' in job.params:
17  event_int = job.params['event_interval']
18 else:
19  event_int = 1
20 
21 if 'nevents' in job.params:
22  nevents = job.params['nevents']
23 else:
24  nevents = 10000
25 
26 if 'base_name' in job.params:
27  base_name = job.params['base_name']
28 else:
29  base_name = ''
30 
31 
32 slic_file_names = []
33 for i in range(len(inputs)):
34  filename, file_extension = os.path.splitext(inputs[i])
35  slic_file = filename + '.slcio'
36  slic_file_names.append(slic_file)
37 
38 
39 slic_comps = []
40 for i in range(len(inputs)):
41  slic_comps.append(SLIC(inputs=[inputs[i]],
42  outputs=[slic_file_names[i]],
43  nevents=nevents * event_int,
44  ignore_job_params=['nevents'])
45  )
46 
47 
48 cat_out_name = base_name + '_slic_cat.slcio'
49 slic_cat = ExtractEventsWithHitAtHodoEcal(inputs=slic_file_names,
50  outputs=[cat_out_name],
51  event_interval=0, num_hodo_hits=0)
52 
53 
54 readout_out_name = base_name + '_readout.slcio'
55 readout = JobManager(steering='readout',
56  inputs=slic_cat.output_files(),
57  outputs=[readout_out_name])
58 
59 
60 recon_out_name = base_name + '_recon.slcio'
61 recon = JobManager(steering='recon',
62  inputs=readout.output_files(),
63  outputs=[recon_out_name])
64 
65 
66 comps = slic_comps
67 comps.extend([slic_cat, readout, recon])
68 job.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
Run the SLIC Geant4 simulation.
Definition: tools.py:15
Tools that can be used in HPSMC jobs.
Definition: tools.py:1