def MMCFactory(length=10*I3Units.m, seed=12345, impl='mmc', mediadef=None):

	if impl == 'mmc':
		from icecube import c2j_icetray, mmc_icetray
		if mediadef is None:
			mediadef=expandvars('$I3_BUILD/MuonGun/resources/iceworld-mediadef')
		# Now create the MMC propagators, but first *all* of the options must be set here. 
		# There's no special options added behind the scenes.  This is much more flexible. 
		#  Below are the standard options.  To interpret them see the MMC docs.
		mmcOpts = "-romb=5 -raw -user -sdec -time -lpm -bs=1 -ph=3 -bb=2 -sh=2 -frho -cont "
		mmcOpts += expandvars("-tdir=$I3_BUILD/mmc-icetray/resources ")
		mmcOpts += expandvars("-mediadef=%s " % mediadef)
		mmcOpts += "-radius=100000 "
		mmcOpts += "-length=%d " % length
		mmcOpts += "-seed=%d " % seed
	
		jvmOpts = icetray.vector_string()    # fill this with parameters passed directly to the JavaVM
		jvmOpts.append(expandvars("-Djava.class.path=$I3_BUILD/lib/mmc.jar"))
		jvmOpts.append("-Xms256m")
		jvmOpts.append("-Xmx512m")
		jvmOpts.append("-XX:-HeapDumpOnOutOfMemoryError")
		jvmOpts.append("-XX:+TraceHPI")

		jvm = c2j_icetray.I3JavaVM(jvmOpts)
		return mmc_icetray.I3PropagatorServiceMMC(jvm,mmcOpts)
	else:
		from icecube import PROPOSAL_icetray
		# in PROPOSAL everything can be defined in the configuration file
		if mediadef is None:
			mediadef=expandvars('$I3_BUILD/PROPOSAL/resources/config_iceworld.json')
		return PROPOSAL_icetray.I3PropagatorServicePROPOSAL(config_file=mediadef)
Esempio n. 2
0
def MakePropagator(
    radius=800 * I3Units.m,
    length=1600 * I3Units.m,
    particleType=dataclasses.I3Particle.ParticleType.MuMinus,
    impl='proposal',
    mediadef=expandvars('$I3_BUILD/mmc-icetray/resources/mediadef')):
    """
        Create a muon propagator service.

        :param radius: radius of the target cylinder
        :param length: full height of the target cylinder
        :param impl: if "mmc", use MMC, otherwise use PROPOSAL
        :param mediadef: path to MMC media definition file
        """

    seed = 12345  # fixed seed, RNG will be re-set by the propagator module

    if impl.lower() == 'mmc':
        from icecube import sim_services, c2j_icetray, mmc_icetray, icetray
        jvmOpts = icetray.vector_string(
        )  # fill this with parameters passed directly to the JavaVM
        jvmOpts.append(expandvars("-Djava.class.path=$I3_BUILD/lib/mmc.jar"))
        jvmOpts.append("-Xms256m")
        jvmOpts.append("-Xmx512m")
        jvmOpts.append("-XX:-HeapDumpOnOutOfMemoryError")

        # Now create the MMC propagators, but first *all* of the options must be set here.
        # There's no special options added behind the scenes.  This is much more flexible.
        #  Below are the standard options.  To interpret them see the MMC docs.
        mmcOpts = "-romb=5 -raw -user -sdec -time -lpm -bs=1 -ph=3 -bb=2 -sh=2 -frho -cont "
        mmcOpts += expandvars("-tdir=$I3_BUILD/mmc-icetray/resources ")
        mmcOpts += expandvars("-mediadef=%s " % mediadef)
        mmcOpts += "-radius=%d " % radius
        mmcOpts += "-length=%d " % length
        mmcOpts += "-seed=%d " % seed

        if particleType in [
                dataclasses.I3Particle.ParticleType.MuMinus,
                dataclasses.I3Particle.ParticleType.MuPlus
        ]:
            pass  # no extra options necessary
        elif particleType in [
                dataclasses.I3Particle.ParticleType.TauMinus,
                dataclasses.I3Particle.ParticleType.TauPlus
        ]:
            mmcOpts += "tau "
        else:
            raise RuntimeError("Cannot propagate particle type!")

        jvm = c2j_icetray.I3JavaVM(jvmOpts)
        return mmc_icetray.I3PropagatorServiceMMC(jvm, mmcOpts)
    elif impl.lower() == 'proposal':
        from icecube import sim_services, PROPOSAL
        return PROPOSAL.I3PropagatorServicePROPOSAL(mediadef=mediadef,
                                                    cylinderRadius=radius,
                                                    cylinderHeight=length,
                                                    type=particleType)
    else:
        raise RuntimeError("unknown propagator: %s" % impl)
Esempio n. 3
0
def MMCFactory(
    length=10 * I3Units.m,
    seed=12345,
    mediadef=expandvars('$I3_BUILD/MuonGun/resources/iceworld-mediadef')):
    jvmOpts = icetray.vector_string(
    )  # fill this with parameters passed directly to the JavaVM
    jvmOpts.append(expandvars("-Djava.class.path=$I3_BUILD/lib/mmc.jar"))
    jvmOpts.append("-Xms256m")
    jvmOpts.append("-Xmx512m")
    jvmOpts.append("-XX:-HeapDumpOnOutOfMemoryError")

    jvm = c2j_icetray.I3JavaVM(jvmOpts)

    # Now create the MMC propagators, but first *all* of the options must be set here.
    # There's no special options added behind the scenes.  This is much more flexible.
    #  Below are the standard options.  To interpret them see the MMC docs.
    mmcOpts = "-romb=5 -raw -user -sdec -time -lpm -bs=1 -ph=3 -bb=2 -sh=2 -frho -cont "
    mmcOpts += expandvars("-tdir=$I3_BUILD/mmc-icetray/resources ")
    mmcOpts += expandvars("-mediadef=%s " % mediadef)
    mmcOpts += "-radius=100000 "
    mmcOpts += "-length=%d " % length
    mmcOpts += "-seed=%d " % seed

    return mmc_icetray.I3PropagatorServiceMMC(jvm, mmcOpts)