Skip to content
Snippets Groups Projects
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
Branches
No related tags found
1 merge request!18sieic_vis bug fixes and fine tuning
...@@ -41,6 +41,8 @@ def run(args): ...@@ -41,6 +41,8 @@ def run(args):
for line in lines: for line in lines:
line.Draw('same') line.Draw('same')
viewer.UpdateScene()
if args.interactive: if args.interactive:
ROOT.gApplication.Run() ROOT.gApplication.Run()
else: else:
...@@ -90,8 +92,10 @@ def draw_event(input_file, input_event): ...@@ -90,8 +92,10 @@ def draw_event(input_file, input_event):
n_hits = coll.getNumberOfElements() n_hits = coll.getNumberOfElements()
calo_hit_markers = ROOT.TPolyMarker3D() calo_hit_markers = ROOT.TPolyMarker3D()
markers.append(calo_hit_markers) markers.append(calo_hit_markers)
calo_hit_markers.SetMarkerSize(5) calo_hit_markers.SetMarkerSize(4)
calo_hit_markers.SetMarkerColor(3) calo_hit_markers.SetMarkerColor(6)
if coll_name.startswith("Hcal"):
calo_hit_markers.SetMarkerColor(7)
calo_hit_markers.SetMarkerStyle(4) calo_hit_markers.SetMarkerStyle(4)
for i in range(0, n_hits): for i in range(0, n_hits):
hit = coll.getElementAt(i) hit = coll.getElementAt(i)
...@@ -103,25 +107,26 @@ def draw_event(input_file, input_event): ...@@ -103,25 +107,26 @@ def draw_event(input_file, input_event):
for i in range(0, n_parts): for i in range(0, n_parts):
part = coll.getElementAt(i) part = coll.getElementAt(i)
part.__class__ = ROOT.IMPL.MCParticleImpl part.__class__ = ROOT.IMPL.MCParticleImpl
vertex = part.getVertex() if part.getGeneratorStatus() == 1:
vertex_marker = ROOT.TPolyMarker3D(1) vertex = part.getVertex()
markers.append(vertex_marker) vertex_marker = ROOT.TPolyMarker3D(1)
vertex_marker.SetMarkerColor(3) markers.append(vertex_marker)
vertex_marker.SetMarkerStyle(7) vertex_marker.SetMarkerColor(3)
vertex_marker.SetPoint(0, vertex[0] / 10., vertex[1] / 10., vertex[2] / 10.) vertex_marker.SetMarkerStyle(7)
vertex_marker.Draw('same') vertex_marker.SetPoint(0, vertex[0] / 10., vertex[1] / 10., vertex[2] / 10.)
momentum = part.getMomentum() vertex_marker.Draw('same')
mag = math.sqrt(pow(momentum[0], 2) + pow(momentum[1], 2) + pow(momentum[2], 2)) momentum = part.getMomentum()
line_len = 50 mag = math.sqrt(pow(momentum[0], 2) + pow(momentum[1], 2) + pow(momentum[2], 2))
line_vec = array('d') line_len = 50
line_vec.extend([momentum[0] * line_len / mag, momentum[1] * line_len / mag, momentum[2] * line_len / mag]) line_vec = array('d')
part_line = ROOT.TPolyLine3D(2) line_vec.extend([momentum[0] * line_len / mag, momentum[1] * line_len / mag, momentum[2] * line_len / mag])
lines.append(part_line) part_line = ROOT.TPolyLine3D(2)
part_line.SetLineColor(1) lines.append(part_line)
part_line.SetLineWidth(2) part_line.SetLineColor(1)
part_line.SetPoint(0, vertex[0] / 10., vertex[1] / 10., vertex[2] / 10.) part_line.SetLineWidth(2)
part_line.SetPoint(1, line_vec[0], line_vec[1], line_vec[2]) part_line.SetPoint(0, vertex[0] / 10., vertex[1] / 10., vertex[2] / 10.)
part_line.Draw('same') part_line.SetPoint(1, line_vec[0], line_vec[1], line_vec[2])
part_line.Draw('same')
reader.close() reader.close()
return markers, lines return markers, lines
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment