2import ROOT,sys,os,tkinter,atexit
3ROOT.gROOT.ProcessLine(
'#include "FairEventHeader.h"')
6from argparse
import ArgumentParser
7from ShipGeoConfig
import ConfigRegistry
8from rootpyPickler
import Unpickler
11from decorators
import *
12import shipRoot_conf,shipDet_conf
16 if ROOT.gROOT.FindObject(
'Root Canvas EnergyLoss'):
17 print(
"make suicide before framework makes seg fault")
18 os.kill(os.getpid(),9)
20if float(ROOT.gROOT.GetVersion().split(
'/')[0])>6.07: atexit.register(evExit)
24pdg = ROOT.TDatabasePDG.Instance()
27gEnv.SetValue(
'Eve.Viewer.HideMenus',
'off')
33withAllMCTracks =
False
35transparentMaterials = {
'iron':80,
'aluminium':80,
'mylar':60,
'STTmix9010_2bar':95,
'steel':80,
'Aluminum':80,
'Scintillator':80,
37 'CoilCopper':70,
'copper':90,
'HPTgas':70,
'Bakelite':70,
'RPCgas':70,
'TTmedium':70,
39 'CoilAluminium':70,
'molybdenum':80,
'PlasticBase':70,
'tantalum':70}
42parser = ArgumentParser()
44parser.add_argument(
"-f",
"--inputFile", dest=
"InputFile", help=
"Input file", required=
True)
45parser.add_argument(
"-g",
"--geoFile", dest=
"geoFile", help=
"ROOT geofile", required=
True)
46parser.add_argument(
"-p",
"--paramFile", dest=
"ParFile", help=
"FairRoot param file", required=
False, default=
None)
47parser.add_argument(
"--Debug", dest=
"Debug", help=
"Switch on debugging", required=
False, action=
"store_true")
48parser.add_argument(
"-o",
"--outFile", dest=
"OutputFile", help=
"Output file", required=
False,default=
None)
49parser.add_argument(
"-i", dest=
"HiddenParticleID", help=
"HiddenParticle ID", required=
False,default=9900015)
51options = parser.parse_args()
52if options.InputFile.find(
'_D')>0: withGeo =
True
56 print(
' %6i %7i %6.3F %6.3F %7.3F %7.3F %7.3F %7.3F %6i '%(n,mcp.GetPdgCode(),mcp.GetPx()/u.GeV,mcp.GetPy()/u.GeV,mcp.GetPz()/u.GeV, \
57 mcp.GetStartX()/u.m,mcp.GetStartY()/u.m,mcp.GetStartZ()/u.m,mcp.GetMotherId() ))
59 print(
' # pid px py pz vx vy vz mid')
61 for mcp
in sTree.MCTrack:
63 if mcp.GetP()/u.GeV < pcut :
continue
66 print(
' # converged Ndf chi2/Ndf P Pt MCid')
68 for ft
in sTree.FitTracks:
70 fitStatus = ft.getFitStatus()
71 fitState = ft.getFittedState()
72 mom = fitState.getMom()
73 print(
'%3i %6i %4i %6.3F %6.3F %6.3F %6i '%(n,fitStatus.isFitConverged(),\
74 fitStatus.getNdf(),fitStatus.getChi2()/fitStatus.getNdf(),\
75 mom.Mag()/u.GeV,mom.Pt()/u.GeV,sTree.fitTrack2MC[n] ))
77 print(
' # P Pt[GeV/c] DOCA[mm] Rsq Vz[m] d1 d2')
79 for aP
in sTree.Particles:
82 if aP.GetMother(1)==99:
84 Rsq = (aP.Vx()/(2.45*u.m) )**2 + (aP.Vy()/((10./2.-0.05)*u.m) )**2
85 print(
'%3i %6.3F %6.3F %9.3F %6.3F %6.3F %4i %4i '%(n,aP.P()/u.GeV,aP.Pt()/u.GeV,\
86 doca/u.mm,Rsq,aP.Vz()/u.m,aP.GetDaughter(0),aP.GetDaughter(1) ))
90 self.
comp = ROOT.TEveCompound(
'Veto Digis')
91 gEve.AddElement(self.
comp)
93 self.
evscene = sc.FindChild(
'Event scene')
97 self.comp.DestroyElements()
98 self.comp.OpenCompound()
99 nav = ROOT.gGeoManager.GetCurrentNavigator()
100 for digi
in sTree.Digi_SBTHits:
101 if not digi.isValid():
continue
102 node = digi.GetNode()
103 shape = node.GetVolume().GetShape()
104 bx = ROOT.TEveBox( node.GetName() )
105 bx.SetPickable(ROOT.kTRUE)
106 bx.SetTitle(digi.__repr__())
107 bx.SetMainColor(ROOT.kMagenta+3)
108 dx,dy,dz = shape.GetDX(),shape.GetDY(),shape.GetDZ()
109 o = shape.GetOrigin()
110 master = array(
'd',[0,0,0])
112 for edge
in [ [-dx,-dy,-dz],[-dx,+dy,-dz],[+dx,+dy,-dz],[+dx,-dy,-dz],[-dx,-dy, dz],[-dx,+dy, dz],[+dx,+dy, dz],[+dx,-dy, dz]]:
113 origin = array(
'd',[edge[0]+o[0],edge[1]+o[1],edge[2]+o[2]])
114 nav.LocalToMaster(origin,master)
115 bx.SetVertex(n,master[0],master[1],master[2])
117 self.comp.AddElement(bx)
118 self.comp.CloseCompound()
119 gEve.ElementChanged(self.evscene,
True,
True)
124 self.
comp = ROOT.TEveCompound(
'Ecal Clusters')
125 gEve.AddElement(self.
comp)
126 sc = gEve.GetScenes()
128 mE = top.GetNode(
'Ecal_1').GetMatrix()
134 self.comp.DestroyElements()
135 self.comp.OpenCompound()
137 for aClus
in sTree.EcalClusters:
140 for i
in range( aClus.Size() ):
141 mccell = self.ecalStructure.GetHitCell(aClus.CellNum(i))
142 if not mccell:
continue
143 x1,y1,x2,y2,dz = mccell.X1(),mccell.Y1(),mccell.X2(),mccell.Y2(),mccell.GetEnergy()/u.GeV*0.5*u.m
144 if mccell.GetEnergy()/u.MeV < 4. :
continue
146 DClus = ROOT.TEveBox()
147 DClus.SetName(
'EcalCluster_'+
str(cl)+
'_'+
str(i))
148 DClus.SetPickable(ROOT.kTRUE)
149 DClus.SetTitle(aClus.__repr__())
150 DClus.SetMainColor(ROOT.kRed-4)
151 DClus.SetMainTransparency(
"\x10")
152 DClus.SetVertex(0,x1,y1,self.z_ecal)
153 DClus.SetVertex(1,x1,y1,self.z_ecal+dz)
154 DClus.SetVertex(2,x2,y1,self.z_ecal+dz)
155 DClus.SetVertex(3,x2,y1,self.z_ecal)
156 DClus.SetVertex(4,x1,y2,self.z_ecal)
157 DClus.SetVertex(5,x1,y2,self.z_ecal+dz)
158 DClus.SetVertex(6,x2,y2,self.z_ecal+dz)
159 DClus.SetVertex(7,x2,y2,self.z_ecal)
160 self.comp.AddElement(DClus)
161 self.comp.CloseCompound()
162 gEve.ElementChanged(self.evscene,
True,
True)
164 self.
comp.OpenCompound()
165 DTrack = ROOT.TEveLine()
166 DTrack.SetPickable(ROOT.kTRUE)
167 DTrack.SetMainColor(ROOT.kCyan)
168 DTrack.SetLineWidth(4)
169 aP=sTree.Particles[n]
170 DTrack.SetTitle(aP.__repr__())
171 DTrack.SetName(
'Prtcle_'+
str(n))
172 DTrack.SetNextPoint(aP.Vx(),aP.Vy(),aP.Vz())
173 lam = (self.
Targetz - aP.Vz())/aP.Pz()
174 DTrack.SetNextPoint(aP.Vx()+lam*aP.Px(),aP.Vy()+lam*aP.Py(),self.
Targetz)
175 self.
comp.AddElement(DTrack)
176 self.
comp.CloseCompound()
177 gEve.ElementChanged(self.
evscene,
True,
True)
183 self.
comp = ROOT.TEveCompound(
'Tracks')
184 gEve.AddElement(self.
comp)
185 self.
trackColors = {13:ROOT.kGreen,211:ROOT.kRed,11:ROOT.kOrange,321:ROOT.kMagenta}
186 dv = top.GetNode(
'DecayVolume_1')
190 T1Lid = ns.FindObject(
"T1Lid_1").GetMatrix()
193 muonDet = top.GetNode(
'MuonDetector_1')
194 if muonDet: self.
z_end = muonDet.GetMatrix().GetTranslation()[2]+muonDet.GetVolume().GetShape().GetDZ()
195 elif hasattr(ShipGeo,
'MuonStation3'): self.
z_end = ShipGeo[
'MuonStation3'].z
196 elif top.GetNode(
"VMuonBox_1"):
197 xx = top.GetNode(
"VMuonBox_1")
198 self.
z_end = xx.GetMatrix().GetTranslation()[2]+xx.GetVolume().GetShape().GetDZ()
199 magNode = top.GetNode(
'MCoil_1')
200 if magNode: self.
z_mag = magNode.GetMatrix().GetTranslation()[2]
201 elif hasattr(ShipGeo,
'Bfield'): self.
z_mag = ShipGeo[
'Bfield'].z
203 ecalDet = top.GetNode(
'Ecal_1')
205 if ecalDet: self.
z_ecal = ecalDet.GetMatrix().GetTranslation()[2]
206 elif hasattr(ShipGeo,
'ecal'): self.
z_ecal = ShipGeo[
'ecal'].z
210 sc = gEve.GetScenes()
212 targetNode = top.GetNode(
"TargetArea_1")
213 if targetNode: self.
Targetz = targetNode.GetMatrix().GetTranslation()[2]
214 elif hasattr(ShipGeo,
'target'): self.
Targetz = ShipGeo[
'target'].z0
219 self.comp.DestroyElements()
220 self.comp.OpenCompound()
221 if sTree.FindBranch(
'FitTracks')
or sTree.FindBranch(
'FitTracks_PR'):
222 if sTree.FitTracks.GetEntries() > 0:
223 self.DrawFittedTracks()
224 if not sTree.FindBranch(
"GeoTracks")
and sTree.MCTrack.GetEntries() > 0:
226 elif globals()[
'withMCTracks']: self.DrawMCTracks()
227 self.comp.CloseCompound()
228 gEve.ElementChanged(self.evscene,
True,
True)
230 self.
comp.OpenCompound()
231 DTrack = ROOT.TEveLine()
232 DTrack.SetPickable(ROOT.kTRUE)
233 DTrack.SetMainColor(ROOT.kCyan)
234 DTrack.SetLineWidth(4)
235 aP=sTree.Particles[n]
236 DTrack.SetTitle(aP.__repr__())
237 DTrack.SetName(
'Prtcle_'+
str(n))
238 DTrack.SetNextPoint(aP.Vx(),aP.Vy(),aP.Vz())
239 lam = (self.
Targetz - aP.Vz())/aP.Pz()
240 DTrack.SetNextPoint(aP.Vx()+lam*aP.Px(),aP.Vy()+lam*aP.Py(),self.
Targetz)
241 self.
comp.AddElement(DTrack)
243 self.
comp.OpenCompound()
244 fT = sTree.MCTrack[n]
245 DTrack = ROOT.TEveLine()
246 DTrack.SetPickable(ROOT.kTRUE)
247 DTrack.SetTitle(fT.__repr__())
248 p = pdg.GetParticle(fT.GetPdgCode())
249 if p : pName = p.GetName()
250 else: pName =
str(fT.GetPdgCode())
251 DTrack.SetName(
'MCTrck_'+
str(n)+
'_'+pName)
252 fPos = ROOT.TVector3()
253 fMom = ROOT.TVector3()
254 fT.GetStartVertex(fPos)
258 for da
in sTree.MCTrack:
259 if da.GetMotherId()==n:
262 DTrack.SetNextPoint(fPos.X(),fPos.Y(),fPos.Z())
263 if evVx
and abs( da.GetStartZ()-fPos.Z() )>1*u.cm :
264 DTrack.SetNextPoint(da.GetStartX(),da.GetStartY(),da.GetStartZ())
267 if evVx : zEx = -10*u.m
268 lam = (zEx+fPos.Z())/fMom.Z()
269 DTrack.SetNextPoint(fPos.X()+lam*fMom.X(),fPos.Y()+lam*fMom.Y(),zEx+fPos.Z())
271 DTrack.SetMainColor(c)
272 DTrack.SetLineWidth(3)
273 self.
comp.AddElement(DTrack)
274 self.
comp.CloseCompound()
275 gEve.ElementChanged(self.
evscene,
True,
True)
279 fPos = ROOT.TVector3()
280 fMom = ROOT.TVector3()
281 for fT
in sTree.MCTrack:
283 DTrack = ROOT.TEveLine()
284 DTrack.SetPickable(ROOT.kTRUE)
285 DTrack.SetTitle(fT.__repr__())
286 fT.GetStartVertex(fPos)
288 hitlist[fPos.Z()] = [fPos.X(),fPos.Y()]
290 if abs(fT.GetPdgCode()) == options.HiddenParticleID:
291 for da
in sTree.MCTrack:
292 if da.GetMotherId()==n:
break
294 da.GetStartVertex(fPos)
295 hitlist[fPos.Z()] = [fPos.X(),fPos.Y()]
297 for P
in [
"vetoPoint",
"muonPoint",
"EcalPoint",
"HcalPoint",
"preshowerPoint",
"strawtubesPoint",
"ShipRpcPoint",
"TargetPoint",
"TimeDetPoint",
298 "MuFilterPoint",
"ScifiPoint"]:
299 if not sTree.GetBranch(P):
continue
302 if p.GetTrackID()==n:
303 if hasattr(p,
"LastPoint"):
305 if lp.x()==lp.y()
and lp.x()==lp.z()
and lp.x()==0:
307 hitlist[p.GetZ()] = [p.GetX(),p.GetY()]
309 hitlist[lp.z()] = [lp.x(),lp.y()]
310 hitlist[2.*p.GetZ()-lp.z()] = [2.*p.GetX()-lp.x(),2.*p.GetY()-lp.y()]
312 hitlist[p.GetZ()] = [p.GetX(),p.GetY()]
314 if fT.GetMotherId()<0:
continue
315 if abs(sTree.MCTrack[fT.GetMotherId()].GetPdgCode()) == options.HiddenParticleID:
319 for da
in sTree.MCTrack:
320 if da.GetMotherId()==n:
323 if evVx : hitlist[da.GetStartZ()] = [da.GetStartX(),da.GetStartY()]
327 lam = (zEx+fPos.Z())/fMom.Z()
328 hitlist[zEx+fPos.Z()] = [fPos.X()+lam*fMom.X(),fPos.Y()+lam*fMom.Y()]
330 lz = list(hitlist.keys())
333 for z
in lz: DTrack.SetNextPoint(hitlist[z][0],hitlist[z][1],z)
334 p = pdg.GetParticle(fT.GetPdgCode())
335 if p : pName = p.GetName()
336 else: pName =
str(fT.GetPdgCode())
337 DTrack.SetName(
'MCTrack_'+
str(n)+
'_'+pName)
339 if abs(fT.GetPdgCode()) == options.HiddenParticleID:c = ROOT.kMagenta
340 DTrack.SetMainColor(c)
341 DTrack.SetLineWidth(3)
342 self.
comp.AddElement(DTrack)
344 print(
"draw ",ntot,
" MC tracks")
347 for fT
in sTree.FitTracks:
349 fst = fT.getFitStatus()
350 if not fst.isFitConverged():
continue
351 if fst.getNdf() < 20:
continue
352 DTrack = ROOT.TEveLine()
353 DTrack.SetPickable(ROOT.kTRUE)
354 DTrack.SetTitle(fT.__repr__())
355 fstate = fT.getFittedState(0)
356 fPos = fstate.getPos()
357 fMom = fstate.getMom()
360 pid = fstate.getPDG()
363 for i
in range(self.
niter):
366 DTrack.SetNextPoint(newpos.X(),newpos.Y(),newpos.Z())
368 print(
'error with extrapolation: z=',zs)
370 px,py,pz = mom.X(),mom.Y(),mom.Z()
371 lam = (zs-pos.Z())/pz
372 DTrack.SetNextPoint(pos.X()+lam*px,pos.Y()+lam*py,zs)
374 DTrack.SetName(
'FitTrack_'+
str(n))
377 DTrack.SetMainColor(c)
378 DTrack.SetLineWidth(3)
379 self.
comp.AddElement(DTrack)
381 print(
"draw ",ntot,
" fitted tracks")
383 for aP
in sTree.Particles:
387 if aP.GetMother(1)==99:
388 if aP.T()>3*u.cm :
continue
389 for k
in range(aP.GetNDaughters()):
391 fT = sTree.FitTracks[aP.GetDaughter(k)]
392 fst = fT.getFitStatus()
393 if not fst.isFitConverged(): tracksOK=
False
394 if fst.getNdf() < 20: tracksOK=
False
395 if not tracksOK:
continue
396 DTrack = ROOT.TEveLine()
397 DTrack.SetPickable(ROOT.kTRUE)
398 DTrack.SetMainColor(ROOT.kCyan)
399 DTrack.SetLineWidth(4)
400 DTrack.SetName(
'Particle_'+
str(n))
401 DTrack.SetTitle(aP.__repr__())
402 DTrack.SetNextPoint(aP.Vx(),aP.Vy(),aP.Vz())
403 lam = (self.
Targetz - aP.Vz())/aP.Pz()
404 DTrack.SetNextPoint(aP.Vx()+lam*aP.Px(),aP.Vy()+lam*aP.Py(),self.
Targetz)
405 self.
comp.AddElement(DTrack)
411 self.
master.title(
'SHiP Event Display GUI')
412 self.
master.geometry(
u'320x580+165+820')
415 b.pack(fill=tkinter.BOTH, expand=1)
416 label = tkinter.Label(self.
fram1, text=
'Event number:')
417 label[
"relief"] = tkinter.RAISED
418 entry = tkinter.Entry(self.
fram1)
419 entry[
"foreground"] =
"blue"
420 label.pack(side=tkinter.LEFT)
421 entry.pack(side=tkinter.RIGHT)
427 entry[
"textvariable"] = self.
contents
435 if globals()[
'withMCTracks']: a.set(1)
437 self.
lbut[x] = tkinter.Checkbutton(self.
master,text=
"with MC Tracks",compound=tkinter.LEFT,variable=a)
440 self.
lbut[x].pack(side=tkinter.TOP)
441 self.
geoscene = ROOT.gEve.GetScenes().FindChild(
"Geometry scene")
442 for v
in top.GetNodes():
444 cmd =
'toogle("'+x+
'")'
446 assemb =
"Assembly" in v.GetVolume().__str__()
447 if v.IsVisible()
or (assemb
and v.IsVisDaughters()): a.set(1)
449 self.
lbut[x] = tkinter.Checkbutton(self.
master,text=x.replace(
'_1',
''),compound=tkinter.LEFT,variable=a)
452 self.
lbut[x].pack(side=tkinter.BOTTOM)
456 slot = ROOT.TEveWindow.CreateWindowInTab(gEve.GetBrowser().GetTabLeft())
457 slot.SetShowTitleBar(ROOT.kFALSE)
458 packs = slot.MakePack();
459 packs.SetShowTitleBar(ROOT.kFALSE);
460 packs.SetElementName(
"SHiP actions")
461 packs.SetHorizontal()
462 slot = packs.NewSlot()
463 frame = slot.MakeFrame()
464 frame.SetElementName(
"commands")
465 frame.SetShowTitleBar(ROOT.kFALSE)
466 cf = frame.GetGUICompositeFrame()
467 hf = ROOT.TGVerticalFrame(cf)
468 hf.SetCleanup(ROOT.kLocalCleanup)
471 guiFrame = ROOT.TGVerticalFrame(hf)
472 hf.AddFrame(guiFrame, ROOT.TGLayoutHints(ROOT.kLHintsExpandX))
473 guiFrame.SetCleanup(ROOT.kDeepCleanup)
474 b = ROOT.TGTextButton(guiFrame,
"Add particle follower")
476 b.SetToolTipText(
'start new window with top projection and energy loss')
477 b.SetCommand(
'TPython::ExecScript("'+os.environ[
'FAIRSHIP']+
'/macro/evd_addParticleFollower.py")')
478 guiFrame.AddFrame(b, ROOT.TGLayoutHints(ROOT.kLHintsExpandX))
479 bn = ROOT.TGTextButton(guiFrame,
"fill histogram")
481 bn.SetToolTipText(
'Fill histogram with energy along flight path')
482 bn.SetCommand(
'TPython::ExecScript("'+os.environ[
'FAIRSHIP']+
'/macro/evd_fillEnergy.py")')
483 guiFrame.AddFrame(bn, ROOT.TGLayoutHints(ROOT.kLHintsExpandX))
484 bt = ROOT.TGTextButton(guiFrame,
"switch transparent mode on/off")
486 bt.SetToolTipText(
'switch transparent mode on/off for better visibility of tracks')
487 bt.SetCommand(
'TPython::ExecScript("'+os.environ[
'FAIRSHIP']+
'/macro/evd_transparentMode.py")')
488 guiFrame.AddFrame(bt, ROOT.TGLayoutHints(ROOT.kLHintsExpandX))
489 bnx = ROOT.TGTextButton(guiFrame,
"next event")
491 bnx.SetToolTipText(
'click for next event')
492 bnx.SetCommand(
'TPython::ExecScript("'+os.environ[
'FAIRSHIP']+
'/macro/evd_nextEvent.py")')
493 guiFrame.AddFrame(bnx, ROOT.TGLayoutHints(ROOT.kLHintsExpandX))
494 bzt = ROOT.TGTextButton(guiFrame,
"synch zoom top->side")
496 bzt.SetToolTipText(
'synchronize zoom top with side')
497 bzt.SetCommand(
'TPython::ExecScript("'+os.environ[
'FAIRSHIP']+
'/macro/evd_synchZoomt.py")')
498 guiFrame.AddFrame(bzt, ROOT.TGLayoutHints(ROOT.kLHintsExpandX))
499 bzs = ROOT.TGTextButton(guiFrame,
"synch zoom side->top")
501 bzs.SetToolTipText(
'synchronize zoom side with top')
502 bzs.SetCommand(
'TPython::ExecScript("'+os.environ[
'FAIRSHIP']+
'/macro/evd_synchZooms.py")')
503 guiFrame.AddFrame(bzs, ROOT.TGLayoutHints(ROOT.kLHintsExpandX))
510 if i==self.
n: self.
n+=1
513 SHiPDisplay.NextEvent(self.
n)
515 tl = fRun.GetMainTask().GetListOfTasks()
516 geoTask = tl.FindObject(
"GeoTracks")
517 if globals()[
'withMCTracks']:
518 globals()[
'withMCTracks'] =
False
519 self.
lbut[
'withMC'].var.set(1)
520 if geoTask: geoTask.SetActive(0)
522 globals()[
'withMCTracks'] =
True
523 self.
lbut[
'withMC'].var.set(0)
524 if geoTask: geoTask.SetActive(1)
527 assemb =
"Assembly" in v.GetVolume().__str__()
528 if v.IsVisible()>0
or assemb
and v.IsVisDaughters()>0 :
529 print(
"switch off ",x)
532 self.
lbut[x].var.set(0)
534 print(
"switch on ",x)
535 if assemb: v.SetVisDaughters(1)
536 else: v.SetVisibility(1)
537 self.
lbut[x].var.set(1)
538 gEve.ElementChanged(self.
geoscene,
True,
True)
539 for v
in top.GetNodes():
542 assemb =
"Assembly" in v.GetVolume().__str__()
543 if v.IsVisible()>0
or assemb
and v.IsVisDaughters()>0 : self.
lbut[x].var.set(1)
544 else : self.
lbut[x].var.set(0)
552 if sGeo.GetVolume(
'Ecal'):
554 ecalGeo = ecalGeoFile+
'z'+
str(ShipGeo.ecal.z)+
".geo"
556 self.
ecalFiller = ROOT.ecalStructureFiller(
"ecalFiller", 0,ecalGeo)
557 if ecalGeoFile.find(
"5x10")<0:
559 print(
"ecal cluster display disabled, seems only to work with 5x10m ecal geofile")
560 else: self.
ecalFiller.SetUseMCPoints(ROOT.kTRUE)
562 rc = sTree.GetEvent(0)
573 v1 = gEve.GetDefaultViewer()
574 v1.GetEveFrame().HideAllDecorations()
575 tr=gEve.GetBrowser().GetTabRight()
577 t0.SetText(ROOT.TGString(
'3D'))
581 fRun.Run(self.
n,self.
n+1)
583 if sTree.GetBranch(
"FitTracks_PR"): sTree.FitTracks = sTree.FitTracks_PR
584 if sTree.GetBranch(
"fitTrack2MC_PR"): sTree.fitTrack2MC = sTree.fitTrack2MC_PR
585 if sTree.GetBranch(
"Particles_PR"): sTree.Particles = sTree.Particles_PR
586 if hasattr(self,
"tracks"): self.
tracks.ExecuteTask()
587 if sTree.FindBranch(
"EcalClusters"):
588 if sTree.EcalClusters.GetEntries()>0:
589 self.
ecalFiller.Exec(
'start',sTree.EcalPointLite)
590 self.
calos.ExecuteTask()
591 if sTree.FindBranch(
"Digi_SBTHits"): self.
veto.ExecuteTask()
593 print(
'Event %i ready'%(self.
n))
596 p = ROOT.gEve.GetCurrentEvent().FindChild(mcHits[x].GetName())
598 p.SetPickable(ROOT.kTRUE)
599 p.SetTitle(p.__repr__())
601 v = ROOT.gEve.GetDefaultGLViewer()
602 cam = v.CurrentCamera()
605 cam.RotateRad(hor,ver)
620 for m
in transparentMaterials:
621 mat = ROOT.gGeoManager.GetMaterial(m)
623 if mode.lower()==
'on' or mode==1:
624 mat.SetTransparency(transparentMaterials[m])
627 mat.SetTransparency(
"\x00")
629 sc = gEve.GetScenes()
630 geoscene = sc.FindChild(
'Geometry scene')
631 if geoscene: gEve.ElementChanged(geoscene,
True,
True)
636 s = ROOT.gEve.SpawnNewScene(
"Projected Event")
637 ROOT.gEve.GetDefaultViewer().AddScene(s)
638 v = ROOT.gEve.GetDefaultGLViewer()
639 v.SetCurrentCamera(ROOT.TGLViewer.kCameraOrthoXOY)
640 cam = v.CurrentCamera()
641 cam.SetZoomMinMax(0.2, 20)
643 mng = ROOT.TEveProjectionManager(ROOT.TEveProjection.kPT_RPhi)
645 axes = ROOT.TEveProjectionAxes(mng)
646 axes.SetTitle(
"TEveProjections demo")
648 ROOT.gEve.AddToListTree(axes, ROOT.kTRUE)
649 ROOT.gEve.AddToListTree(mng, ROOT.kTRUE)
653 v = gEve.GetViewers()
654 vw = v.FindChild(
'Viewer 1')
655 if vw: vw.SetName(
'3d')
656 sev = ROOT.gEve.SpawnNewViewer(
"Scaled 2D")
657 smng = ROOT.TEveProjectionManager(ROOT.TEveProjection.kPP_Plane)
658 sp = smng.GetProjection()
659 sp.SetUsePreScale(ROOT.kTRUE)
660 sp.AddPreScaleEntry(2, 100000000., 0.1)
661 ss = ROOT.gEve.SpawnNewScene(
"Scaled Geom")
664 N = sGeo.GetTopNode()
665 TNod=ROOT.TEveGeoTopNode(sGeo, N, 1, 3, 10)
667 eventscene = ROOT.gEve.SpawnNewScene(
'Scaled event')
668 eventscene.AddElement(ROOT.FairEventManager.Instance())
669 sev.AddScene(eventscene)
670 eventscene.AddElement(smng)
671 ROOT.gEve.GetBrowser().GetTabRight().SetTab(1)
672 ROOT.gEve.FullRedraw3D(ROOT.kTRUE)
675 f = ROOT.TFile.Open(fname,
"RECREATE");
676 cam = ROOT.gEve.GetDefaultGLViewer().CurrentCamera()
680 f = ROOT.TFile.Open(fname)
681 cam = ROOT.gEve.GetDefaultGLViewer().CurrentCamera()
682 f.GetKey(cam.ClassName()).Read(cam)
684 gEve.GetDefaultGLViewer().RequestDraw()
687 for x
in [
"wire",
"gas",
"rockD",
"rockS",
"rockSFe"]:
688 xvol = sGeo.GetVolume(x)
689 if xvol: xvol.SetVisibility(0)
691 va = sGeo.GetVolume(
"T"+
str(k))
693 for x
in va.GetNodes():
695 if not nm.find(
"Inner")<0
and k < 3:
696 x.SetVisDaughters(
False)
697 x.SetVisibility(
False)
698 if not nm.find(
"LiSc")<0: x.SetVisDaughters(
False)
699 if not nm.find(
"RibPhi")<0: x.SetVisDaughters(
False)
701 for x
in [
"Ecal",
"Hcal"]:
702 xvol = sGeo.GetVolume(x)
703 if not xvol:
continue
704 xvol.SetVisDaughters(0)
705 xvol.SetVisibility(1)
706 if x==
"Ecal": xvol.SetLineColor(ROOT.kYellow)
707 else: xvol.SetLineColor(ROOT.kOrange+3)
712 xvol = sGeo.GetVolume(x)
713 if not xvol:
continue
714 xvol.SetVisDaughters(0)
715 xvol.SetVisibility(1)
716 sc = gEve.GetScenes()
717 geoscene = sc.FindChild(
'Geometry scene')
718 gEve.ElementChanged(geoscene,
True,
True)
721 sc = gEve.GetScenes()
722 geoscene = sc.FindChild(
'Geometry scene')
723 ecal = top.GetNode(
"Ecal_1")
725 ecal.GetVolume().SetLineColor(ROOT.kYellow)
726 hcal = top.GetNode(
"Hcal_1")
728 hcal.GetVolume().SetLineColor(ROOT.kOrange+3)
729 if ecal
or hcal: gEve.ElementChanged(geoscene,
True,
True)
731 sc = gEve.GetScenes()
732 geoscene = sc.FindChild(
'Geometry scene')
733 for v
in top.GetNodes():
735 if not vname.find(tag)<0:
738 gEve.ElementChanged(geoscene,
True,
True)
740 sc = gEve.GetScenes()
741 geoscene = sc.FindChild(
'Geometry scene')
742 for v
in top.GetNodes():
744 if not vname.find(tag)<0:
745 print(
'switch on ',vname)
748 gEve.ElementChanged(geoscene,
True,
True)
750 sc = gEve.GetScenes()
751 geoscene = sc.FindChild(
'Geometry scene')
752 v = sGeo.FindVolumeFast(
'vleft')
755 for v
in sGeo.GetListOfVolumes():
756 if v.GetName().find(
'wallVeto')>0:
759 gEve.ElementChanged(geoscene,
True,
True)
763 sc = gEve.GetScenes()
764 geoscene = sc.FindChild(
'Geometry scene')
765 for x
in [
'rockD',
'rockS']:
766 v = sGeo.FindVolumeFast(x)
768 gEve.ElementChanged(geoscene,
True,
True)
770 sc = gEve.GetScenes()
771 geoscene = sc.FindChild(
'Geometry scene')
772 for v
in top.GetNodes():
774 if not vname.find(
'cave')< 0 :
continue
777 if not tag.find(vname)<0: todo =
False
781 gEve.ElementChanged(geoscene,
True,
True)
783 sc = gEve.GetScenes()
784 geoscene = sc.FindChild(
'Geometry scene')
785 for v
in top.GetNodes():
787 if not vname.find(
'cave')< 0 :
continue
790 if not tag.find(vname)<0: todo =
False
794 gEve.ElementChanged(geoscene,
True,
True)
798 for v
in sGeo.GetListOfVolumes():
800 if not vname.find(pattern) < 0 : exc.append(vname)
804 if not x.find(tag)<0: print(x)
806 f = ROOT.TFile(name,
'UPDATE')
808 for x
in t.GetListOfBranches():
809 nm = x.GetName().replace(
'_1',
'')
817 self.
ruler = ROOT.TEveCompound(
'Rulers')
818 gEve.AddElement(self.
ruler)
820 self.
ruler.DestroyElements()
821 self.
ruler.OpenCompound()
822 xpos,ypos = -500., -1500.
823 zstart = ShipGeo.target.z0
824 zlength = ShipGeo.MuonStation3.z - zstart + 10*u.m
826 a1.SetNextPoint(xpos,ypos, zstart)
827 a1.SetNextPoint(xpos,ypos, zstart+zlength)
828 a1.SetMainColor(ROOT.kAzure-9)
832 for i
in range(int(zlength/100/ticks)):
834 m.SetNextPoint(xpos,ypos, z)
835 m.SetNextPoint(xpos-1*u.m,ypos,z)
836 m.SetMainColor(ROOT.kRed)
838 self.
ruler.AddElement(m)
839 t1 = ROOT.TEveText(
str(i*ticks)+
'm')
840 t1.SetMainColor(ROOT.kGray+3)
842 t1.RefMainTrans().SetPos(xpos-0.1*u.m,ypos+0.2*u.m,z)
843 self.
ruler.AddElement(t1)
846 if xy==0: z = ShipGeo.MuonStation3.z+6*u.m
850 a2.SetNextPoint(xpos,-ylength, z)
851 a2.SetNextPoint(xpos,ylength, z)
852 a2.SetMainColor(ROOT.kAzure-9)
856 for i
in range(-int(ylength/100),int(ylength/100),1):
858 m.SetNextPoint(xpos,ypos, z)
859 m.SetNextPoint(xpos+0.05*u.m,ypos,z)
860 m.SetMainColor(ROOT.kRed)
862 self.
ruler.AddElement(m)
863 t1 = ROOT.TEveText(
str(i)+
'm')
864 t1.SetMainColor(ROOT.kGray+3)
866 t1.RefMainTrans().SetPos(xpos-0.5*u.m,ypos,z)
867 self.
ruler.AddElement(t1)
869 ty = ROOT.TEveText(
"y-axis")
871 ty.RefMainTrans().SetPos(0.,ypos+1*u.m,z)
872 ty.SetMainColor(ROOT.kRed-2)
873 self.
ruler.AddElement(ty)
875 if xy==0: z = ShipGeo.MuonStation3.z+10*u.m
878 a3.SetNextPoint(-xlength,0, z)
879 a3.SetNextPoint(xlength,0, z)
880 a3.SetMainColor(ROOT.kAzure-9)
884 for i
in range(-int(xlength/100),int(xlength/100),1):
886 m.SetNextPoint(xpos,ypos, z)
887 m.SetNextPoint(xpos,ypos-0.05*u.m,z)
888 m.SetMainColor(ROOT.kRed)
890 self.
ruler.AddElement(m)
891 t1 = ROOT.TEveText(
str(i)+
'm')
892 t1.SetMainColor(ROOT.kGray+3)
894 t1.RefMainTrans().SetPos(xpos,ypos-0.1*u.m,z)
895 self.
ruler.AddElement(t1)
897 tx = ROOT.TEveText(
"x-axis")
899 tx.RefMainTrans().SetPos(xpos+1*u.m,0.,z)
900 tx.SetMainColor(ROOT.kRed-2)
901 self.
ruler.AddElement(tx)
902 t1 = ROOT.TEveText(
"SHiP")
904 t1.RefMainTrans().SetPos(0.,600.,ShipGeo.TrackStation1.z-10*u.m)
905 t1.PtrMainTrans().RotateLF(1, 3, ROOT.TMath.PiOver2())
906 t1.SetMainColor(ROOT.kOrange-2)
907 t1.SetFontMode(ROOT.TGLFont.kExtrude)
908 t1.SetLighting(ROOT.kTRUE)
909 self.
ruler.AddElement(t1)
910 self.
ruler.CloseCompound()
911 sc = ROOT.gEve.GetScenes()
912 geoscene = sc.FindChild(
'Geometry scene')
913 ROOT.gEve.ElementChanged(geoscene,
True,
True)
915 self.
ruler.DestroyElements()
918 t = g.FindObjectAny(
'cbmsim')
919 nev = t.GetEntriesFast()
922 for i
in range( min(5,nev) ) :
924 for gTr
in t.GeoTracks:
926 part = gTr.GetParticle()
927 lorv = ROOT.TLorentzVector()
928 print(
'xyz E pxpypz',gTr.GetPoint(0)[0],gTr.GetPoint(0)[1] ,gTr.GetPoint(0)[2],lorv.E(),lorv.Px(),lorv.Py(),lorv.Pz())
930 for i
in range( min(5,nev) ) :
932 for gMCTr
in t.MCTrack:
934 print(gMCTr.GetPdgCode(),gMCTr.GetMass(),gMCTr.GetP())
936 for i
in range( nev ) :
938 print(t.MCEventHeader.GetEventID(),t.MCEventHeader.GetRunID(),t.MCEventHeader.GetZ())
940 sGeo = ROOT.gGeoManager
941 cave = sGeo.GetTopVolume()
946 sc = gEve.GetScenes()
947 geoscene = sc.FindChild(
'Geometry scene')
948 topnode = geoscene.FindChild(
'cave_1')
949 topnode.SetVisLevel(4)
950 gEve.ElementChanged(geoscene,
True,
True)
952 sGeo = ROOT.gGeoManager
953 vols = sGeo.GetListOfVolumes()
954 sTree = g.FindObjectAny(
'cbmsim')
956 for s
in sTree.strawtubesPoint:
957 print(vols[s.GetDetectorID()-1].GetName())
960from basiclibs
import *
962fRun = ROOT.FairRunAna()
964 if options.geoFile[0:4] ==
"/eos": options.geoFile=ROOT.gSystem.Getenv(
"EOSSHIP")+options.geoFile
965 fRun.SetGeomFile(options.geoFile)
967if options.InputFile[0:4] ==
"/eos": options.InputFile=ROOT.gSystem.Getenv(
"EOSSHIP")+options.InputFile
968if hasattr(fRun,
'SetSource'):
969 inFile = ROOT.FairFileSource(options.InputFile)
970 fRun.SetSource(inFile)
972 fRun.SetInputFile(options.InputFile)
973if options.OutputFile ==
None:
974 options.OutputFile = ROOT.TMemFile(
'event_display_output',
'recreate')
975fRun.SetOutputFile(options.OutputFile)
978 rtdb = fRun.GetRuntimeDb()
979 parInput1 = ROOT.FairParRootFileIo()
980 parInput1.open(options.ParFile)
981 rtdb.setFirstInput(parInput1)
983fMan= ROOT.FairEventManager()
984fMan.SetMaxEnergy(400.)
985fMan.SetMinEnergy(0.1)
986fMan.SetEvtMaxEnergy(400.)
987fMan.SetPriOnly(
False)
992 Track = ROOT.FairMCTracks(
"Monte-Carlo Tracks",verbose)
993 GTrack = ROOT.FairMCTracks(
"GeoTracks",verbose)
997if not fRun.GetGeoFile().FindKey(
'ShipGeo'):
1000 if sGeo.GetVolume(
'EcalModule3') : ecalGeoFile =
"ecal_ellipse6x12m2.geo"
1001 else: ecalGeoFile =
"ecal_ellipse5x10m2.geo"
1002 ShipGeo = ConfigRegistry.loadpy(
"$FAIRSHIP/geometry/geometry_config.py", Yheight =
float(dy), EcalGeoFile = ecalGeoFile)
1006 ShipGeo = upkl.load(
'ShipGeo')
1007 if hasattr(ShipGeo,
"ecal") :
1008 if hasattr(ShipGeo.ecal,
"File") :
1009 ecalGeoFile = ShipGeo.ecal.File
1011if hasattr(ShipGeo,
"MuonTagger"):
1012 mcHits[
'MufluxSpectrometerPoints'] = ROOT.FairMCPointDraw(
"MufluxSpectrometerPoint", ROOT.kRed, ROOT.kFullSquare)
1013 mcHits[
'MuonTaggerPoints'] = ROOT.FairMCPointDraw(
"MuonTaggerPoint", ROOT.kGreen, ROOT.kFullCircle)
1014 if ShipGeo.MufluxSpectrometer.muflux ==
False:
1015 mcHits[
'BoxPoints'] = ROOT.FairMCPointDraw(
"BoxPoint", ROOT.kBlue, ROOT.kFullDiamond)
1016 mcHits[
'PixelModulesPoints'] = ROOT.FairMCPointDraw(
"PixelModulesPoint",ROOT.kRed,ROOT.kFullCircle)
1017 mcHits[
'SciFiPoints'] = ROOT.FairMCPointDraw(
"SciFiPoint",ROOT.kGreen,ROOT.kFullSquare)
1018elif hasattr(ShipGeo,
"MuFilter"):
1019 mcHits[
'ScifiPoints'] = ROOT.FairMCPointDraw(
"ScifiPoint", ROOT.kRed, ROOT.kFullDiamond)
1020 mcHits[
'MuFilterPoints'] = ROOT.FairMCPointDraw(
"MuFilterPoint", ROOT.kGreen, ROOT.kFullCircle)
1021 mcHits[
'EmulsionDetPoints'] = ROOT.FairMCPointDraw(
"EmulsionDetPoint", ROOT.kMagenta, ROOT.kCircle)
1023 mcHits[
'VetoPoints'] = ROOT.FairMCPointDraw(
"vetoPoint", ROOT.kBlue, ROOT.kFullDiamond)
1024 mcHits[
'TimeDetPoints'] = ROOT.FairMCPointDraw(
"TimeDetPoint", ROOT.kBlue, ROOT.kFullDiamond)
1025 mcHits[
'StrawPoints'] = ROOT.FairMCPointDraw(
"strawtubesPoint", ROOT.kGreen, ROOT.kFullCircle)
1026 if hasattr(ShipGeo,
"EcalOption"):
1027 if ShipGeo.EcalOption==2:
1028 mcHits[
'SplitCalPoints'] = ROOT.FairMCPointDraw(
"splitcalPoint", ROOT.kRed, ROOT.kFullSquare)
1029 if not hasattr(mcHits,
'SplitCalPoints')
and hasattr(ShipGeo,
"HcalOption"):
1030 mcHits[
'EcalPoints'] = ROOT.FairMCPointDraw(
"EcalPoint", ROOT.kRed, ROOT.kFullSquare)
1031 if ShipGeo.HcalOption!=2: mcHits[
'HcalPoints'] = ROOT.FairMCPointDraw(
"HcalPoint", ROOT.kMagenta, ROOT.kFullSquare)
1032 mcHits[
'MuonPoints'] = ROOT.FairMCPointDraw(
"muonPoint", ROOT.kYellow, ROOT.kFullSquare)
1033 mcHits[
'RpcPoints'] = ROOT.FairMCPointDraw(
"ShipRpcPoint", ROOT.kOrange, ROOT.kFullSquare)
1034 mcHits[
'TargetPoints'] = ROOT.FairMCPointDraw(
"TargetPoint", ROOT.kRed, ROOT.kFullSquare)
1036 if hasattr(ShipGeo,
'preshowerOption'):
1037 if ShipGeo.preshowerOption >0:
1038 mcHits[
'preshowerPoints'] = ROOT.FairMCPointDraw(
"preshowerPoint", ROOT.kYellow, ROOT.kFullCircle)
1040for x
in mcHits: fMan.AddTask(mcHits[x])
1049fRman = ROOT.FairRootManager.Instance()
1050sTree = fRman.GetInChain()
1051lsOfGlobals = ROOT.gROOT.GetListOfGlobals()
1052lsOfGlobals.Add(sTree)
1053sGeo = ROOT.gGeoManager
1054top = sGeo.GetTopVolume()
1059if hasattr(ShipGeo,
"Bfield"):
1060 if hasattr(ShipGeo.Bfield,
"fieldMap"):
1061 ROOT.gSystem.Load(
'libG4clhep.so')
1062 ROOT.gSystem.Load(
'libgeant4vmc.so')
1065 bfield = ROOT.genfit.FairShipFields()
1066 bfield.setField(fieldMaker.getGlobalField())
1068 bfield = ROOT.genfit.BellField(ShipGeo.Bfield.max ,ShipGeo.Bfield.z,2, ShipGeo.Bfield.y/2.*u.m)
1069 geoMat = ROOT.genfit.TGeoMaterialInterface()
1070 ROOT.genfit.MaterialEffects.getInstance().init(geoMat)
1071 fM = ROOT.genfit.FieldManager.getInstance()
1074import TrackExtrapolateTool
1075br = gEve.GetBrowser()
1077br.SetWindowName(
'SHiP Eve Window')
1084eveGlobal.SHiPDisplay = SHiPDisplay
1085SHiPDisplay.SetName(
'SHiP Displayer')
1086lsOfGlobals.Add(SHiPDisplay)
1087SHiPDisplay.InitTask()
1091print(
'Help on GL viewer can be found by pressing Help button followed by help on GL viewer')
1092print(
'With the camera button, you can switch to different views.')
1105 for aTrack
in sTree.MCTrack:
1108 if aTrack.GetMotherId()==1:
1109 pa = pdg.GetParticle(sTree.MCTrack[i] .GetPdgCode())
1110 if pa.Lifetime()>1.E-12:
1111 print(sTree.MCTrack[i])
1112 SHiPDisplay.tracks.DrawMCTrack(i)
1114 comp = SHiPDisplay.tracks.comp
1118 fPos = ROOT.TVector3()
1119 fMom = ROOT.TVector3()
1121 for fT
in sTree.MCTrack:
1123 DTrack = ROOT.TEveLine()
1124 DTrack.SetPickable(ROOT.kTRUE)
1125 DTrack.SetTitle(fT.__repr__())
1126 fT.GetStartVertex(fPos)
1127 fT.GetMomentum(fMom)
1129 hitlist[fPos.Z()] = [fPos.X(),fPos.Y()]
1131 slx,sly = fMom.X()/fMom.Z(),fMom.Y()/fMom.Z()
1132 hitlist[z] = [fPos.X()+slx*delZ,fPos.Y()+sly*delZ]
1133 for z
in hitlist.keys():
1134 DTrack.SetNextPoint(hitlist[z][0],hitlist[z][1],z)
1135 p = pdg.GetParticle(fT.GetPdgCode())
1136 if p : pName = p.GetName()
1137 else: pName =
str(fT.GetPdgCode())
1138 DTrack.SetName(
'MCTrack_'+
str(n)+
'_'+pName)
1140 DTrack.SetMainColor(c)
1141 DTrack.SetLineWidth(3)
1142 comp.AddElement(DTrack)
1144 comp.CloseCompound()
1145 gEve.ElementChanged(SHiPDisplay.tracks.evscene,
True,
True)
1149 SND = [
'SciFi',
'Wall',
'volVetoBar ',
'volFeBlock',
' volMuUpstreamBar ',
'volMuDownstreamBar_hor ',
'volMuDownstreamBar_ver ']
1150 tunnel = sGeo.GetVolume(
'Tunnel')
1151 tunnel.SetVisibility(0)
1152 tunnel.SetVisDaughters(0)
1153 for x
in sGeo.GetListOfVolumes():
1154 if x.GetName()
in SND:
1155 x.SetTransparency(60)
1156 br = gEve.GetBrowser()
1157 br.SetWindowName(
'SND@LHC Eve Window')
1159 sc = gEve.GetScenes()
1160 geoscene = sc.FindChild(
'Geometry scene')
1161 gEve.ElementChanged(geoscene,
True,
True)
1163 v = gEve.GetDefaultGLViewer()
1164 camera = v.CurrentCamera()
1167 center = array(
'd',[-9.,46.,28.])
1168 camera.Configure(1.6, 0, center, -1.57, 0)
1172def positionText(r,x,y,z,angle,txt,size=200,color=ROOT.kBlue,mode=ROOT.TGLFont.kExtrude,light=ROOT.kTRUE):
1173 tt = ROOT.TEveText(txt)
1174 tt.SetFontSize(size)
1175 tt.RefMainTrans().SetPos(x,y,z)
1176 tt.PtrMainTrans().RotateLF(1, 3, angle)
1177 tt.SetMainColor(color)
1178 tt.SetFontMode(mode)
1179 tt.SetLighting(light)
1183 for x
in [
'moreShieldingSide',
'moreShieldingTopBot',
'CoatWall',
'CoatVol',
'AbsorberVol']:
1184 vol = ROOT.gGeoManager.FindVolumeFast(x)
1185 vol.SetVisibility(0)
1186 ROOT.gGeoManager.GetMaterial(
'Concrete').SetTransparency(0)
1191 xpos,ypos = -500., -1500.
1192 zstart = ShipGeo.target.z0
1193 zlength = ShipGeo.MuonStation3.z - zstart + 10*u.m
1195 for i
in range(int(zlength/100/ticks)):
1197 m.SetNextPoint(xpos,ypos, z)
1198 m.SetNextPoint(xpos-1*u.m,ypos,z)
1199 m.SetMainColor(ROOT.kRed)
1202 t1 = ROOT.TEveText(
str(i*ticks)+
'm')
1203 t1.SetMainColor(ROOT.kGray+3)
1205 t1.RefMainTrans().SetPos(xpos-0.1*u.m,ypos+0.2*u.m,z)
1209 z = ShipGeo.MuonStation3.z+6*u.m
1212 for i
in range(-int(ylength/100),int(ylength/100),1):
1214 m.SetNextPoint(xpos,ypos, z)
1215 m.SetNextPoint(xpos+0.05*u.m,ypos,z)
1216 m.SetMainColor(ROOT.kRed)
1219 t1 = ROOT.TEveText(
str(i)+
'm')
1220 t1.SetMainColor(ROOT.kGray+3)
1222 t1.RefMainTrans().SetPos(xpos-0.5*u.m,ypos,z)
1225 ty = ROOT.TEveText(
"y-axis")
1227 ty.RefMainTrans().SetPos(0.,ypos+1*u.m,z)
1228 ty.SetMainColor(ROOT.kRed-2)
1231 z = ShipGeo.MuonStation3.z+10*u.m
1234 for i
in range(-int(xlength/100),int(xlength/100),1):
1236 m.SetNextPoint(xpos,ypos, z)
1237 m.SetNextPoint(xpos,ypos-0.05*u.m,z)
1238 m.SetMainColor(ROOT.kRed)
1241 t1 = ROOT.TEveText(
str(i)+
'm')
1242 t1.SetMainColor(ROOT.kGray+3)
1244 t1.RefMainTrans().SetPos(xpos,ypos-0.1*u.m,z)
1247 tx = ROOT.TEveText(
"x-axis")
1249 tx.RefMainTrans().SetPos(xpos+1*u.m,0.,z)
1250 tx.SetMainColor(ROOT.kRed-2)
1252 rotAngle = ROOT.TMath.Pi()+ROOT.TMath.PiOver2()*5./2.
1253 positionText(r,0.,900.,ShipGeo.TrackStation1.z-20*u.m,rotAngle,
"SHiP",200,ROOT.kOrange-2)
1254 positionText(r,0.,750.,ShipGeo.TrackStation1.z-40*u.m,rotAngle,
"Vacuum decay vessel",200,ROOT.kGray+1)
1255 positionText(r,0.,100.,ShipGeo.target.z-6*u.m,rotAngle,
"Target",200,ROOT.kBlue)
1256 positionText(r,0.,600.,ShipGeo.muShield.z-10*u.m,rotAngle,
"Active muon shield",200,ROOT.kGreen-2)
1257 positionText(r,0.,600.,ShipGeo.tauMudet.zMudetC-10*u.m,rotAngle,
"Tau neutrino detector",200,ROOT.kRed-2)
1258 positionText(r,0.,900.,ShipGeo.Bfield.z-5*u.m,rotAngle,
"Dipole Magnet",200,ROOT.kBlue+2)
1259 positionText(r,-1500.,-800.,ShipGeo.TrackStation3.z-2*u.m,rotAngle,
"Strawtracker",200,ROOT.kRed+2)
1260 positionText(r,0.,730.,ShipGeo.ecal.z-1*u.m,rotAngle,
"Ecal",200,ROOT.kOrange)
1261 positionText(r,0.,700.,ShipGeo.MuonFilter2.z,rotAngle,
"Muon",200,ROOT.kGreen+2)
1263 sc = gEve.GetScenes()
1264 geoscene = sc.FindChild(
'Geometry scene')
1265 gEve.ElementChanged(geoscene,
True,
True)
set(INCLUDE_DIRECTORIES ${SYSTEM_INCLUDE_DIRECTORIES} ${VMC_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/shipdata ${CMAKE_SOURCE_DIR}/shipLHC ${CMAKE_SOURCE_DIR}/analysis/cuts ${CMAKE_SOURCE_DIR}/analysis/tools ${FMT_INCLUDE_DIR}) include_directories($
ExecuteTask(self, option='')
InitTask(self, ecalStructure)
DrawFittedTracks(self, option='')
ExecuteTask(self, option='')
DrawMCTracks(self, option='')
ExecuteTask(self, option='')
transparentMode(self, mode='on')
rotateView(self, hor=0, ver=0)
nextEvent(self, event=None)
show(self, xy=0, ticks=5)
hidePlasticScintillator()
rename(name='ship.TGeant4.root')
positionText(r, x, y, z, angle, txt, size=200, color=ROOT.kBlue, mode=ROOT.TGLFont.kExtrude, light=ROOT.kTRUE)
readCameraSetting(fname='camSetting.root')
storeCameraSetting(fname='camSetting.root')
addVMCFields(shipGeo, controlFile='', verbose=False, withVirtualMC=True)
makeEcalGeoFile(z, efile)
configure(darkphoton=None)