-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Touch up DIS examples, preliminary paper plots
- Loading branch information
Showing
4 changed files
with
255 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import os | ||
|
||
import leptoninjector as LI | ||
from leptoninjector import _util | ||
from leptoninjector.LIController import LIController | ||
|
||
resources_dir = _util.resource_package_dir() | ||
|
||
# Number of events to inject | ||
events_to_inject = 10000 | ||
|
||
# Expeirment to run | ||
experiment = "ATLAS" | ||
|
||
# Define the controller | ||
controller = LIController(events_to_inject, experiment) | ||
|
||
# Particle to inject | ||
primary_type = LI.dataclasses.Particle.ParticleType.NuMu | ||
|
||
cross_section_model = "CSMSDISSplines" | ||
|
||
xsfiledir = _util.get_cross_section_model_path(cross_section_model) | ||
|
||
# Cross Section Model | ||
target_type = LI.dataclasses.Particle.ParticleType.Nucleon | ||
|
||
DIS_xs = LI.interactions.DISFromSpline( | ||
os.path.join(xsfiledir, "dsdxdy_nu_CC_iso.fits"), | ||
os.path.join(xsfiledir, "sigma_nu_CC_iso.fits"), | ||
[primary_type], | ||
[target_type], | ||
) | ||
|
||
primary_xs = LI.interactions.InteractionCollection(primary_type, [DIS_xs]) | ||
controller.SetInteractions(primary_xs) | ||
|
||
# Primary distributions | ||
primary_injection_distributions = {} | ||
primary_physical_distributions = {} | ||
|
||
# energy distribution | ||
# HE SN flux from ATLAS paper | ||
flux_file = os.path.join( | ||
resources_dir, | ||
"Fluxes", | ||
"HE_SN_Flux_Tables", | ||
"dN_dE_SNe_2n_D1_0_s20_t100d_NuMu_d10kpc.txt", | ||
) | ||
print(flux_file) | ||
edist = LI.distributions.TabulatedFluxDistribution(100, 1e6, flux_file, True) #bool is whether flux is physical | ||
#edist_inj = LI.distributions.PowerLaw(2, 100, int(1e6)) | ||
primary_injection_distributions["energy"] = edist | ||
primary_physical_distributions["energy"] = edist | ||
|
||
# we need this conversion to make sure the flux is in units of 1/m2 | ||
flux_unit_conv = LI.distributions.NormalizationConstant((100 / 1)**2) | ||
primary_physical_distributions["flux_norm"] = flux_unit_conv | ||
|
||
# direction distribution | ||
# let's just inject upwards | ||
injection_dir = LI.math.Vector3D(0, 0, 1) | ||
injection_dir.normalize() | ||
direction_distribution = LI.distributions.FixedDirection(injection_dir) | ||
primary_injection_distributions["direction"] = direction_distribution | ||
primary_physical_distributions["direction"] = direction_distribution | ||
|
||
# position distribution | ||
muon_range_func = LI.distributions.LeptonDepthFunction() | ||
position_distribution = LI.distributions.ColumnDepthPositionDistribution( | ||
600, 600.0, muon_range_func, set(controller.GetDetectorModelTargets()[0]) | ||
) | ||
primary_injection_distributions["position"] = position_distribution | ||
|
||
# SetProcesses | ||
controller.SetProcesses( | ||
primary_type, primary_injection_distributions, primary_physical_distributions | ||
) | ||
|
||
controller.Initialize() | ||
|
||
events = controller.GenerateEvents() | ||
|
||
controller.SaveEvents("output/ATLAS_DIS") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import os | ||
|
||
import leptoninjector as LI | ||
from leptoninjector import _util | ||
from leptoninjector.LIController import LIController | ||
|
||
resources_dir = _util.resource_package_dir() | ||
|
||
# Number of events to inject | ||
events_to_inject = 10000 | ||
|
||
# Expeirment to run | ||
experiment = "DUNEFD" | ||
|
||
# Define the controller | ||
controller = LIController(events_to_inject, experiment) | ||
|
||
# Particle to inject | ||
primary_type = LI.dataclasses.Particle.ParticleType.NuMu | ||
|
||
cross_section_model = "CSMSDISSplines" | ||
|
||
xsfiledir = _util.get_cross_section_model_path(cross_section_model) | ||
|
||
# Cross Section Model | ||
target_type = LI.dataclasses.Particle.ParticleType.Nucleon | ||
|
||
DIS_xs = LI.interactions.DISFromSpline( | ||
os.path.join(xsfiledir, "dsdxdy_nu_CC_iso.fits"), | ||
os.path.join(xsfiledir, "sigma_nu_CC_iso.fits"), | ||
[primary_type], | ||
[target_type], | ||
) | ||
|
||
primary_xs = LI.interactions.InteractionCollection(primary_type, [DIS_xs]) | ||
controller.SetInteractions(primary_xs) | ||
|
||
# Primary distributions | ||
primary_injection_distributions = {} | ||
primary_physical_distributions = {} | ||
|
||
# energy distribution | ||
edist = LI.distributions.PowerLaw(2, 1e3, 1e6) | ||
primary_injection_distributions["energy"] = edist | ||
primary_physical_distributions["energy"] = edist | ||
|
||
# direction distribution | ||
direction_distribution = LI.distributions.IsotropicDirection() | ||
primary_injection_distributions["direction"] = direction_distribution | ||
primary_physical_distributions["direction"] = direction_distribution | ||
|
||
# position distribution | ||
muon_range_func = LI.distributions.LeptonDepthFunction() | ||
position_distribution = LI.distributions.ColumnDepthPositionDistribution( | ||
600, 600.0, muon_range_func, set(controller.GetDetectorModelTargets()[0]) | ||
) | ||
primary_injection_distributions["position"] = position_distribution | ||
|
||
# SetProcesses | ||
controller.SetProcesses( | ||
primary_type, primary_injection_distributions, primary_physical_distributions | ||
) | ||
|
||
controller.Initialize() | ||
|
||
events = controller.GenerateEvents() | ||
|
||
controller.SaveEvents("output/DUNE_DIS") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.