예제 #1
0
파일: icecube.py 프로젝트: jlazar17/dm
def MuonRange(E, param):
    """ Calculates muon range on ice using PDG data using the muon energy.
    
    Ref. PDG data for Ice
    http://pdg.lbl.gov/2010/AtomicNuclearProperties/HTML_PAGES/325.html

    @type   E       :   float
    @param  E       :   muon energy [eV]
    @type   param   :   physicsconstants
    @param  param   :   set of physical parameters to be used.
    
    @rtype       :   float
    @return      :   range [m]
    """
    # load muon range pdg-data #
    filename = "muonloss_325.dat"
    file = open(global_datapath + filename, 'r')
    h, dat = gt.hreadfilev2(file)

    rho_ice = IC.rho_ice * param.gr / param.cm**3
    dat = np.array(dat)
    E_mu = dat[:, 0]
    Range = dat[:, -3] * param.gr / param.cm**2

    inter_range = interpolate.interp1d(E_mu, Range)

    return (inter_range(E / param.MeV) / rho_ice) / param.meter
예제 #2
0
def LoadBoosterFlux(mbparam):
    """ Reads booster flux and stores it in memory.
    
    Ref. : A.A. Aguilar-Arevalo et al., "Measurement of Neutrino-Induced Charged Current-Charged Pion Production Cross Sections on Mineral Oil at Enu ~ 1 GeV"
    arXiv:1011.3572 [hep-ex]
    
    Data : http://www-boone.fnal.gov/for_physicists/data_release/ccpip/

    @type   mbparam   :   miniboone_config
    @param  mbparam   :   miniboone run configuration
    
    @rtype            :   array
    @return           :   raw flux data array
    """
    if mbparam.Beam.LoadFlux == [] or mbparam.Beam.LoadHornPolarity != mbparam.Beam.HornPolarity:
        if mbparam.Beam.HornPolarity == "positive":
            file = open(global_datapath + "pospolarity_fluxes.dat", 'r')
        elif mbparam.Beam.HornPolarity == "negative":
            file = open(global_datapath + "negpolarity_fluxes.dat", 'r')
        else:
            print "Wrong horn polarity."
            quit()
        h, dat = gt.hreadfilev2(file)
        file.close()
        mbparam.Beam.LoadFlux = dat
        mbparam.Beam.LoadHornPolarity = mbparam.Beam.HornPolarity
        return dat
    else:
        return mbparam.Beam.LoadFlux
예제 #3
0
def MINOSEfficiency(E,mparam):
    """ Returns CC-event efficiencies for MINOS far detector.
  
      @type   E 	:	float
      @param  E 	:	energy  [eV]
      @type   mparam 	:	minos config. parameters
      @param  mparam 	:	minos configuration information/parameters
    
      @rtype	        :	float
      @return	        :	CC-event efficiency
    """
    file  = open(global_datapath + "MINOS_CC_efficiency.dat",'r')
    h,dat = gt.hreadfilev2(file)
    
    Enu   = np.array(dat)[:,0]
    Eff   = np.array(dat)[:,1]
    if E/mparam.GeV <= Enu[-1]:
        eff_interpolate = interpolate.interp1d(Enu,Eff)
        return eff_interpolate(E/mparam.GeV)
    else :
        return Eff[-1]
예제 #4
0
class Sun():
    name = "Sun"

    file = open(datapath + 'bs05_agsop.dat', 'r')
    header, SSM = gt.hreadfilev2(file)

    ## Begin Loading Standar Solar Model ##
    SSM = np.array(SSM)
    M = SSM[:, 0]
    R = SSM[:, 1]
    T = SSM[:, 2]
    Rho = SSM[:, 3]
    P = SSM[:, 4]
    Luminosity = SSM[:, 5]
    X = SSM[:, 6]
    ## End Loading Standard Solar Model ##

    SunRadius = 694439.0  # [km]
    Radius = 694439.0  # [km]

    # Define interpolators
    # spline interpolator
    #inter_rdensity  = interpolate.UnivariateSpline(R,Rho)
    #inter_rxh       = interpolate.UnivariateSpline(R,X)

    # linear interpolator
    inter_rdensity = interpolate.interp1d(R, Rho)
    inter_rxh = interpolate.interp1d(R, X)

    def rdensity(self, r):
        # Density at a distance r from Sun center normalize to sun radius
        if (r <= self.R[-1] and r >= self.R[0]):
            return self.inter_rdensity(r)
        elif (r < self.R[0]):
            return self.Rho[0]
        else:
            return 0.0

    def rxh(self, r):
        # mean molecular density at distance r from center
        if (r <= self.R[-1] and r >= self.R[0]):
            return self.inter_rxh(r)
        elif (r < self.R[0]):
            return self.X[0]
        elif (r > self.R[-1]):
            return self.X[-1]
        else:
            return 0.0

    def rye(self, r):
        # mean molecular density at distance r from center
        return 0.5 * (1.0 + self.rxh(r))

    def rRNC(self, r):
        # ratio between neutral and charge current
        ye = self.rye(r)
        return -0.5 * (1.0 - ye) / ye

    def density(self, track):
        # Returns sun density at a given track position
        # considering radial motion
        # in this case geometry is trivial
        xkm = track.x / pc.km
        r = xkm / self.SunRadius
        if (r <= self.R[-1] and r >= self.R[0]):
            return np.max(self.inter_rdensity(r), 0.0)
        elif (r < self.R[0]):
            return self.Rho[0]
        else:
            return 0.0
        #return self.rdensity(xkm/self.SunRadius)

    def ye(self, track):
        # Electron mean molecular weight
        # from J. Bacahall New Journal of Physics 6 (2004) 63, p.8
        xkm = track.x / pc.km
        r = xkm / self.SunRadius
        return 0.5 * (1.0 + self.rxh(r))
        #return self.rye(xkm/self.SunRadius)

    def RNC(self, track):
        # ratio between neutral and charge current
        xkm = track.x / pc.km
        return self.rRNC(xkm / self.SunRadius)

    @innerclass
    class track():
        # in this case track information is trivial
        def __init__(self, xini, xend):
            # x : current position [eV]
            # xini : Initial radius [eV]
            # xendf : Final radius [eV]
            self.x = xini
            self.xini = xini
            self.xend = xend
예제 #5
0
    #print prob
    #
    ##E = 10.0*pcc.GeV
    ##prob = [no.AdiabaticProbability(i,i,E,0.05,Sun,PMNS,fM2,pcc) for i in range(3)]
    ##print prob
    #
    #quit()

    #PlotNeuCompositionCompare(250*pc.GeV,Sun,pcc,pc)
    #quit()

    #PlotDM_Icecube(pcc,pc)
    PlotDM_MTonDetector(pcc, pc)
    quit()
    datapath = "../data/"

    import generaltools as gt

    file = open(
        datapath +
        "DataNeuOscProb_RK_antineutrino_Emin_1.0_GeV_Emax_1000.0_GeV_ineu_2_param_2+3.dat",
        'r')
    h, d = gt.hreadfilev2(file)

    E = np.array(d)[:, 0]
    P = np.array(d)[:, 1]

    plt.plot(E, P)

    plt.show()
예제 #6
0
class SunASnu():
    name = "SunASnu"
    id = 7
    file = open(datapath + 'bs05_agsop.dat', 'r')
    header, SSM = gt.hreadfilev2(file)

    ## Begin Loading Standard Solar Model ##
    SSM = np.array(SSM)
    M = SSM[:, 0]
    R = SSM[:, 1]
    T = SSM[:, 2]
    Rho = SSM[:, 3]
    P = SSM[:, 4]
    Luminosity = SSM[:, 5]
    X = SSM[:, 6]
    ## End Loading Standard Solar Model ##

    SunRadius = 694439.0  # [km]
    Radius = 694439.0  # [km]

    # Define interpolators
    # spline interpolator
    #inter_rdensity  = interpolate.UnivariateSpline(R,Rho)
    #inter_rxh       = interpolate.UnivariateSpline(R,X)

    # linear interpolator
    inter_rdensity = interpolate.interp1d(R, Rho)
    inter_rxh = interpolate.interp1d(R, X)

    def __init__(self):
        self.bodyparams = []

    def rdensity(self, r):
        # Density at a distance r from Sun center normalize to sun radius
        if (r <= self.R[-1] and r >= self.R[0]):
            return self.inter_rdensity(r)
        elif (r < self.R[0]):
            return self.Rho[0]
        else:
            return 0.0

    def rxh(self, r):
        # mean molecular density at distance r from center
        if (r <= self.R[-1] and r >= self.R[0]):
            return self.inter_rxh(r)
        elif (r < self.R[0]):
            return self.X[0]
        elif (r > self.R[-1]):
            return self.X[-1]
        else:
            return 0.0

    def rye(self, r):
        # mean molecular density at distance r from center
        return 0.5 * (1.0 + self.rxh(r))

    def rRNC(self, r):
        # ratio between neutral and charge current
        ye = self.rye(r)
        return -0.5 * (1.0 - ye) / ye

    def density(self, track):
        # Returns sun density at a given track position
        # considering radial motion

        # geometry follows from simple triangles

        xkm = track.x / pc.km
        bkm = track.b_impact / pc.km
        Rsun = self.Radius
        Rsun2 = Rsun * Rsun

        # normalized radius : 0 -> center, 1 -> surface
        r = np.sqrt(Rsun2 + xkm * xkm -
                    2 * xkm * np.sqrt(Rsun2 - bkm * bkm)) / Rsun

        if (r <= self.R[-1] and r >= self.R[0]):
            return np.max(self.inter_rdensity(r), 0.0)
        elif (r < self.R[0]):
            return self.Rho[0]
        else:
            return 0.0

    #return self.rdensity(xkm/self.SunRadius)

    def ye(self, track):
        # Electron mean molecular weight
        # from J. Bacahall New Journal of Physics 6 (2004) 63, p.8
        # geometry follows from simple triangles

        xkm = track.x / pc.km
        bkm = track.b_impact / pc.km
        Rsun = self.Radius
        Rsun2 = Rsun * Rsun

        # normalized radius : 0 -> center, 1 -> surface
        r = np.sqrt(Rsun2 + xkm * xkm -
                    2 * xkm * np.sqrt(Rsun2 - bkm * bkm)) / Rsun

        return 0.5 * (1.0 + self.rxh(r))

    #return self.rye(xkm/self.SunRadius)

    def RNC(self, track):
        # ratio between neutral and charge current
        xkm = track.x / pc.km
        return self.rRNC(xkm / self.SunRadius)

    @innerclass
    class track():
        """ Creates the Track object for the SunASnu
        """
        def __init__(self, xini, b_impact):
            """ Defines the neutrino trayectory in the Sun for a
                given impact parameter.
                
                @type   xini  :   float
                @param  xini  :   initial position in baseline [eV^-1]
                @type   xend  :   float
                @param  xend  :   final position in baseline [eV^-1]
                @type   b_impact  :   float
                @param  b_impact  :   impact parameter (creation radius) [eV^-1]
                
                @rtype        :   Body.Track
                @return
            """
            Radius = 694439.0 * pc.km

            self.x = xini
            self.xini = xini
            # full baseline
            self.xend = 2.0 * np.sqrt(Radius * Radius - b_impact * b_impact)
            self.b_impact = b_impact
            self.trackparams = [xini, b_impact]