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

Public Member Functions

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

Public Attributes

 ruler
 

Detailed Description

Definition at line 993 of file eventDisplay.py.

Constructor & Destructor Documentation

◆ __init__()

None eventDisplay.Rulers.__init__ (   self)

Definition at line 996 of file eventDisplay.py.

996 def __init__(self) -> None:
997 self.ruler = ROOT.TEveCompound("Rulers")
998 gEve.AddElement(self.ruler)
999

Member Function Documentation

◆ remove()

None eventDisplay.Rulers.remove (   self)

Definition at line 1099 of file eventDisplay.py.

1099 def remove(self) -> None:
1100 self.ruler.DestroyElements()
1101
1102

◆ show()

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

Definition at line 1000 of file eventDisplay.py.

1000 def show(self, xy: int = 0, ticks: int = 5) -> None:
1001 self.ruler.DestroyElements()
1002 self.ruler.OpenCompound()
1003 xpos, ypos = -500.0, -1500.0
1004 zstart = ShipGeo.target.z0
1005 zlength = ShipGeo.MuonStation3.z - zstart + 10 * u.m
1006 a1 = ROOT.TEveLine()
1007 a1.SetNextPoint(xpos, ypos, zstart)
1008 a1.SetNextPoint(xpos, ypos, zstart + zlength)
1009 a1.SetMainColor(ROOT.kAzure - 9)
1010 a1.SetLineWidth(30)
1011 # self.ruler.AddElement(a1)
1012 z = zstart
1013 for i in range(int(zlength / 100 / ticks)):
1014 m = ROOT.TEveLine()
1015 m.SetNextPoint(xpos, ypos, z)
1016 m.SetNextPoint(xpos - 1 * u.m, ypos, z)
1017 m.SetMainColor(ROOT.kRed)
1018 m.SetLineWidth(5)
1019 self.ruler.AddElement(m)
1020 t1 = ROOT.TEveText(str(i * ticks) + "m")
1021 t1.SetMainColor(ROOT.kGray + 3)
1022 t1.SetFontSize(5)
1023 t1.RefMainTrans().SetPos(xpos - 0.1 * u.m, ypos + 0.2 * u.m, z)
1024 self.ruler.AddElement(t1)
1025 z += ticks * u.m
1026 xpos, ypos = 0.0, 0.0
1027 if xy == 0:
1028 z = ShipGeo.MuonStation3.z + 6 * u.m
1029 else:
1030 z = xy
1031 ylength = 7 * u.m
1032 a2 = ROOT.TEveLine()
1033 a2.SetNextPoint(xpos, -ylength, z)
1034 a2.SetNextPoint(xpos, ylength, z)
1035 a2.SetMainColor(ROOT.kAzure - 9)
1036 a2.SetLineWidth(30)
1037 # self.ruler.AddElement(a2)
1038 ypos = -ylength
1039 for i in range(-int(ylength / 100), int(ylength / 100), 1):
1040 m = ROOT.TEveLine()
1041 m.SetNextPoint(xpos, ypos, z)
1042 m.SetNextPoint(xpos + 0.05 * u.m, ypos, z)
1043 m.SetMainColor(ROOT.kRed)
1044 m.SetLineWidth(3)
1045 self.ruler.AddElement(m)
1046 t1 = ROOT.TEveText(str(i) + "m")
1047 t1.SetMainColor(ROOT.kGray + 3)
1048 t1.SetFontSize(5)
1049 t1.RefMainTrans().SetPos(xpos - 0.5 * u.m, ypos, z)
1050 self.ruler.AddElement(t1)
1051 ypos += 1 * u.m
1052 ty = ROOT.TEveText("y-axis")
1053 ty.SetFontSize(10)
1054 ty.RefMainTrans().SetPos(0.0, ypos + 1 * u.m, z)
1055 ty.SetMainColor(ROOT.kRed - 2)
1056 self.ruler.AddElement(ty)
1057 xpos, ypos = 0.0, 0.0
1058 if xy == 0:
1059 z = ShipGeo.MuonStation3.z + 10 * u.m
1060 xlength = 3 * u.m
1061 a3 = ROOT.TEveLine()
1062 a3.SetNextPoint(-xlength, 0, z)
1063 a3.SetNextPoint(xlength, 0, z)
1064 a3.SetMainColor(ROOT.kAzure - 9)
1065 a3.SetLineWidth(30)
1066 # self.ruler.AddElement(a3)
1067 xpos = -xlength
1068 for i in range(-int(xlength / 100), int(xlength / 100), 1):
1069 m = ROOT.TEveLine()
1070 m.SetNextPoint(xpos, ypos, z)
1071 m.SetNextPoint(xpos, ypos - 0.05 * u.m, z)
1072 m.SetMainColor(ROOT.kRed)
1073 m.SetLineWidth(3)
1074 self.ruler.AddElement(m)
1075 t1 = ROOT.TEveText(str(i) + "m")
1076 t1.SetMainColor(ROOT.kGray + 3)
1077 t1.SetFontSize(5)
1078 t1.RefMainTrans().SetPos(xpos, ypos - 0.1 * u.m, z)
1079 self.ruler.AddElement(t1)
1080 xpos += 1 * u.m
1081 tx = ROOT.TEveText("x-axis")
1082 tx.SetFontSize(10)
1083 tx.RefMainTrans().SetPos(xpos + 1 * u.m, 0.0, z)
1084 tx.SetMainColor(ROOT.kRed - 2)
1085 self.ruler.AddElement(tx)
1086 t1 = ROOT.TEveText("SHiP")
1087 t1.SetFontSize(200)
1088 t1.RefMainTrans().SetPos(0.0, 600.0, ShipGeo.TrackStation1.z - 10 * u.m)
1089 t1.PtrMainTrans().RotateLF(1, 3, ROOT.TMath.PiOver2())
1090 t1.SetMainColor(ROOT.kOrange - 2)
1091 t1.SetFontMode(ROOT.TGLFont.kExtrude)
1092 t1.SetLighting(ROOT.kTRUE)
1093 self.ruler.AddElement(t1)
1094 self.ruler.CloseCompound()
1095 sc = ROOT.gEve.GetScenes()
1096 geoscene = sc.FindChild("Geometry scene")
1097 ROOT.gEve.ElementChanged(geoscene, True, True)
1098

Member Data Documentation

◆ ruler

eventDisplay.Rulers.ruler

Definition at line 997 of file eventDisplay.py.


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