Skip to content

Commit

Permalink
Use base plugin for delayed electrons
Browse files Browse the repository at this point in the history
  • Loading branch information
HenningSE committed Feb 1, 2024
1 parent 9218f00 commit 7c5b1d0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
"""
Expand All @@ -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):
"""
Expand All @@ -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):
"""
Expand All @@ -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):
"""
Expand All @@ -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
__version__ = '0.0.1'
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
import numpy as np
import logging

from ....common import FUSE_PLUGIN_TIMEOUT
from ....plugin import FuseBasePlugin

export, __all__ = strax.exporter()

logging.basicConfig(handlers=[logging.StreamHandler()])
log = logging.getLogger('fuse.detector_physics.delayed_electrons.photo_ionization_electrons')

@export
class PhotoIonizationElectrons(strax.Plugin):
class PhotoIonizationElectrons(FuseBasePlugin):

__version__ = "0.0.1"

Expand All @@ -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',
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 7c5b1d0

Please sign in to comment.