Skip to content

Commit

Permalink
made Kalman track visible in 2D eve display
Browse files Browse the repository at this point in the history
  • Loading branch information
LiamOS committed Jul 11, 2024
1 parent 9e682cb commit e5c7c4e
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions scripts/Reco/draw_spill_3D_projections.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,13 +327,13 @@ def draw_spill(out_dir, name, input_filename, spill_number, time_slice, readout_
kal_true_x[node] = KalmanTruePos[i*600 + node*3 + 0]/1000.0 # from mm to m
kal_true_y[node] = KalmanTruePos[i*600 + node*3 + 1]/1000.0

x_z.plot(kal_z[1:], kal_x[1:], ls='-', lw=2, color=green_cbf)
z_y.plot(kal_z[1:], kal_y[1:], ls='-', lw=2, color=green_cbf)
x_y.plot(kal_x[1:], kal_y[1:], ls='-', lw=2, color=green_cbf)
x_z.plot(kal_z[1:], kal_x[1:], ls='-', lw=2, color=magenta_cbf)
z_y.plot(kal_z[1:], kal_y[1:], ls='-', lw=2, color=magenta_cbf)
x_y.plot(kal_x[1:], kal_y[1:], ls='-', lw=2, color=magenta_cbf)

x_z.plot(kal_z[1:], kal_true_x[1:], ls='--', lw=2, color=magenta_cbf)
z_y.plot(kal_z[1:], kal_true_y[1:], ls='--', lw=2, color=magenta_cbf)
x_y.plot(kal_true_x[1:], kal_true_y[1:], ls='--', lw=2, color=magenta_cbf)
x_z.plot(kal_z[1:], kal_true_x[1:], ls='--', lw=2, color=green_cbf)
z_y.plot(kal_z[1:], kal_true_y[1:], ls='--', lw=2, color=green_cbf)
x_y.plot(kal_true_x[1:], kal_true_y[1:], ls='--', lw=2, color=green_cbf)

### Track start
#print(StartPos)
Expand All @@ -343,9 +343,9 @@ def draw_spill(out_dir, name, input_filename, spill_number, time_slice, readout_
#print("Start", StartPos[i*3 + 0], StartPos[i*3 + 1], StartPos[i*3 + 2])

if not StartPos[i*3 + 1] == 0.0:
x_z.fill_between(*hit_size(StartPos[i*3 + 2], StartPos[i*3 + 0], 'xz', StartPos[i*3 + 2]), color = magenta_cbf)
z_y.fill_between(*hit_size(StartPos[i*3 + 2], StartPos[i*3 + 1], 'zy', StartPos[i*3 + 2]), color = magenta_cbf)
x_y.fill_between(*hit_size(StartPos[i*3 + 0], StartPos[i*3 + 1], 'xy', StartPos[i*3 + 2]), color = magenta_cbf, alpha = 0.5, linewidth = 0.5)
x_z.fill_between(*hit_size(StartPos[i*3 + 2], StartPos[i*3 + 0], 'xz', StartPos[i*3 + 2]), color = black_cbf)
z_y.fill_between(*hit_size(StartPos[i*3 + 2], StartPos[i*3 + 1], 'zy', StartPos[i*3 + 2]), color = black_cbf)
x_y.fill_between(*hit_size(StartPos[i*3 + 0], StartPos[i*3 + 1], 'xy', StartPos[i*3 + 2]), color = black_cbf, alpha = 0.5, linewidth = 0.5)


### Track end
Expand All @@ -356,9 +356,9 @@ def draw_spill(out_dir, name, input_filename, spill_number, time_slice, readout_
#print("End", EndPos[i*3 + 0], EndPos[i*3 + 1], EndPos[i*3 + 2])

if not EndPos[i*3 + 1] == 0.0:
x_z.fill_between(*hit_size(EndPos[i*3 + 2], EndPos[i*3 + 0], 'xz', EndPos[i*3 + 2]), color = magenta_cbf)
z_y.fill_between(*hit_size(EndPos[i*3 + 2], EndPos[i*3 + 1], 'zy', EndPos[i*3 + 2]), color = magenta_cbf)
x_y.fill_between(*hit_size(EndPos[i*3 + 0], EndPos[i*3 + 1], 'xy', EndPos[i*3 + 2]), color = magenta_cbf, alpha = 0.5, linewidth = 0.5)
x_z.fill_between(*hit_size(EndPos[i*3 + 2], EndPos[i*3 + 0], 'xz', EndPos[i*3 + 2]), color = black_cbf)
z_y.fill_between(*hit_size(EndPos[i*3 + 2], EndPos[i*3 + 1], 'zy', EndPos[i*3 + 2]), color = black_cbf)
x_y.fill_between(*hit_size(EndPos[i*3 + 0], EndPos[i*3 + 1], 'xy', EndPos[i*3 + 2]), color = black_cbf, alpha = 0.5, linewidth = 0.5)

### Track direction
#print(Direction)
Expand All @@ -369,18 +369,18 @@ def draw_spill(out_dir, name, input_filename, spill_number, time_slice, readout_
#print("Direction", StartPos[i*3 + 1], StartPos[i*3 + 2])

if not StartPos[i*3 + 1] == 0.0 or EndPos[i*3 + 1] == 0.0:
x_z.plot([StartPos[i*3 + 2] / 1000.0, EndPos[i*3 + 2] / 1000.0], [StartPos[i*3 + 0] / 1000.0, EndPos[i*3 + 0] / 1000.0], color = magenta_cbf, linewidth = 1.5, linestyle = '--')
z_y.plot([StartPos[i*3 + 2] / 1000.0, EndPos[i*3 + 2] / 1000.0], [StartPos[i*3 + 1] / 1000.0, EndPos[i*3 + 1] / 1000.0], color = magenta_cbf, linewidth = 1.5, linestyle = '--')
x_y.plot([StartPos[i*3 + 0] / 1000.0, EndPos[i*3 + 0] / 1000.0], [StartPos[i*3 + 1] / 1000.0, EndPos[i*3 + 1] / 1000.0], color = magenta_cbf, linewidth = 1.5, linestyle = '--')
x_z.plot([StartPos[i*3 + 2] / 1000.0, EndPos[i*3 + 2] / 1000.0], [StartPos[i*3 + 0] / 1000.0, EndPos[i*3 + 0] / 1000.0], color = black_cbf, linewidth = 1.5, linestyle = '--')
z_y.plot([StartPos[i*3 + 2] / 1000.0, EndPos[i*3 + 2] / 1000.0], [StartPos[i*3 + 1] / 1000.0, EndPos[i*3 + 1] / 1000.0], color = black_cbf, linewidth = 1.5, linestyle = '--')
x_y.plot([StartPos[i*3 + 0] / 1000.0, EndPos[i*3 + 0] / 1000.0], [StartPos[i*3 + 1] / 1000.0, EndPos[i*3 + 1] / 1000.0], color = black_cbf, linewidth = 1.5, linestyle = '--')

x_z.scatter(RecoTrackPrimaryParticleTruePositionTrackStart[i*4 + 2] / 1000.0, RecoTrackPrimaryParticleTruePositionTrackStart[i*4 + 0] / 1000.0, c = green_cbf, marker = '2', alpha = 0.5)
x_z.scatter(RecoTrackPrimaryParticleTruePositionTrackEnd[i*4 + 2] / 1000.0, RecoTrackPrimaryParticleTruePositionTrackEnd[i*4 + 0] / 1000.0, c = green_cbf, marker = '1', alpha = 0.5)
x_z.scatter(RecoTrackPrimaryParticleTruePositionTrackStart[i*4 + 2] / 1000.0, RecoTrackPrimaryParticleTruePositionTrackStart[i*4 + 0] / 1000.0, c = magenta_cbf, marker = '2', alpha = 0.5)
x_z.scatter(RecoTrackPrimaryParticleTruePositionTrackEnd[i*4 + 2] / 1000.0, RecoTrackPrimaryParticleTruePositionTrackEnd[i*4 + 0] / 1000.0, c = magenta_cbf, marker = '1', alpha = 0.5)

z_y.scatter(RecoTrackPrimaryParticleTruePositionTrackStart[i*4 + 2] / 1000.0, RecoTrackPrimaryParticleTruePositionTrackStart[i*4 + 1] / 1000.0, c = green_cbf, marker = '2', alpha = 0.5)
z_y.scatter(RecoTrackPrimaryParticleTruePositionTrackEnd[i*4 + 2] / 1000.0, RecoTrackPrimaryParticleTruePositionTrackEnd[i*4 + 1] / 1000.0, c = green_cbf, marker = '1', alpha = 0.5)
z_y.scatter(RecoTrackPrimaryParticleTruePositionTrackStart[i*4 + 2] / 1000.0, RecoTrackPrimaryParticleTruePositionTrackStart[i*4 + 1] / 1000.0, c = magenta_cbf, marker = '2', alpha = 0.5)
z_y.scatter(RecoTrackPrimaryParticleTruePositionTrackEnd[i*4 + 2] / 1000.0, RecoTrackPrimaryParticleTruePositionTrackEnd[i*4 + 1] / 1000.0, c = magenta_cbf, marker = '1', alpha = 0.5)

x_y.scatter(RecoTrackPrimaryParticleTruePositionTrackStart[i*4 + 0] / 1000.0, RecoTrackPrimaryParticleTruePositionTrackStart[i*4 + 1] / 1000.0, c = green_cbf, marker = '2', alpha = 0.5)
x_y.scatter(RecoTrackPrimaryParticleTruePositionTrackEnd[i*4 + 0] / 1000.0, RecoTrackPrimaryParticleTruePositionTrackEnd[i*4 + 1] / 1000.0, c = green_cbf, marker = '1', alpha = 0.5)
x_y.scatter(RecoTrackPrimaryParticleTruePositionTrackStart[i*4 + 0] / 1000.0, RecoTrackPrimaryParticleTruePositionTrackStart[i*4 + 1] / 1000.0, c = magenta_cbf, marker = '2', alpha = 0.5)
x_y.scatter(RecoTrackPrimaryParticleTruePositionTrackEnd[i*4 + 0] / 1000.0, RecoTrackPrimaryParticleTruePositionTrackEnd[i*4 + 1] / 1000.0, c = magenta_cbf, marker = '1', alpha = 0.5)


output_filename = os.path.join(out_dir, f"{name}_{current_spill_number:03d}")
Expand Down

0 comments on commit e5c7c4e

Please sign in to comment.