def setup_converter(useGeant4=False): # make a converter if useGeant4: ppcConverter = clsim.I3CLSimLightSourceToStepConverterGeant4() else: ppcConverter = clsim.I3CLSimLightSourceToStepConverterPPC( photonsPerStep=200) # initialize it randomGen = phys_services.I3SPRNGRandomService(seed=123456, nstreams=10000, streamnum=1) mediumProperties = clsim.MakeIceCubeMediumProperties() #DOMRadius = 0.16510*icetray.I3Units.m # 13" diameter #RadiusOverSizeFactor = 5. #domAcceptance = clsim.GetIceCubeDOMAcceptance(domRadius = DOMRadius*RadiusOverSizeFactor) domAcceptance = clsim.I3CLSimFunctionConstant(1.) # lets set it up ppcConverter.SetMediumProperties(mediumProperties) ppcConverter.SetRandomService(randomGen) ppcConverter.SetWlenBias(domAcceptance) ppcConverter.SetMaxBunchSize(10240) ppcConverter.SetBunchSizeGranularity(1) ppcConverter.Initialize() return ppcConverter
def __init__(self, IceModelDir): self.depths, Sca_dat, Abs_dat, temp = np.loadtxt(IceModelDir + '/icemodel.dat', unpack=True) self.m, self.iceParams = clsim.MakeIceCubeMediumProperties( iceDataDirectory=expandvars(IceModelDir), returnParameters=True) self.Sca = [] self.Abs = [] for i in range(0, len(self.depths)): # CLSim defines the ScatteringLength as the scattering_coeff/(1-cos(dir)), where cos(dir) ==0.9 self.Sca.append( self.m.GetScatteringLength(i).b400 ) # CLSim changes the effective scattering coefficient to the scattering coefficient by dividing by 10. # Note: This is just the absorption due to dust. There is another term in PPC that is for the absorption of ice. # We'll just use the absorption of dust as an approximation. totalAbs = aDust + aIce self.Abs.append(self.m.GetAbsorptionLength(i).aDust400) self.Sca = np.array(self.Sca) self.Abs = np.array(self.Abs) # For some reason, the Abs of the deepest layer is set to 999. This messes with our Fourier Transform. # Let's Decapatate our Abs and Sca and then stitch them back together in a second self.Sca_Head = self.Sca[0] self.Abs_Head = self.Abs[0] self.Abs = np.delete(self.Abs, 0) self.Sca = np.delete(self.Sca, 0) # Calculate Central Models via log perscription self.Central_Plus = 0.5 * np.log10(self.Abs * self.Sca) self.Central_Minus = 0.5 * np.log10(self.Abs / self.Sca) # Get Central Fourier Series self.Central_FS_Plus = FourierSeries(self.depths[1:], self.Central_Plus)
print("deleted (host)") num = [] for number in num_orig: num.append( float(number) / float(samples) / float(range_width / float(numBins))) num = numpy.array(num) bins = numpy.array(bins[:-1]) + (bins[1] - bins[0]) / 2. return dict(num=num, bins=bins) beta = 1. mediumProps = clsim.MakeIceCubeMediumProperties() domAcceptance = clsim.GetIceCubeDOMAcceptance() flatAcceptance = clsim.I3CLSimFunctionConstant(1.) phaseRefIndex = mediumProps.GetPhaseRefractiveIndex(0) wlen_range = (mediumProps.GetMinWavelength() / I3Units.nanometer, mediumProps.GetMaxWavelength() / I3Units.nanometer) genWavelength = clsim.makeCherenkovWavelengthGenerator(domAcceptance, False, mediumProps) histGenWavelength = genMCHistogramsOpenCL(genWavelength, hist_range=wlen_range) histGenWavelengthHost = genMCHistogramsHost(genWavelength, hist_range=wlen_range) numberOfPhotonsPerMeter = clsim.NumberOfPhotonsPerMeter( phaseRefIndex, domAcceptance, wlen_range[0] * I3Units.nanometer, wlen_range[1] * I3Units.nanometer)
loc=loc, ) at.patch.set_boxstyle("round,pad=0.,rounding_size=0.2") plot.add_artist(at) #modelName="AHA" #meanCos=0.94 modelName = "SPICE-Mie" if modelName == "AHA": meanCosString = "%4.2f" % meanCos meanCosString2 = "%03.0f" % (meanCos * 100) mediumPropsPPC = clsim.MakeIceCubeMediumProperties( iceDataDirectory=expandvars( "$I3_BUILD/clsim/resources/ice/ppc_aha_%s/" % meanCosString)) photonicsFilename = "Ice_table.aha.i3coords.cos%s.17may2007.txt" % meanCosString2 photonicsFilenameLatex = "Ice\_table.aha.i3coords.cos%s.17may2007.txt" % meanCosString2 mediumPropsPhotonics = clsim.MakeIceCubeMediumPropertiesPhotonics( tableFile=expandvars("$I3_BUILD/clsim/resources/ice/photonics_aha/" + photonicsFilename)) elif modelName == "SPICE-Mie": meanCos = 0.9 # override the cosine theta mediumPropsPPC = clsim.MakeIceCubeMediumProperties( iceDataDirectory=expandvars( "$I3_BUILD/ice-models/resources/models/spice_mie/")) photonicsFilename = "Ice_table.mie.i3coords.cos090.08Apr2011.txt" photonicsFilenameLatex = "Ice\_table.mie.i3coords.cos090.08Apr2011.txt"
""" Test whether cascade extension can be disabled in the PPC parameterizations """ from icecube import icetray, dataclasses, clsim, phys_services p = dataclasses.I3Particle() p.pos = dataclasses.I3Position(0, 0, 0) p.dir = dataclasses.I3Direction(0, 0, 1) p.time = 0 p.energy = 1 p.type = p.EMinus source = clsim.I3CLSimLightSource(p) converter = clsim.I3CLSimLightSourceToStepConverterPPC() converter.SetWlenBias(clsim.GetIceCubeDOMAcceptance()) converter.SetMediumProperties(clsim.MakeIceCubeMediumProperties()) converter.SetRandomService(phys_services.I3GSLRandomService(0)) converter.Initialize() converter.EnqueueLightSource(source, 1) steps = converter.GetConversionResult() assert all([s.pos.z > 0 for s in steps]), "Steps are spread along the cascade by default" converter.SetUseCascadeExtension(False) converter.EnqueueLightSource(source, 2) steps = converter.GetConversionResult() assert all([s.pos.z == 0 for s in steps]), "Steps are all at the origin"