예제 #1
0
fid = ROOT.TFile("../output_{0}.root".format(suffix), "UPDATE")

hhits = ROOT.TH1F("hhits", "", 1, 0, 2)
hsims = ROOT.TH1F("hsims", "", 1, 0, 2)
hhits.Fill(1, ntrajs)
hsims.Fill(1, ntotaltrajs)
hhits.Write()
hsims.Write()

fid.Close()

if mode == "VIS" or visWithStats:
    plt.figure(num=1, figsize=(15, 7))

    Drawing.Draw3Dtrajs(trajs, subplot=121)

    Drawing.DrawLine(c1, c2, is3d=True)
    Drawing.DrawLine(c2, c3, is3d=True)
    Drawing.DrawLine(c3, c4, is3d=True)
    Drawing.DrawLine(c4, c1, is3d=True)

    for i in range(len(intersects)):
        Drawing.DrawLine(intersects[i],
                         intersects[i],
                         is3d=True,
                         linestyle='None',
                         marker='o',
                         color='r')

    Drawing.DrawXYslice(trajs, subplot=122)
예제 #2
0
trajs = [None for i in init_p]
for i in range(len(init_p)):
    x0 = np.array([0, 0, 0] + init_p[i])
    trajs[i] = Integrator.rk4(x0, dt, nsteps)

fig = plt.figure(1, figsize=(14.5, 5.5))

## Do the drawing. the Drawing module contains methods to do this automatically

## XZ slice
plt.subplot2grid((1, 5), (0, 0), colspan=3)
Drawing.DrawXZslice(trajs, colors=colors, ax=plt.gca(), drawBField=True)

plt.axis([-15, 15, -9, 9])
plt.xlabel("z (m)")
plt.ylabel("x (m)")

## xy slice
plt.subplot2grid((1, 5), (0, 3), colspan=2)
Drawing.DrawXYslice(trajs, ax=plt.gca())

plt.axis([-9, 9, -9, 9])
plt.xlabel("x (m)")
plt.ylabel("y (m)")

## 3d view
fig = plt.figure(num=2, figsize=(8, 8))
Drawing.Draw3Dtrajs(trajs)

plt.show()