Skip to content

Commit

Permalink
Added copyright to too.py; added multiplication by branching ratio in…
Browse files Browse the repository at this point in the history
… diffuse integral; removed outdated lines of code (#98)
  • Loading branch information
tventers authored Feb 16, 2024
1 parent 1984341 commit 591535c
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 28 deletions.
35 changes: 7 additions & 28 deletions src/nuspacesim/simulation/geometry/region_geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,10 @@ def mcintegral(
mcintfactor[cossepangle < costheta] = 0
mcintegralgeoonly = np.sum(mcintfactor) * mcnorm / numTrajs

# Multiply by tau exit probability
mcintfactor *= tauexitprob
Bshr = 0.826

# Multiply by tau exit probability and branching ratio (currently ignores muon channel for tau decays; it's also hard coded in, so will need to be changed)
mcintfactor *= Bshr * tauexitprob

# Weighting by energy spectrum if other than monoenergetic spectrum
mcintfactor /= spec_norm
Expand Down Expand Up @@ -460,28 +462,17 @@ def throw(self, times=None) -> None:
),
]
)
# print(
# np.rad2deg(self.config.simulation.ang_from_limb),
# np.rad2deg(
# self.get_beta_angle(
# self.alphaHorizon - self.config.simulation.ang_from_limb
# )
# ),
# )

# Calculate the pathlength through the atmosphere
self.losPathLen = self.get_path_length(
self.sourcebeta[self.volume_mask], self.event_mask(self.sourceNadRad)
)
# self.test_plot_nadir_angle()
# print (np.degrees(self.sourcebeta[self.volume_mask]), self.losPathLen)
# self.test_plot_nadir_angle()

def generate_times(self, times) -> np.ndarray:
"""
Function to generate times within the simulation time period
"""
if isinstance(times, int):
# times = np.random.rand(times)
times = np.arange(times) / times

if times is None:
Expand All @@ -490,7 +481,6 @@ def generate_times(self, times) -> np.ndarray:
"numbers in [0, 1]"
)

# times = np.sort(times)
times *= self.sourceOBSTime # in s
times = TimeDelta(times, format="sec")
times = self.too_source.eventtime + times
Expand Down Expand Up @@ -566,12 +556,6 @@ def mcintegral(
thetaChEff = np.arccos(costhetaChEff)
tanthetaChEff = np.tan(thetaChEff)

# cossepangle = self.costhetaTrSubV[self.event_mask]

# mcintfactor = (
# (self.pathLens() - lenDec) * (self.pathLens() - lenDec) * tanthetaChEff**2
# )

mcintfactor_umsk = self.pathLens() - lenDec
# mcintfactor_umsk = self.pathLens() # For testing purposes only

Expand All @@ -586,16 +570,11 @@ def mcintegral(

mcintegralgeoonly = np.sum(mcintfactor) / len(self.times)

# Branching ratio set to 1 to be consistent
Bshr = 0.826

mcintfactor *= Bshr * tauexitprob

# Geometry Factors
# mcintegralgeoonly = np.mean(mcintfactor)
# Multiply by tau exit probability and branching ratio (currently ignores muon channel for tau decays; it's also hard coded in, so will need to be changed)

# Multiply by tau exit probability
# mcintfactor *= tauexitprob
mcintfactor *= Bshr * tauexitprob

# Weighting by energy spectrum if other than monoenergetic spectrum
mcintfactor /= spec_norm
Expand Down
33 changes: 33 additions & 0 deletions src/nuspacesim/simulation/geometry/too.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@
# The Clear BSD License
#
# Copyright (c) 2021 Alexander Reustle and the NuSpaceSim Team
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted (subject to the limitations in the disclaimer
# below) provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# * Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
# NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
# THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

import astropy.coordinates
import astropy.time
import astropy.units as u
Expand Down

0 comments on commit 591535c

Please sign in to comment.