Esempio n. 1
0
import numpy as np

# get service

#
# for logging
#
icetray.I3Logger.global_logger = icetray.I3PrintfLogger()
icetray.set_log_level(icetray.I3LogLevel.LOG_INFO)
#icetray.set_log_level_for_unit("EarthModelService",icetray.I3LogLevel.LOG_TRACE)

#tray = I3Tray()

#tray.Add("I3EarthModelServiceFactory","earthmodel")
service = earthmodel_service.EarthModelService("EarthModelService","",
                                               [], [], "SimpleIceCap", 
                                               20.0*I3Units.degree, 1948*I3Units.m);

elog10 = 12
#elog10 = -0.3 #0.5GeV
#elog10 = -0.5 #0.3GeV
#elog10 = -0.7 #0.2GeV
energy = math.pow(10, elog10)
#isTau = True
isTau = False
isReverse = True
scale = 1

range = earthmodel_service.EarthModelCalculator.lepton_range(
                            energy, isTau,
                            earthmodel_service.EarthModelCalculator.default,
Esempio n. 2
0
#
# for logging
#
icetray.I3Logger.global_logger = icetray.I3PrintfLogger()
icetray.set_log_level(icetray.I3LogLevel.LOG_WARN)
#icetray.set_log_level_for_unit("EarthModelService",icetray.I3LogLevel.LOG_TRACE)

# 
# generate earthmodel service
#

print("*** flat density integration test ***")

earthmodel = ["PREM_mmc", "FLATCORE_5.568"]
earth1 = earthmodel_service.EarthModelService("EarthModelService","",
                              earthmodel)

r = 3480000; 
orig = dataclasses.I3Position(0, 0, 0); 
to = dataclasses.I3Position(0, 0, r);

pass1 = earth1.integrate_density_in_cgs(orig, to, earthmodel_service.path) ;
pass2 = earth1.integrate_density_in_cgs(orig, to, earthmodel_service.radius) ; 
         
print("pass1 = %g pass2 = %g" % (pass1, pass2));
assert(pass1 == pass2)
                                                                          
mass = earth1.integrate_density_in_cgs(orig, to, earthmodel_service.sphere) ;                                                                
         
# manual calculation of mass
r_cm = r*1e2;
Esempio n. 3
0
#
icetray.I3Logger.global_logger = icetray.I3PrintfLogger()
icetray.set_log_level(icetray.I3LogLevel.LOG_WARN)
#icetray.set_log_level_for_unit("EarthModelService",icetray.I3LogLevel.LOG_TRACE)
#icetray.set_log_level_for_unit("I3NuG",icetray.I3LogLevel.LOG_TRACE)
#icetray.set_log_level_for_unit("I3NuG",icetray.I3LogLevel.LOG_INFO)
icetray.set_log_level_for_unit("I3NuG", icetray.I3LogLevel.LOG_ERROR)

# generate random service
random = phys_services.I3SPRNGRandomService(1, 10000, 1)

# generate earthmodel service
earthmodel = ["PREM_mmc"]
materialmodel = ["Standard"]
earth = earthmodel_service.EarthModelService("EarthModelService", "",
                                             earthmodel, materialmodel,
                                             "IceSheet", 30. * I3Units.degree,
                                             1948 * I3Units.m)

steer = neutrino_generator.Steering(earth)

icetray.logging.log_info(
    "default steer injection mode is %s" % (steer.injection_mode), "steering")
icetray.logging.log_info(
    "default steer vtc genmode is %s" % (steer.vtx_gen_mode), "steering")

# generate interaction CC
nuCC = neutrino_generator.InteractionCC(random, steer)
nuCC.initialize_crossection_table(
    CS_PATH + "/csms/total_nu_CC_iso_NLO_HERAPDF1.5NLO_EIG.dat")
nuCC.initialize_finalstate_table(
    CS_PATH + "/csms/xy_nu_CC_iso_NLO_HERAPDF1.5NLO_EIG_xy.dat")
Esempio n. 4
0
from I3Tray import *
from icecube import icetray, dataio, dataclasses, earthmodel_service 

import math
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

minthetadeg = float(0)
maxthetadeg = float(30.) 
earthmodel = 'PREM_mmc'
capangle = float(30.0 / 180. * math.pi)

service = earthmodel_service.EarthModelService("EarthModelService","",
                                               [earthmodel], [], "SimpleIceCap", 
                                               capangle, 1948*I3Units.m);

fig = plt.figure()
#ax = fig.add_subplot(111, projection='3D')
ax = fig.add_subplot(111)

n = 10000
mintheta = minthetadeg / 180. * math.pi
maxtheta = maxthetadeg / 180. * math.pi
rmin     = service.moho_boundary
rmax     = service.ice_air_boundary
print("rmin = %f, rmax = %f" % (rmin, rmax))

def randrange(n, vmin, vmax):
    return (vmax-vmin)*np.random.rand(n) + vmin
Esempio n. 5
0
# for logging
#
icetray.I3Logger.global_logger = icetray.I3PrintfLogger()
icetray.set_log_level(icetray.I3LogLevel.LOG_WARN)

minzen = 80
maxzen = 100

#
# generate earthmodel service
#

earthmodel = ["PREM_mmc"]
materialmodel = ["Standard"]
earth1 = earthmodel_service.EarthModelService("EarthModelService", "",
                                              earthmodel, materialmodel,
                                              "IceSheet", 30. * I3Units.degree,
                                              1948 * I3Units.m)

earth2 = earthmodel_service.EarthModelService("EarthModelService", "",
                                              earthmodel, materialmodel,
                                              "SimpleIceCap",
                                              30. * I3Units.degree,
                                              1948 * I3Units.m)

earth3 = earthmodel_service.EarthModelService("EarthModelService", "",
                                              earthmodel, materialmodel,
                                              "SimpleIceCap",
                                              20. * I3Units.degree,
                                              1948 * I3Units.m)

earth4 = earthmodel_service.EarthModelService("EarthModelService", "",
Esempio n. 6
0
#!/usr/bin/env python

from I3Tray import *
from icecube import icetray, dataclasses, dataio, earthmodel_service

import numpy as np
import matplotlib.pyplot as plt

# get service
service = earthmodel_service.EarthModelService("EarthModelService", "",
                                               ["PREM_mmc"], [], "IceSheet",
                                               20.0 * I3Units.degree,
                                               1948 * I3Units.m)

params = service.get_earth_params_list()


def rescale_param(params, scale):
    for index, param in enumerate(params):
        #print "original param", param
        params[index] = scale * param
        #print "mod param", params[index]


def rescale(earth_params, r1, r2, coreedge, outfname):
    f = open(outfname, 'w')
    for earth_param in earth_params:
        # copy earthparam
        param = earthmodel_service.EarthParam(earth_param)

        #print earth_param.print_density()
Esempio n. 7
0
icetray.set_log_level(icetray.I3LogLevel.LOG_TRACE)

#icetray.set_log_level_for_unit("EarthModelService",icetray.I3LogLevel.LOG_TRACE)
# icetray.set_log_level_for_unit("I3NuG",icetray.I3LogLevel.LOG_TRACE)
# icetray.logging.set_level_for_unit('I3PropagatorModule', 'TRACE')

#
# generate random service
#
random = phys_services.I3SPRNGRandomService(1, 10000, 1)

#
# generate earthmodel service
#
earth = earthmodel_service.EarthModelService("EarthModelService", "",
                                             earthmodel, materialmodel,
                                             icecapmodel, icecapangle,
                                             detdepth)

#
# generate steering service
#
steer = neutrino_generator.Steering(earth, neutrino_generator.full,
                                    neutrino_generator.nugen, injectionmode)

steer.cylinder_params = cylinderparams

#
# generate interaction service
#
interaction = neutrino_generator.I3NuGInteractionInfo(random, steer, xsecmodel)
interaction.initialize()