Пример #1
0
def makeTheWorld():
    manager = ROOT.AOpticsManager("manager", "manager")
    worldbox = ROOT.TGeoBBox("worldbox", 1 * m, 1 * m, 1 * m)
    world = ROOT.AOpticalComponent("world", worldbox)
    manager.SetTopVolume(world)

    return manager
def MakeGeometry():
    # Make the geometry of a simple parabolic telescope
    manager = ROOT.AOpticsManager("manager", "SimpleParabolicTelescope")
    manager.SetNsegments(
        100)  # Set the smoothness of surface drawing. Display use only.

    # Make the world
    worldbox = ROOT.TGeoBBox("worldbox", 10 * m, 10 * m, 10 * m)
    world = ROOT.AOpticalComponent("world", worldbox)
    manager.SetTopVolume(world)

    # Define a paraboloid for the mirror
    para = ROOT.TGeoParaboloid("mirror_para", 0, kMirrorRad, kMirrorSag / 2.)

    mirror_tr1 = ROOT.TGeoTranslation("mirror_tr1", 0, 0, kMirrorSag / 2.)
    mirror_tr1.RegisterYourself()
    mirror_tr2 = ROOT.TGeoTranslation("mirror_tr2", 0, 0,
                                      kMirrorSag / 2. - 1 * um)
    mirror_tr2.RegisterYourself()

    # Composite two TGeoParaboloid to make a thin parabolic surface
    mirror_comp = ROOT.TGeoCompositeShape(
        "mirror_comp", "mirror_para:mirror_tr2 - mirror_para:mirror_tr1")

    # Make a parabolic mirror
    mirror = ROOT.AMirror("mirror", mirror_comp)
    world.AddNode(mirror, 1)

    # Define a tube for the forcal surface
    focal_tube = ROOT.TGeoTube("focal_tube", 0, kFocalRad, 10 * um)

    focal_tr = ROOT.TGeoTranslation("focal_tr", 0, 0, kFocalLength + 10 * um)
    focal_tr.RegisterYourself()

    # Make a focal surface
    focal = ROOT.AFocalSurface("focal", focal_tube)
    world.AddNode(focal, 1, focal_tr)

    obs_tube1 = ROOT.TGeoTube("obs_tube1", 0, kFocalRad + 10 * um, 10 * um)
    obs_tr1 = ROOT.TGeoTranslation("obs_tr1", 0, 0, kFocalLength + 30 * um)
    obs_tr1.RegisterYourself()

    # Make a dummy obscuration behind the focal plane
    obs1 = ROOT.AObscuration("obs1", obs_tube1)
    world.AddNode(obs1, 1, obs_tr1)

    obs_tube2 = ROOT.TGeoTube("obs_tube2", kFocalRad, kFocalRad + 10 * um,
                              10 * um)
    obs_tr2 = ROOT.TGeoTranslation("obs_tr2", 0, 0, kFocalLength + 10 * um)
    obs_tr2.RegisterYourself()

    # Make one more obscuration surrounding the focal plane
    obs2 = ROOT.AObscuration("obs2", obs_tube2)
    world.AddNode(obs2, 1, obs_tr2)

    manager.CloseGeometry()

    world.Draw("ogl")  # GL View does not work in PyROOT

    return manager
Пример #3
0
def makeTheWorld():
    global world, worldbox  # avoid automatic deletion and C++ seg fault
    manager = ROOT.AOpticsManager("manager", "manager")
    worldbox = ROOT.TGeoBBox("worldbox", 1 * m, 1 * m, 1 * m)
    world = ROOT.AOpticalComponent("world", worldbox)
    manager.SetTopVolume(world)

    return manager