Skip to content

Commit

Permalink
Creating Examples directory for paper, moving DIS splines, adding NUM…
Browse files Browse the repository at this point in the history
…I flux tables. First step toward restructuring resources directory
  • Loading branch information
nickkamp1 committed Jan 5, 2024
1 parent 30503eb commit 673b414
Show file tree
Hide file tree
Showing 25 changed files with 3,312 additions and 0 deletions.
File renamed without changes.
File renamed without changes.
117 changes: 117 additions & 0 deletions resources/Examples/Example2/DipolePortal_MiniBooNE.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
import numpy as np
import os
import matplotlib.pyplot as plt

import leptoninjector as LI
import sys
sys.path.insert(1,'/n/holylfs05/LABS/arguelles_delgado_lab/Everyone/nkamp/LIV2/sources/LeptonInjector/python')
from LIController import LIController

LI_SRC = os.environ.get('LEPTONINJECTOR_SRC')

# Define a DarkNews model
model_kwargs = {
'm4': 0.47,#0.140,
'mu_tr_mu4': 2.5e-6, #1e-6, # GeV^-1
'UD4': 0,
'Umu4': 0,
'epsilon': 0.0,
'gD': 0.0,
'decay_product':'photon',
'noHC':True,
'HNLtype':"dirac",
}

# Number of events to inject
events_to_inject = 10

# Expeirment to run
experiment = 'MiniBooNE'

# Define the controller
controller = LIController(events_to_inject,
experiment)

# Particle to inject
primary_type = LI.dataclasses.Particle.ParticleType.NuMu

# Define DarkNews Model
table_dir = LI_SRC+'/resources/CrossSectionTables/DarkNewsTables/Dipole_M%2.2f_mu%2.2e/'%(model_kwargs['m4'],model_kwargs['mu_tr_mu4'])
controller.InputDarkNewsModel(primary_type,
table_dir,
model_kwargs)

# Primary distributions
primary_injection_distributions = {}
primary_physical_distributions = {}

# energy distribution
flux_file = LI_SRC + '/resources/Fluxes/BNB_Flux_Tables/BNB_numu_flux.txt'
edist = LI.distributions.TabulatedFluxDistribution(flux_file, True)
edist_gen = LI.distributions.TabulatedFluxDistribution(1.05*model_kwargs['m4'], 10, flux_file, False)
primary_injection_distributions['energy'] = edist_gen
primary_physical_distributions['energy'] = edist

# Flux normalization: go from cm^-2 to m^-2
flux_units = LI.distributions.NormalizationConstant(1e4)
primary_physical_distributions['flux_units'] = flux_units

# direction distribution
direction_distribution = LI.distributions.FixedDirection(LI.math.Vector3D(0, 0, 1.0))
primary_injection_distributions['direction'] = direction_distribution
primary_physical_distributions['direction'] = direction_distribution

# position distribution
decay_range_func = LI.distributions.DecayRangeFunction(model_kwargs['m4'],
controller.DN_min_decay_width,
3,
541)
position_distribution = LI.distributions.RangePositionDistribution(6.2, 6.2,
decay_range_func,
set(controller.GetEarthModelTargets()[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('Dipole_M%2.2f_mu%2.2e_example.hdf5'%(model_kwargs['m4'],model_kwargs['mu_tr_mu4']))


# Analysis

upscattering_vertices = {}
targets = []
decay_vertices = []
for tree in events:
for datum in tree.tree:
if datum.record.signature.primary_type == LI.dataclasses.Particle.ParticleType.NuMu:
target = datum.record.signature.target_type
if target not in upscattering_vertices.keys():
upscattering_vertices[target] = []
upscattering_vertices[target].append(datum.record.interaction_vertex)
else:
decay_vertices.append(datum.record.interaction_vertex)

for k,vertices in upscattering_vertices.items():
vertices = np.array(vertices)
plt.scatter(vertices[:,2],vertices[:,0],label=k,alpha=0.3)
plt.xlabel('Z [m]')
plt.ylabel('X [m]')
plt.legend()
plt.show()
plt.savefig('Figures/%s_upscattering.png'%experiment,dpi=100)

decay_vertices = np.array(decay_vertices)
plt.scatter(decay_vertices[:,2],decay_vertices[:,0],alpha=0.3)
plt.xlabel('Z [m]')
plt.ylabel('X [m]')
plt.legend()
plt.show()
plt.savefig('Figures/%s_decay.png'%experiment,dpi=100)

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
200 changes: 200 additions & 0 deletions resources/Fluxes/BNB_Flux_Tables/BNB_nue_flux.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
2.500000000000000139e-02 3.059999999999999583e-13
7.500000000000001110e-02 1.144399999999999849e-12
1.250000000000000000e-01 2.545999999999999855e-12
1.749999999999999889e-01 2.461999999999999809e-12
2.250000000000000056e-01 2.084000000000000006e-12
2.750000000000000222e-01 2.156000000000000103e-12
3.249999999999999556e-01 2.185999999999999773e-12
3.750000000000000000e-01 2.172000000000000035e-12
4.250000000000000444e-01 2.122000000000000046e-12
4.749999999999999778e-01 2.068000000000000074e-12
5.250000000000000222e-01 2.001999999999999749e-12
5.749999999999999556e-01 1.930799999999999810e-12
6.250000000000000000e-01 1.839599999999999957e-12
6.750000000000000444e-01 1.760000000000000175e-12
7.249999999999999778e-01 1.693399999999999832e-12
7.750000000000000222e-01 1.601599999999999961e-12
8.249999999999999556e-01 1.548000000000000068e-12
8.750000000000000000e-01 1.478000000000000165e-12
9.250000000000000444e-01 1.384800000000000117e-12
9.749999999999999778e-01 1.323600000000000136e-12
1.024999999999999911e+00 1.247799999999999994e-12
1.075000000000000178e+00 1.207399999999999884e-12
1.125000000000000000e+00 1.126600000000000066e-12
1.174999999999999822e+00 1.089200000000000044e-12
1.225000000000000089e+00 1.002800000000000130e-12
1.274999999999999911e+00 9.676000000000000372e-13
1.325000000000000178e+00 9.039999999999999850e-13
1.375000000000000000e+00 8.699999999999999280e-13
1.424999999999999822e+00 8.056000000000000206e-13
1.475000000000000089e+00 7.866000000000000006e-13
1.524999999999999911e+00 7.392000000000000208e-13
1.575000000000000178e+00 6.909999999999999839e-13
1.625000000000000000e+00 6.570000000000000278e-13
1.674999999999999822e+00 6.117999999999999780e-13
1.725000000000000089e+00 5.769999999999999648e-13
1.774999999999999911e+00 5.606000000000000548e-13
1.825000000000000178e+00 5.147999999999999875e-13
1.875000000000000000e+00 4.861999999999999882e-13
1.924999999999999822e+00 4.595999999999999803e-13
1.975000000000000089e+00 4.330000000000000230e-13
2.024999999999999911e+00 4.084000000000000066e-13
2.075000000000000178e+00 3.734000000000000043e-13
2.125000000000000000e+00 3.525999999999999819e-13
2.174999999999999822e+00 3.312000000000000428e-13
2.225000000000000089e+00 3.089999999999999960e-13
2.274999999999999911e+00 2.970000000000000471e-13
2.325000000000000178e+00 2.721999999999999913e-13
2.375000000000000000e+00 2.562000000000000089e-13
2.424999999999999822e+00 2.379999999999999956e-13
2.475000000000000089e+00 2.259999999999999963e-13
2.524999999999999911e+00 2.085999999999999896e-13
2.575000000000000178e+00 1.959999999999999979e-13
2.625000000000000000e+00 1.766399999999999925e-13
2.674999999999999822e+00 1.721399999999999865e-13
2.725000000000000089e+00 1.545399999999999908e-13
2.774999999999999911e+00 1.457000000000000254e-13
2.825000000000000178e+00 1.358599999999999886e-13
2.875000000000000000e+00 1.274200000000000013e-13
2.924999999999999822e+00 1.154400000000000110e-13
2.975000000000000089e+00 1.097999999999999966e-13
3.024999999999999911e+00 9.977999999999999236e-14
3.075000000000000178e+00 9.311999999999999853e-14
3.125000000000000000e+00 8.421999999999999354e-14
3.174999999999999822e+00 8.141999999999999537e-14
3.225000000000000089e+00 7.637999999999999867e-14
3.274999999999999911e+00 6.991999999999999388e-14
3.325000000000000178e+00 6.329999999999999281e-14
3.375000000000000000e+00 5.844000000000000140e-14
3.424999999999999822e+00 5.248000000000000080e-14
3.475000000000000089e+00 4.978000000000000347e-14
3.524999999999999911e+00 4.551999999999999814e-14
3.575000000000000178e+00 4.155999999999999533e-14
3.625000000000000000e+00 3.773999999999999873e-14
3.674999999999999822e+00 3.431999999999999916e-14
3.725000000000000089e+00 3.205999999999999794e-14
3.774999999999999911e+00 2.896000000000000358e-14
3.825000000000000178e+00 2.676000000000000096e-14
3.875000000000000000e+00 2.430000000000000122e-14
3.924999999999999822e+00 2.342000000000000270e-14
3.975000000000000089e+00 1.984599999999999945e-14
4.025000000000000355e+00 1.861600000000000115e-14
4.074999999999999289e+00 1.671399999999999825e-14
4.125000000000000000e+00 1.527599999999999973e-14
4.175000000000000711e+00 1.351000000000000062e-14
4.224999999999999645e+00 1.308999999999999932e-14
4.275000000000000355e+00 1.194599999999999966e-14
4.324999999999999289e+00 1.051400000000000006e-14
4.375000000000000000e+00 9.289999999999999101e-15
4.425000000000000711e+00 8.607999999999999457e-15
4.474999999999999645e+00 7.655999999999999765e-15
4.525000000000000355e+00 6.820000000000000380e-15
4.574999999999999289e+00 6.282000000000000710e-15
4.625000000000000000e+00 5.762000000000000149e-15
4.675000000000000711e+00 4.995999999999999929e-15
4.724999999999999645e+00 4.446000000000000064e-15
4.775000000000000355e+00 4.110000000000000126e-15
4.824999999999999289e+00 3.638000000000000345e-15
4.875000000000000000e+00 3.184000000000000068e-15
4.925000000000000711e+00 2.813999999999999972e-15
4.974999999999999645e+00 2.484000000000000131e-15
5.025000000000000355e+00 2.284000000000000037e-15
5.074999999999999289e+00 2.055999999999999882e-15
5.125000000000000000e+00 1.684999999999999967e-15
5.175000000000000711e+00 1.481799999999999939e-15
5.224999999999999645e+00 1.314799999999999987e-15
5.275000000000000355e+00 1.118400000000000187e-15
5.324999999999999289e+00 9.579999999999999869e-16
5.375000000000000000e+00 8.399999999999999430e-16
5.425000000000000711e+00 6.305999999999999325e-16
5.474999999999999645e+00 5.960000000000000211e-16
5.525000000000000355e+00 4.723999999999999454e-16
5.574999999999999289e+00 4.436000000000000000e-16
5.625000000000000000e+00 3.667999999999999649e-16
5.675000000000000711e+00 3.514000000000000499e-16
5.724999999999999645e+00 2.734000000000000151e-16
5.775000000000000355e+00 2.271999999999999743e-16
5.824999999999999289e+00 1.837600000000000021e-16
5.875000000000000000e+00 1.493799999999999740e-16
5.925000000000000711e+00 1.300399999999999891e-16
5.974999999999999645e+00 1.102599999999999911e-16
6.025000000000000355e+00 9.141999999999998964e-17
6.074999999999999289e+00 8.730000000000000848e-17
6.125000000000000000e+00 4.293999999999999492e-17
6.175000000000000711e+00 4.644000000000000249e-17
6.224999999999999645e+00 3.096000000000000166e-17
6.275000000000000355e+00 2.563999999999999915e-17
6.324999999999999289e+00 2.097999999999999776e-17
6.375000000000000000e+00 1.645199999999999843e-17
6.425000000000000711e+00 1.659399999999999968e-17
6.474999999999999645e+00 1.228599999999999918e-17
6.525000000000000355e+00 1.710600000000000127e-17
6.574999999999999289e+00 9.410000000000000003e-18
6.625000000000000000e+00 8.773999999999999689e-18
6.675000000000000711e+00 1.034000000000000045e-17
6.724999999999999645e+00 6.098000000000000216e-18
6.775000000000000355e+00 3.223999999999999947e-18
6.824999999999999289e+00 3.212000000000000319e-18
6.875000000000000000e+00 2.361999999999999835e-18
6.925000000000000711e+00 3.919999999999999941e-18
6.974999999999999645e+00 1.558599999999999934e-18
7.025000000000000355e+00 3.141999999999999921e-18
7.074999999999999289e+00 2.338000000000000193e-18
7.125000000000000000e+00 0.000000000000000000e+00
7.175000000000000711e+00 0.000000000000000000e+00
7.224999999999999645e+00 0.000000000000000000e+00
7.275000000000000355e+00 0.000000000000000000e+00
7.324999999999999289e+00 0.000000000000000000e+00
7.375000000000000000e+00 0.000000000000000000e+00
7.425000000000000711e+00 0.000000000000000000e+00
7.474999999999999645e+00 0.000000000000000000e+00
7.525000000000000355e+00 0.000000000000000000e+00
7.574999999999999289e+00 0.000000000000000000e+00
7.625000000000000000e+00 0.000000000000000000e+00
7.675000000000000711e+00 0.000000000000000000e+00
7.724999999999999645e+00 0.000000000000000000e+00
7.775000000000000355e+00 0.000000000000000000e+00
7.824999999999999289e+00 0.000000000000000000e+00
7.875000000000000000e+00 0.000000000000000000e+00
7.925000000000000711e+00 0.000000000000000000e+00
7.974999999999999645e+00 0.000000000000000000e+00
8.025000000000000355e+00 0.000000000000000000e+00
8.074999999999999289e+00 0.000000000000000000e+00
8.125000000000000000e+00 0.000000000000000000e+00
8.175000000000000711e+00 0.000000000000000000e+00
8.224999999999999645e+00 0.000000000000000000e+00
8.275000000000000355e+00 0.000000000000000000e+00
8.324999999999999289e+00 0.000000000000000000e+00
8.375000000000000000e+00 0.000000000000000000e+00
8.425000000000000711e+00 0.000000000000000000e+00
8.474999999999999645e+00 0.000000000000000000e+00
8.525000000000000355e+00 0.000000000000000000e+00
8.574999999999999289e+00 0.000000000000000000e+00
8.625000000000000000e+00 0.000000000000000000e+00
8.675000000000000711e+00 0.000000000000000000e+00
8.724999999999999645e+00 0.000000000000000000e+00
8.775000000000000355e+00 0.000000000000000000e+00
8.824999999999999289e+00 0.000000000000000000e+00
8.875000000000000000e+00 0.000000000000000000e+00
8.925000000000000711e+00 0.000000000000000000e+00
8.974999999999999645e+00 0.000000000000000000e+00
9.025000000000000355e+00 0.000000000000000000e+00
9.074999999999999289e+00 0.000000000000000000e+00
9.125000000000000000e+00 0.000000000000000000e+00
9.175000000000000711e+00 0.000000000000000000e+00
9.224999999999999645e+00 0.000000000000000000e+00
9.275000000000000355e+00 0.000000000000000000e+00
9.324999999999999289e+00 0.000000000000000000e+00
9.375000000000000000e+00 0.000000000000000000e+00
9.425000000000000711e+00 0.000000000000000000e+00
9.474999999999999645e+00 0.000000000000000000e+00
9.525000000000000355e+00 0.000000000000000000e+00
9.574999999999999289e+00 0.000000000000000000e+00
9.625000000000000000e+00 0.000000000000000000e+00
9.675000000000000711e+00 0.000000000000000000e+00
9.724999999999999645e+00 0.000000000000000000e+00
9.775000000000000355e+00 0.000000000000000000e+00
9.824999999999999289e+00 0.000000000000000000e+00
9.875000000000000000e+00 0.000000000000000000e+00
9.925000000000000711e+00 0.000000000000000000e+00
9.974999999999999645e+00 0.000000000000000000e+00
Loading

0 comments on commit 673b414

Please sign in to comment.