Skip to content

Commit

Permalink
Draft for processing override
Browse files Browse the repository at this point in the history
  • Loading branch information
HenningSE committed Oct 11, 2024
1 parent b0114e2 commit ac10ba0
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
14 changes: 14 additions & 0 deletions fuse/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@
fuse.truth_information.ClusterTagging,
]

# Plugins to override the default processing plugins in straxen
processing_plugins = [
fuse.processing.CorrectedAreasMC,
]


def microphysics_context(
output_folder="./fuse_data", simulation_config_file="fuse_config_nt_sr1_dev.json"
Expand Down Expand Up @@ -194,6 +199,12 @@ def full_chain_context(
for plugin in truth_information_plugins:
st.register(plugin)

# Register processing plugins
log.info("Overriding processing plugins:")
for plugin in processing_plugins:
log.info(f"Registering {plugin}")
st.register(plugin)

if corrections_version is not None:
st.apply_xedocs_configs(version=corrections_version)

Expand Down Expand Up @@ -221,6 +232,9 @@ def full_chain_context(
# Deregister plugins with missing dependencies
st.deregister_plugins_with_missing_dependencies()

# Purge unused configs
st.purge_unused_configs()

return st


Expand Down
3 changes: 3 additions & 0 deletions fuse/plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@

from . import truth_information
from .truth_information import *

from . import processing
from .processing import *
2 changes: 2 additions & 0 deletions fuse/plugins/processing/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import corrected_areas
from .corrected_areas import *
23 changes: 23 additions & 0 deletions fuse/plugins/processing/corrected_areas.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import strax
import straxen

export, __all__ = strax.exporter()


@export
class CorrectedAreasMC(straxen.CorrectedAreas):
"""Corrected areas plugin for MC data.
This plugin overwrites the cs1 and cs2 fields with the not-time-
corrected values as the effects are not simulated in the MC.
"""

__version__ = "0.0.1"
child_plugin = True

def compute(self, events):
result = super().compute(events)
result["cs1"] = result["cs1_wo_timecorr"]
result["cs2"] = result["cs2_wo_timecorr"]

return result

0 comments on commit ac10ba0

Please sign in to comment.