Commit 6ce2f6cd authored by David Blyth's avatar David Blyth
Browse files

SiEIC Concept: seic_vis: tweaked markers, and fixed bugs

* Calorimeter markers are slightly smaller, and a different color for
collections with names starting with "Hcal"
* Fixed bug where markers and lines didn't always show up
* Fixed bug where documentation particles were drawn
parent 176d41ad
......@@ -41,6 +41,8 @@ def run(args):
for line in lines:
line.Draw('same')
viewer.UpdateScene()
if args.interactive:
ROOT.gApplication.Run()
else:
......@@ -90,8 +92,10 @@ def draw_event(input_file, input_event):
n_hits = coll.getNumberOfElements()
calo_hit_markers = ROOT.TPolyMarker3D()
markers.append(calo_hit_markers)
calo_hit_markers.SetMarkerSize(5)
calo_hit_markers.SetMarkerColor(3)
calo_hit_markers.SetMarkerSize(4)
calo_hit_markers.SetMarkerColor(6)
if coll_name.startswith("Hcal"):
calo_hit_markers.SetMarkerColor(7)
calo_hit_markers.SetMarkerStyle(4)
for i in range(0, n_hits):
hit = coll.getElementAt(i)
......@@ -103,25 +107,26 @@ def draw_event(input_file, input_event):
for i in range(0, n_parts):
part = coll.getElementAt(i)
part.__class__ = ROOT.IMPL.MCParticleImpl
vertex = part.getVertex()
vertex_marker = ROOT.TPolyMarker3D(1)
markers.append(vertex_marker)
vertex_marker.SetMarkerColor(3)
vertex_marker.SetMarkerStyle(7)
vertex_marker.SetPoint(0, vertex[0] / 10., vertex[1] / 10., vertex[2] / 10.)
vertex_marker.Draw('same')
momentum = part.getMomentum()
mag = math.sqrt(pow(momentum[0], 2) + pow(momentum[1], 2) + pow(momentum[2], 2))
line_len = 50
line_vec = array('d')
line_vec.extend([momentum[0] * line_len / mag, momentum[1] * line_len / mag, momentum[2] * line_len / mag])
part_line = ROOT.TPolyLine3D(2)
lines.append(part_line)
part_line.SetLineColor(1)
part_line.SetLineWidth(2)
part_line.SetPoint(0, vertex[0] / 10., vertex[1] / 10., vertex[2] / 10.)
part_line.SetPoint(1, line_vec[0], line_vec[1], line_vec[2])
part_line.Draw('same')
if part.getGeneratorStatus() == 1:
vertex = part.getVertex()
vertex_marker = ROOT.TPolyMarker3D(1)
markers.append(vertex_marker)
vertex_marker.SetMarkerColor(3)
vertex_marker.SetMarkerStyle(7)
vertex_marker.SetPoint(0, vertex[0] / 10., vertex[1] / 10., vertex[2] / 10.)
vertex_marker.Draw('same')
momentum = part.getMomentum()
mag = math.sqrt(pow(momentum[0], 2) + pow(momentum[1], 2) + pow(momentum[2], 2))
line_len = 50
line_vec = array('d')
line_vec.extend([momentum[0] * line_len / mag, momentum[1] * line_len / mag, momentum[2] * line_len / mag])
part_line = ROOT.TPolyLine3D(2)
lines.append(part_line)
part_line.SetLineColor(1)
part_line.SetLineWidth(2)
part_line.SetPoint(0, vertex[0] / 10., vertex[1] / 10., vertex[2] / 10.)
part_line.SetPoint(1, line_vec[0], line_vec[1], line_vec[2])
part_line.Draw('same')
reader.close()
return markers, lines
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment