FairShip
Loading...
Searching...
No Matches
eventDisplay.Rulers Class Reference
Inheritance diagram for eventDisplay.Rulers:
[legend]
Collaboration diagram for eventDisplay.Rulers:
[legend]

Public Member Functions

None __init__ (self)
None show (self, int xy=0, int ticks=5)
None remove (self)

Public Attributes

 ruler = ROOT.TEveCompound("Rulers")

Detailed Description

Definition at line 1019 of file eventDisplay.py.

Constructor & Destructor Documentation

◆ __init__()

None eventDisplay.Rulers.__init__ ( self)

Definition at line 1022 of file eventDisplay.py.

1022 def __init__(self) -> None:
1023 self.ruler = ROOT.TEveCompound("Rulers")
1024 gEve.AddElement(self.ruler)
1025

Member Function Documentation

◆ remove()

None eventDisplay.Rulers.remove ( self)

Definition at line 1125 of file eventDisplay.py.

1125 def remove(self) -> None:
1126 self.ruler.DestroyElements()
1127
1128

◆ show()

None eventDisplay.Rulers.show ( self,
int xy = 0,
int ticks = 5 )

Definition at line 1026 of file eventDisplay.py.

1026 def show(self, xy: int = 0, ticks: int = 5) -> None:
1027 self.ruler.DestroyElements()
1028 self.ruler.OpenCompound()
1029 xpos, ypos = -500.0, -1500.0
1030 zstart = ShipGeo.target.z0
1031 zlength = z_end_of_detector(ShipGeo) - zstart + 10 * u.m
1032 a1 = ROOT.TEveLine()
1033 a1.SetNextPoint(xpos, ypos, zstart)
1034 a1.SetNextPoint(xpos, ypos, zstart + zlength)
1035 a1.SetMainColor(ROOT.kAzure - 9)
1036 a1.SetLineWidth(30)
1037 # self.ruler.AddElement(a1)
1038 z = zstart
1039 for i in range(int(zlength / 100 / ticks)):
1040 m = ROOT.TEveLine()
1041 m.SetNextPoint(xpos, ypos, z)
1042 m.SetNextPoint(xpos - 1 * u.m, ypos, z)
1043 m.SetMainColor(ROOT.kRed)
1044 m.SetLineWidth(5)
1045 self.ruler.AddElement(m)
1046 t1 = ROOT.TEveText(str(i * ticks) + "m")
1047 t1.SetMainColor(ROOT.kGray + 3)
1048 t1.SetFontSize(5)
1049 t1.RefMainTrans().SetPos(xpos - 0.1 * u.m, ypos + 0.2 * u.m, z)
1050 self.ruler.AddElement(t1)
1051 z += ticks * u.m
1052 xpos, ypos = 0.0, 0.0
1053 if xy == 0:
1054 z = z_end_of_detector(ShipGeo) + 6 * u.m
1055 else:
1056 z = xy
1057 ylength = 7 * u.m
1058 a2 = ROOT.TEveLine()
1059 a2.SetNextPoint(xpos, -ylength, z)
1060 a2.SetNextPoint(xpos, ylength, z)
1061 a2.SetMainColor(ROOT.kAzure - 9)
1062 a2.SetLineWidth(30)
1063 # self.ruler.AddElement(a2)
1064 ypos = -ylength
1065 for i in range(-int(ylength / 100), int(ylength / 100), 1):
1066 m = ROOT.TEveLine()
1067 m.SetNextPoint(xpos, ypos, z)
1068 m.SetNextPoint(xpos + 0.05 * u.m, ypos, z)
1069 m.SetMainColor(ROOT.kRed)
1070 m.SetLineWidth(3)
1071 self.ruler.AddElement(m)
1072 t1 = ROOT.TEveText(str(i) + "m")
1073 t1.SetMainColor(ROOT.kGray + 3)
1074 t1.SetFontSize(5)
1075 t1.RefMainTrans().SetPos(xpos - 0.5 * u.m, ypos, z)
1076 self.ruler.AddElement(t1)
1077 ypos += 1 * u.m
1078 ty = ROOT.TEveText("y-axis")
1079 ty.SetFontSize(10)
1080 ty.RefMainTrans().SetPos(0.0, ypos + 1 * u.m, z)
1081 ty.SetMainColor(ROOT.kRed - 2)
1082 self.ruler.AddElement(ty)
1083 xpos, ypos = 0.0, 0.0
1084 if xy == 0:
1085 z = z_end_of_detector(ShipGeo) + 10 * u.m
1086 xlength = 3 * u.m
1087 a3 = ROOT.TEveLine()
1088 a3.SetNextPoint(-xlength, 0, z)
1089 a3.SetNextPoint(xlength, 0, z)
1090 a3.SetMainColor(ROOT.kAzure - 9)
1091 a3.SetLineWidth(30)
1092 # self.ruler.AddElement(a3)
1093 xpos = -xlength
1094 for i in range(-int(xlength / 100), int(xlength / 100), 1):
1095 m = ROOT.TEveLine()
1096 m.SetNextPoint(xpos, ypos, z)
1097 m.SetNextPoint(xpos, ypos - 0.05 * u.m, z)
1098 m.SetMainColor(ROOT.kRed)
1099 m.SetLineWidth(3)
1100 self.ruler.AddElement(m)
1101 t1 = ROOT.TEveText(str(i) + "m")
1102 t1.SetMainColor(ROOT.kGray + 3)
1103 t1.SetFontSize(5)
1104 t1.RefMainTrans().SetPos(xpos, ypos - 0.1 * u.m, z)
1105 self.ruler.AddElement(t1)
1106 xpos += 1 * u.m
1107 tx = ROOT.TEveText("x-axis")
1108 tx.SetFontSize(10)
1109 tx.RefMainTrans().SetPos(xpos + 1 * u.m, 0.0, z)
1110 tx.SetMainColor(ROOT.kRed - 2)
1111 self.ruler.AddElement(tx)
1112 t1 = ROOT.TEveText("SHiP")
1113 t1.SetFontSize(200)
1114 t1.RefMainTrans().SetPos(0.0, 600.0, ShipGeo.TrackStation1.z - 10 * u.m)
1115 t1.PtrMainTrans().RotateLF(1, 3, ROOT.TMath.PiOver2())
1116 t1.SetMainColor(ROOT.kOrange - 2)
1117 t1.SetFontMode(ROOT.TGLFont.kExtrude)
1118 t1.SetLighting(ROOT.kTRUE)
1119 self.ruler.AddElement(t1)
1120 self.ruler.CloseCompound()
1121 sc = ROOT.gEve.GetScenes()
1122 geoscene = sc.FindChild("Geometry scene")
1123 ROOT.gEve.ElementChanged(geoscene, True, True)
1124

Member Data Documentation

◆ ruler

eventDisplay.Rulers.ruler = ROOT.TEveCompound("Rulers")

Definition at line 1023 of file eventDisplay.py.


The documentation for this class was generated from the following file: