Skip to content

Commit

Permalink
ENH: Automized calling of tot calibration file in scans
Browse files Browse the repository at this point in the history
  • Loading branch information
lschall committed Feb 15, 2024
1 parent 8a0e71f commit 5ea314f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
8 changes: 7 additions & 1 deletion tjmonopix2/analysis/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,9 +479,15 @@ def create_cluster_tot_plot(self):
else:
plot_range = range(0, np.max(np.nonzero(self.HistClusterTot)))

tot_calib_file = self.configuration['scan'].get('tot_calib_file', None)
if tot_calib_file is not None:
x_axis_title = 'Electrons [e⁻]'
else:
x_axis_title = 'Cluster ToT [25 ns]'

self._plot_1d_hist(hist=self.HistClusterTot[:], title='Cluster ToT',
log_y=False, plot_range=plot_range,
x_axis_title='Cluster ToT [25 ns]',
x_axis_title=x_axis_title,
y_axis_title='# of clusters', suffix='cluster_tot')
except Exception:
self.log.error('Could not create cluster TOT plot!')
Expand Down
8 changes: 7 additions & 1 deletion tjmonopix2/scans/scan_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

'scan_timeout': False, # Timeout for scan after which the scan will be stopped, in seconds; if False no limit on scan time
'max_triggers': 1000000, # Number of maximum received triggers after stopping readout, if False no limit on received trigger

'tot_calib_file': None # path to ToT calibration file for charge to e⁻ conversion, if None no conversion will be done
}


Expand Down Expand Up @@ -89,7 +91,11 @@ def timed_out():
self.log.success('Scan finished')

def _analyze(self):
with analysis.Analysis(raw_data_file=self.output_filename + '.h5', **self.configuration['bench']['analysis']) as a:
tot_calib_file = self.configuration['scan'].get('tot_calib_file', None)
if tot_calib_file is not None:
self.configuration['bench']['analysis']['cluster_hits'] = True

with analysis.Analysis(raw_data_file=self.output_filename + '.h5', tot_calib_file=tot_calib_file, **self.configuration['bench']['analysis']) as a:
a.analyze_data()

if self.configuration['bench']['analysis']['create_pdf']:
Expand Down
2 changes: 1 addition & 1 deletion tjmonopix2/testbench.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ analysis:
create_pdf: True # Create analysis summary pdf
# module_plotting: True # Create combined plots for chip in a module
store_hits: True # store hit table
# cluster_hits: False # store cluster data
cluster_hits: False # store cluster data
# analyze_tdc: False # analyze TDC words
# use_tdc_trigger_dist: False # analyze TDC to TRG distance
# align_method: 0 # how to detect new events
Expand Down

0 comments on commit 5ea314f

Please sign in to comment.