From 7c5b1d0d05d43b705ff64bd13d91061e3bc904a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henning=20Schulze=20Ei=C3=9Fing?= Date: Thu, 1 Feb 2024 17:03:49 +0100 Subject: [PATCH] Use base plugin for delayed electrons --- .../delayed_electrons_merger.py | 20 +---------- .../photo_ionization_electrons.py | 35 ++----------------- 2 files changed, 3 insertions(+), 52 deletions(-) diff --git a/fuse/plugins/detector_physics/delayed_electrons/delayed_electrons_merger.py b/fuse/plugins/detector_physics/delayed_electrons/delayed_electrons_merger.py index 33eb0bcf..3a158cb5 100644 --- a/fuse/plugins/detector_physics/delayed_electrons/delayed_electrons_merger.py +++ b/fuse/plugins/detector_physics/delayed_electrons/delayed_electrons_merger.py @@ -16,9 +16,6 @@ class DriftedElectronsMerger(VerticalMergerPlugin): data_kind = 'interactions_in_roi' __version__ = '0.0.1' - #Forbid rechunking - rechunk_on_save = False - @export class ExtractedElectronsMerger(VerticalMergerPlugin): @@ -32,9 +29,6 @@ class ExtractedElectronsMerger(VerticalMergerPlugin): data_kind = 'interactions_in_roi' __version__ = '0.0.1' - #Forbid rechunking - rechunk_on_save = False - @export class SecondaryScintillationPhotonsMerger(VerticalMergerPlugin): """ @@ -47,9 +41,6 @@ class SecondaryScintillationPhotonsMerger(VerticalMergerPlugin): data_kind = 'individual_electrons' __version__ = '0.0.1' - #Forbid rechunking - rechunk_on_save = False - @export class SecondaryScintillationPhotonSumMerger(VerticalMergerPlugin): """ @@ -62,9 +53,6 @@ class SecondaryScintillationPhotonSumMerger(VerticalMergerPlugin): data_kind = 'interactions_in_roi' __version__ = '0.0.1' - #Forbid rechunking - rechunk_on_save = False - @export class ElectronTimingMerger(VerticalMergerPlugin): """ @@ -77,9 +65,6 @@ class ElectronTimingMerger(VerticalMergerPlugin): data_kind = 'individual_electrons' __version__ = '0.0.1' - #Forbid rechunking - rechunk_on_save = False - @export class MicrophysicsSummaryMerger(VerticalMergerPlugin): """ @@ -90,7 +75,4 @@ class MicrophysicsSummaryMerger(VerticalMergerPlugin): provides = 'merged_microphysics_summary' data_kind = 'interactions_in_roi' - __version__ = '0.0.1' - - #Forbid rechunking - rechunk_on_save = False \ No newline at end of file + __version__ = '0.0.1' \ No newline at end of file diff --git a/fuse/plugins/detector_physics/delayed_electrons/photo_ionization_electrons.py b/fuse/plugins/detector_physics/delayed_electrons/photo_ionization_electrons.py index b2e4427c..678adb14 100644 --- a/fuse/plugins/detector_physics/delayed_electrons/photo_ionization_electrons.py +++ b/fuse/plugins/detector_physics/delayed_electrons/photo_ionization_electrons.py @@ -5,7 +5,7 @@ import numpy as np import logging -from ....common import FUSE_PLUGIN_TIMEOUT +from ....plugin import FuseBasePlugin export, __all__ = strax.exporter() @@ -13,7 +13,7 @@ log = logging.getLogger('fuse.detector_physics.delayed_electrons.photo_ionization_electrons') @export -class PhotoIonizationElectrons(strax.Plugin): +class PhotoIonizationElectrons(FuseBasePlugin): __version__ = "0.0.1" @@ -24,29 +24,15 @@ class PhotoIonizationElectrons(strax.Plugin): provides = "photo_ionization_electrons" data_kind = "delayed_interactions_in_roi" - #Forbid rechunking - rechunk_on_save = False - save_when = strax.SaveWhen.ALWAYS - input_timeout = FUSE_PLUGIN_TIMEOUT - #Config options - debug = straxen.URLConfig( - default=False, type=bool,track=False, - help='Show debug informations', - ) enable_delayed_electrons = straxen.URLConfig( default=False, type=bool, track=True, help='Decide if you want to to enable delayed electrons from photoionization', ) - deterministic_seed = straxen.URLConfig( - default=True, type=bool, - help='Set the random seed from lineage and run_id, or pull the seed from the OS.', - ) - #Move the filename to the config file delaytime_pmf_hist = straxen.URLConfig( help='delaytime_pmf_hist', @@ -89,23 +75,6 @@ class PhotoIonizationElectrons(strax.Plugin): help='Radius of the XENONnT TPC ', ) - def setup(self): - - if self.debug: - log.setLevel('DEBUG') - log.debug("Running PhotoIonizationElectrons in debug mode") - else: - log.setLevel('WARNING') - - if self.deterministic_seed: - hash_string = strax.deterministic_hash((self.run_id, self.lineage)) - seed = int(hash_string.encode().hex(), 16) - self.rng = np.random.default_rng(seed = seed) - log.debug(f"Generating random numbers from seed {seed}") - else: - self.rng = np.random.default_rng() - log.debug(f"Generating random numbers with seed pulled from OS") - def infer_dtype(self): #Thake the same dtype as microphysics_summary dtype = self.deps["s2_photons"].deps["microphysics_summary"].dtype