Skip to content
This repository has been archived by the owner on Jun 5, 2024. It is now read-only.

Commit

Permalink
Add n_pe to truth (#246)
Browse files Browse the repository at this point in the history
* Add n_pe to truth

Right now the n_photons field in the truth is the number of detected photons + double pe emission.
This PR changes that to have n_photons be the number of detected photons and n_pe for the number of detected photo electrons (so photons+dpe)

* Update rawdata.py

* Update rawdata.py

* Update rawdata.py

remove exclude dpe from truth option
  • Loading branch information
petergaemers authored Nov 19, 2021
1 parent 92e81b9 commit ad163ae
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
15 changes: 7 additions & 8 deletions wfsim/core/rawdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,19 +343,18 @@ def get_truth(self, instruction, truth_buffer):
* self.config['sample_duration']

channels = getattr(pulse, '_photon_channels', [])
if self.config.get('exclude_dpe_in_truth', False):
n_dpe = n_dpe_bot = 0
else:
n_dpe = getattr(pulse, '_n_double_pe', 0)
n_dpe_bot = getattr(pulse, '_n_double_pe_bot', 0)
tb['n_photon'] += n_dpe

n_dpe = getattr(pulse, '_n_double_pe', 0)
n_dpe_bot = getattr(pulse, '_n_double_pe_bot', 0)

tb['n_photon'] -= np.sum(np.isin(channels, getattr(pulse, 'turned_off_pmts', [])))
tb['n_pe'] += tb['n_photon']+n_dpe
# this turned_off guy, check how this works with a config['turned_off_guys']
channels_bottom = list(
set(self.config['channels_bottom']).difference(getattr(pulse, 'turned_off_pmts', [])))
tb['n_photon_bottom'] = (
np.sum(np.isin(channels, channels_bottom))
+ n_dpe_bot)
np.sum(np.isin(channels, channels_bottom)))
tb['n_pe_bottom'] = tb['n_photon_bottom'] + n_dpe_bot

# Summarize the instruction cluster in one row of the truth file
for field in instruction.dtype.names:
Expand Down
2 changes: 2 additions & 0 deletions wfsim/strax_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@
(('End time of the interaction [ns]', 'endtime'), np.int64),
(('Number of simulated electrons', 'n_electron'), np.float64),
(('Number of detected photons', 'n_photon'), np.float64),
(('Number of detected photoelectrons(n_photons+dpe)', 'n_pe'), np.float64),
(('number of photons detected in bottom array', 'n_photon_bottom'), np.float64),
(('number of photoelectrons detected in bottom array', 'n_pe_bottom'), np.float64),
(('Arrival time of the first photon [ns]', 't_first_photon'), np.float64),
(('Arrival time of the last photon [ns]', 't_last_photon'), np.float64),
(('Mean time of the photons [ns]', 't_mean_photon'), np.float64),
Expand Down

0 comments on commit ad163ae

Please sign in to comment.