Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lar: Use result from Mario's thesis #60

Merged
merged 2 commits into from
Jul 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 28 additions & 14 deletions src/legendoptics/lar.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@
.. [Hitachi1983] A. Hitachi et al. “Effect of ionization density on the time dependence of luminescence
from liquid argon and xenon.” In: Phys. Rev. B 27 (9 May 1983), pp. 5279-5285,
https://doi.org/10.1103/PhysRevB.27.5279
.. [Schwarz2024] M. Schwarz “Tracing impurities and illuminating their impact: Surveying and characterizing
liquid argon with LLAMA for LEGEND and beyond” (PhD thesis). https://mediatum.ub.tum.de/?id=1741523
"""

from __future__ import annotations

import logging
from typing import NamedTuple
from typing import Literal, NamedTuple

import numpy as np
import pint
Expand All @@ -42,6 +44,9 @@
log = logging.getLogger(__name__)
u = pint.get_application_registry()

ArDielectricMethods = Literal["cern2020", "bideau-mehu"]
ArLifetimeMethods = Literal["legend200-llama"]


class ArScintLiftime(NamedTuple):
singlet: Quantity
Expand Down Expand Up @@ -105,7 +110,9 @@ def lar_dielectric_constant_cern2020(
return (3 + 2 * x) / (3 - x)


def lar_dielectric_constant(λ: Quantity, method: str = "cern2020") -> Quantity:
def lar_dielectric_constant(
λ: Quantity, method: ArDielectricMethods = "cern2020"
) -> Quantity:
"""Calculate the dielectric constant of LAr for a given photon wavelength.

See Also
Expand All @@ -120,7 +127,9 @@ def lar_dielectric_constant(λ: Quantity, method: str = "cern2020") -> Quantity:
raise ValueError(msg)


def lar_refractive_index(λ: Quantity, method: str = "cern2020") -> Quantity:
def lar_refractive_index(
λ: Quantity, method: ArDielectricMethods = "cern2020"
) -> Quantity:
"""Calculate the refractive index of LAr for a given photon wavelength.

See Also
Expand Down Expand Up @@ -160,7 +169,9 @@ def lar_fano_factor() -> float:


def lar_rayleigh(
λ: Quantity, temperature: Quantity = 90 * u.K, method: str = "cern2020"
λ: Quantity,
temperature: Quantity = 90 * u.K,
method: ArDielectricMethods = "cern2020",
) -> Quantity:
"""Calculate the Rayleigh scattering length using the equations given in [Seidel2002]_.

Expand Down Expand Up @@ -214,12 +225,14 @@ def lar_abs_length(λ: Quantity) -> Quantity:


def lar_peak_attenuation_length(
attenuation_method: str | Quantity = "legend200-llama",
attenuation_method: ArLifetimeMethods | Quantity = "legend200-llama",
) -> Quantity:
"""Attenuation length in the LEGEND-argon, as measured with LLAMA."""
"""Attenuation length in the LEGEND-argon, as measured with LLAMA,
see [Schwarz2024]_ (p. 124).
"""
if isinstance(attenuation_method, str):
if attenuation_method == "legend200-llama":
return 30 * u.cm
return 33 * u.cm

msg = f"unknown attenuation_method {attenuation_method}"
raise ValueError(msg)
Expand All @@ -229,16 +242,17 @@ def lar_peak_attenuation_length(


def lar_lifetimes(
triplet_lifetime_method: float | str = "legend200-llama",
triplet_lifetime_method: float | ArLifetimeMethods = "legend200-llama",
) -> ArScintLiftime:
"""Singlet and triplet lifetimes of liquid argon.

Singlet time from [Hitachi1983]_ and triplet time as measured by LLAMA in LEGEND-200.
Singlet time from [Hitachi1983]_ and triplet time as measured by LLAMA in LEGEND-200,
see [Schwarz2024]_ (p. 117).
"""
triplet = 1 * u.us
if isinstance(triplet_lifetime_method, str):
if triplet_lifetime_method == "legend200-llama":
triplet = 1.3 * u.us
triplet = 1.16 * u.us
else:
msg = f"unknown triplet_lifetime_method {triplet_lifetime_method}"
raise ValueError(msg)
Expand Down Expand Up @@ -285,7 +299,7 @@ def lar_scintillation_params(flat_top_yield: Quantity = 31250 / u.MeV) -> ScintC


def pyg4_lar_attach_rindex(
lar_mat, reg, lar_dielectric_method: str = "cern2020"
lar_mat, reg, lar_dielectric_method: ArDielectricMethods = "cern2020"
) -> None:
"""Attach the refractive index to the given LAr material instance.

Expand All @@ -312,8 +326,8 @@ def pyg4_lar_attach_attenuation(
lar_mat,
reg,
lar_temperature: Quantity,
lar_dielectric_method: str = "cern2020",
attenuation_method_or_length: str | Quantity = "legend200-llama",
lar_dielectric_method: ArDielectricMethods = "cern2020",
attenuation_method_or_length: ArLifetimeMethods | Quantity = "legend200-llama",
rayleigh_enabled_or_length: bool | Quantity = True,
absorption_enabled_or_length: bool | Quantity = True,
) -> None:
Expand Down Expand Up @@ -395,7 +409,7 @@ def pyg4_lar_attach_scintillation(
lar_mat,
reg,
flat_top_yield: Quantity = 31250 / u.MeV,
triplet_lifetime_method: float | str = "legend200-llama",
triplet_lifetime_method: float | ArLifetimeMethods = "legend200-llama",
) -> None:
"""Attach all properties for LAr scintillation response to the given LAr material instance.

Expand Down
Loading