SND@LHC Software
Loading...
Searching...
No Matches
eventDisplay_shipLHC.py
Go to the documentation of this file.
1#!/usr/bin/env python -i
2from __future__ import print_function
3from __future__ import division
4from future import standard_library
5standard_library.install_aliases()
6import ROOT,sys,os,tkinter,atexit
7from argparse import ArgumentParser
8from ShipGeoConfig import ConfigRegistry
9from rootpyPickler import Unpickler
10from array import array
11import shipunit as u
12from decorators import *
13import shipRoot_conf,shipLHC_conf
15
16
17def evExit():
18 """Prevent double delete due to a FairRoot bug."""
19 # Check whether the Eve window was closed/destructed
20 if ROOT.addressof(ROOT.gEve) == 0:
21 # Prevent the FairEventManager destructor from being called
22 ROOT.SetOwnership(fMan, False)
23
24atexit.register(evExit)
25
26fMan = None
27fRun = None
28pdg = ROOT.TDatabasePDG.Instance()
29g = ROOT.gROOT
30gEnv = ROOT.gEnv
31gEnv.SetValue('Eve.Viewer.HideMenus','off')
32
33mcEngine = "TGeant4"
34simEngine = "Pythia8"
35withGeo = False
36withMCTracks = True
37
38# muon shield strawtube decay vessel
39transparentMaterials = {'iron':80,'aluminium':80,'mylar':60,'STTmix9010_2bar':95,'steel':80,'Aluminum':80,'Scintillator':80,
40# tau nu detector
41 'CoilCopper':70,'copper':90,'HPTgas':70,'Bakelite':70,'RPCgas':70,
42# charm detector
43 'CoilAluminium':70,'molybdenum':80,'PlasticBase':70,'tantalum':70}
44#
45
46parser = ArgumentParser()
47
48parser.add_argument("-f", "--inputFile", dest="InputFile", help="Input file", required=True)
49parser.add_argument("-g", "--geoFile", dest="geoFile", help="ROOT geofile", required=True)
50parser.add_argument("-p", "--paramFile", dest="ParFile", help="FairRoot param file", required=False, default=None)
51parser.add_argument("--Debug", dest="Debug", help="Switch on debugging", required=False, action="store_true")
52parser.add_argument("-o", "--outFile", dest="OutputFile", help="Output file", required=False,default=None)
53parser.add_argument("-i", dest="HiddenParticleID", help="HiddenParticle ID", required=False,default=9900015)
54
55options = parser.parse_args()
56if options.InputFile.find('_D')>0: withGeo = True
57
58def printMCTrack(n,MCTrack):
59 mcp = MCTrack[n]
60 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, \
61 mcp.GetStartX()/u.m,mcp.GetStartY()/u.m,mcp.GetStartZ()/u.m,mcp.GetMotherId() ))
62def dump(pcut=0):
63 print(' # pid px py pz vx vy vz mid')
64 n=-1
65 for mcp in sTree.MCTrack:
66 n+=1
67 if mcp.GetP()/u.GeV < pcut : continue
68 printMCTrack(n,sTree.MCTrack)
70 print(' # converged Ndf chi2/Ndf P Pt MCid')
71 n=-1
72 for ft in sTree.FitTracks:
73 n+=1
74 fitStatus = ft.getFitStatus()
75 fitState = ft.getFittedState()
76 mom = fitState.getMom()
77 print('%3i %6i %4i %6.3F %6.3F %6.3F %6i '%(n,fitStatus.isFitConverged(),\
78 fitStatus.getNdf(),fitStatus.getChi2()/fitStatus.getNdf(),\
79 mom.Mag()/u.GeV,mom.Pt()/u.GeV,sTree.fitTrack2MC[n] ))
81 print(' # P Pt[GeV/c] DOCA[mm] Rsq Vz[m] d1 d2')
82 n=-1
83 for aP in sTree.Particles:
84 n+=1
85 doca = -1.
86 if aP.GetMother(1)==99: # DOCA is set
87 doca = aP.T()
88 Rsq = (aP.Vx()/(2.45*u.m) )**2 + (aP.Vy()/((10./2.-0.05)*u.m) )**2
89 print('%3i %6.3F %6.3F %9.3F %6.3F %6.3F %4i %4i '%(n,aP.P()/u.GeV,aP.Pt()/u.GeV,\
90 doca/u.mm,Rsq,aP.Vz()/u.m,aP.GetDaughter(0),aP.GetDaughter(1) ))
91
92class DrawTracks(ROOT.FairTask):
93 " My Fair Task"
94 def InitTask(self):
95# prepare container for fitted tracks
96 self.comp = ROOT.TEveCompound('Tracks')
97 gEve.AddElement(self.comp)
98 self.trackColors = {13:ROOT.kGreen,211:ROOT.kRed,11:ROOT.kOrange,321:ROOT.kMagenta}
99 self.z_start = 0
100 sc = gEve.GetScenes()
101 self.evscene = sc.FindChild('Event scene')
102
103 def FinishEvent(self):
104 pass
105 def ExecuteTask(self,option=''):
106 self.comp.DestroyElements()
107 self.comp.OpenCompound()
108 if sTree.FindBranch('FitTracks') or sTree.FindBranch('FitTracks_PR'):
109 if sTree.FitTracks.GetEntries() > 0:
110 self.DrawFittedTracks()
111 if not sTree.FindBranch("GeoTracks") and sTree.MCTrack.GetEntries() > 0:
112 if globals()['withMCTracks']:
113 self.DrawMCTracks()
114 #self.DrawSimpleMCTracks()
115 self.comp.CloseCompound()
116 gEve.ElementChanged(self.evscene,True,True)
117 def DrawParticle(self,n):
118 self.comp.OpenCompound()
119 DTrack = ROOT.TEveLine()
120 DTrack.SetPickable(ROOT.kTRUE)
121 DTrack.SetMainColor(ROOT.kCyan)
122 DTrack.SetLineWidth(4)
123 aP=sTree.Particles[n]
124 DTrack.SetTitle(aP.__repr__())
125 DTrack.SetName('Prtcle_'+str(n))
126 DTrack.SetNextPoint(aP.Vx(),aP.Vy(),aP.Vz())
127 lam = (self.Targetz - aP.Vz())/aP.Pz()
128 DTrack.SetNextPoint(aP.Vx()+lam*aP.Px(),aP.Vy()+lam*aP.Py(),self.Targetz)
129 self.comp.AddElement(DTrack)
130 def DrawMCTrack(self,n):
131 self.comp.OpenCompound()
132 fT = sTree.MCTrack[n]
133 DTrack = ROOT.TEveLine()
134 DTrack.SetPickable(ROOT.kTRUE)
135 DTrack.SetTitle(fT.__repr__())
136 p = pdg.GetParticle(fT.GetPdgCode())
137 if p : pName = p.GetName()
138 else: pName = str(fT.GetPdgCode())
139 DTrack.SetName('MCTrck_'+str(n)+'_'+pName)
140 fPos = ROOT.TVector3()
141 fMom = ROOT.TVector3()
142 fT.GetStartVertex(fPos)
143 fT.GetMomentum(fMom)
144# check for end vertex
145 evVx = False
146 for da in sTree.MCTrack:
147 if da.GetMotherId()==n:
148 evVx = True
149 break
150 DTrack.SetNextPoint(fPos.X(),fPos.Y(),fPos.Z())
151 if evVx and abs( da.GetStartZ()-fPos.Z() )>1*u.cm :
152 DTrack.SetNextPoint(da.GetStartX(),da.GetStartY(),da.GetStartZ())
153 else:
154 zEx = 10*u.m
155 if evVx : zEx = -10*u.m
156 lam = (zEx+fPos.Z())/fMom.Z()
157 DTrack.SetNextPoint(fPos.X()+lam*fMom.X(),fPos.Y()+lam*fMom.Y(),zEx+fPos.Z())
158 c = ROOT.kYellow
159 DTrack.SetMainColor(c)
160 DTrack.SetLineWidth(3)
161 self.comp.AddElement(DTrack)
162 self.comp.CloseCompound()
163 gEve.ElementChanged(self.evscene,True,True)
164 def DrawMCTracks(self,option=''):
165 n = -1
166 ntot = 0
167 fPos = ROOT.TVector3()
168 fMom = ROOT.TVector3()
169 for fT in sTree.MCTrack:
170 n+=1
171 DTrack = ROOT.TEveLine()
172 DTrack.SetPickable(ROOT.kTRUE)
173 DTrack.SetTitle(fT.__repr__())
174 fT.GetStartVertex(fPos)
175 hitlist = {}
176 hitlist[fPos.Z()] = [fPos.X(),fPos.Y()]
177 # look for HNL
178 if abs(fT.GetPdgCode()) == options.HiddenParticleID:
179 for da in sTree.MCTrack:
180 if da.GetMotherId()==n: break
181 # end vertex of HNL
182 da.GetStartVertex(fPos)
183 hitlist[fPos.Z()] = [fPos.X(),fPos.Y()]
184 # loop over all sensitive volumes to find hits
185 for P in ["EmulsionDetPoint","ScifiPoint"]:
186 if not sTree.GetBranch(P): continue
187 c=eval("sTree."+P)
188 for p in c:
189 if p.GetTrackID()==n:
190 if hasattr(p, "LastPoint"):
191 lp = p.LastPoint()
192 if lp.x()==lp.y() and lp.x()==lp.z() and lp.x()==0:
193# must be old data, don't expect hit at 0,0,0
194 hitlist[p.GetZ()] = [p.GetX(),p.GetY()]
195 else:
196 hitlist[lp.z()] = [lp.x(),lp.y()]
197 hitlist[2.*p.GetZ()-lp.z()] = [2.*p.GetX()-lp.x(),2.*p.GetY()-lp.y()]
198 else:
199 hitlist[p.GetZ()] = [p.GetX(),p.GetY()]
200 if len(hitlist)==1:
201 if fT.GetMotherId()<0: continue
202 if abs(sTree.MCTrack[fT.GetMotherId()].GetPdgCode()) == options.HiddenParticleID:
203 # still would like to draw track stub
204 # check for end vertex
205 evVx = False
206 for da in sTree.MCTrack:
207 if da.GetMotherId()==n:
208 evVx = True
209 break
210 if evVx : hitlist[da.GetStartZ()] = [da.GetStartX(),da.GetStartY()]
211 else :
212 zEx = 10*u.m
213 fT.GetMomentum(fMom)
214 lam = (zEx+fPos.Z())/fMom.Z()
215 hitlist[zEx+fPos.Z()] = [fPos.X()+lam*fMom.X(),fPos.Y()+lam*fMom.Y()]
216# sort in z
217 lz = list(hitlist.keys())
218 if len(lz)>1:
219 lz.sort()
220 for z in lz: DTrack.SetNextPoint(hitlist[z][0],hitlist[z][1],z)
221 p = pdg.GetParticle(fT.GetPdgCode())
222 if p : pName = p.GetName()
223 else: pName = str(fT.GetPdgCode())
224 DTrack.SetName('MCTrack_'+str(n)+'_'+pName)
225 c = ROOT.kYellow
226 if abs(fT.GetPdgCode()) == options.HiddenParticleID:c = ROOT.kMagenta
227 DTrack.SetMainColor(c)
228 DTrack.SetLineWidth(3)
229 self.comp.AddElement(DTrack)
230 ntot+=1
231 print("draw ",ntot," MC tracks")
233 comp = self.comp
234 comp.OpenCompound()
235 n = -1
236 ntot = 0
237 fPos = ROOT.TVector3()
238 fMom = ROOT.TVector3()
239 delZ = 10*u.m
240 for fT in sTree.MCTrack:
241 n+=1
242 DTrack = ROOT.TEveLine()
243 DTrack.SetPickable(ROOT.kTRUE)
244 DTrack.SetTitle(fT.__repr__())
245 fT.GetStartVertex(fPos)
246 fT.GetMomentum(fMom)
247 hitlist = {}
248 hitlist[fPos.Z()] = [fPos.X(),fPos.Y()]
249 z = fPos.Z() + delZ
250 slx,sly = fMom.X()/fMom.Z(),fMom.Y()/fMom.Z()
251 hitlist[z] = [fPos.X()+slx*delZ,fPos.Y()+sly*delZ]
252 for z in hitlist.keys():
253 DTrack.SetNextPoint(hitlist[z][0],hitlist[z][1],z)
254 p = pdg.GetParticle(fT.GetPdgCode())
255 if p : pName = p.GetName()
256 else: pName = str(fT.GetPdgCode())
257 DTrack.SetName('MCTrack_'+str(n)+'_'+pName)
258 c = ROOT.kYellow
259 DTrack.SetMainColor(c)
260 DTrack.SetLineWidth(3)
261 comp.AddElement(DTrack)
262 ntot+=1
263 comp.CloseCompound()
264 gEve.ElementChanged(SHiPDisplay.tracks.evscene,True,True)
265
266
267
268 def DrawFittedTracks(self,option=''):
269 n,ntot = -1,0
270 for fT in sTree.FitTracks:
271 n+=1
272 fst = fT.getFitStatus()
273 if not fst.isFitConverged(): continue
274 if fst.getNdf() < 20: continue
275 DTrack = ROOT.TEveLine()
276 DTrack.SetPickable(ROOT.kTRUE)
277 DTrack.SetTitle(fT.__repr__())
278 fstate = fT.getFittedState(0)
279 fPos = fstate.getPos()
280 fMom = fstate.getMom()
281 pos = fPos
282 mom = fMom
283 pid = fstate.getPDG()
284 zs = self.z_start
285 before = True
286 for i in range(self.niter):
287 rc,newpos,newmom = TrackExtrapolateTool.extrapolateToPlane(fT,zs)
288 if rc:
289 DTrack.SetNextPoint(newpos.X(),newpos.Y(),newpos.Z())
290 else:
291 print('error with extrapolation: z=',zs)
292 # use linear extrapolation
293 px,py,pz = mom.X(),mom.Y(),mom.Z()
294 lam = (zs-pos.Z())/pz
295 DTrack.SetNextPoint(pos.X()+lam*px,pos.Y()+lam*py,zs)
296 zs+=self.dz
297 DTrack.SetName('FitTrack_'+str(n))
298 c = ROOT.kWhite
299 if abs(pid) in self.trackColors : c = self.trackColors[abs(pid)]
300 DTrack.SetMainColor(c)
301 DTrack.SetLineWidth(3)
302 self.comp.AddElement(DTrack)
303 ntot+=1
304 print("draw ",ntot," fitted tracks")
305 n=-1
306 for aP in sTree.Particles:
307 n+=1
308# check fitted tracks
309 tracksOK = True
310 if aP.GetMother(1)==99: # DOCA is set
311 if aP.T()>3*u.cm : continue
312 for k in range(aP.GetNDaughters()):
313 if k>1: break # we don't have more than 2tracks/vertex yet, no idea why ROOT sometimes comes up with 4!
314 fT = sTree.FitTracks[aP.GetDaughter(k)]
315 fst = fT.getFitStatus()
316 if not fst.isFitConverged(): tracksOK=False
317 if fst.getNdf() < 20: tracksOK=False
318 if not tracksOK: continue
319 DTrack = ROOT.TEveLine()
320 DTrack.SetPickable(ROOT.kTRUE)
321 DTrack.SetMainColor(ROOT.kCyan)
322 DTrack.SetLineWidth(4)
323 DTrack.SetName('Particle_'+str(n))
324 DTrack.SetTitle(aP.__repr__())
325 DTrack.SetNextPoint(aP.Vx(),aP.Vy(),aP.Vz())
326 lam = (self.Targetz - aP.Vz())/aP.Pz()
327 DTrack.SetNextPoint(aP.Vx()+lam*aP.Px(),aP.Vy()+lam*aP.Py(),self.Targetz)
328 self.comp.AddElement(DTrack)
329#
330import evd_fillEnergy
331class IO():
332 def __init__(self):
333 self.master = tkinter.Tk()
334 self.master.title('SHiP Event Display GUI')
335 self.master.geometry(u'320x580+165+820')
336 self.fram1 = tkinter.Frame(self.master)
337 b = tkinter.Button(self.fram1, text="Next Event",command=self.nextEventnextEvent)
338 b.pack(fill=tkinter.BOTH, expand=1)
339 label = tkinter.Label(self.fram1, text='Event number:')
340 label["relief"] = tkinter.RAISED
341 entry = tkinter.Entry(self.fram1)
342 entry["foreground"] = "blue"
343 label.pack(side=tkinter.LEFT)
344 entry.pack(side=tkinter.RIGHT)
345 self.contents = tkinter.IntVar()
346 # set it to some value
347 self.n = 0
348 self.contents.set(self.n)
349 # tell the entry widget to watch this variable
350 entry["textvariable"] = self.contents
351 # and here we get a callback when the user hits return.
352 # we will have the program print out the value of the
353 # application variable when the user hits return
354 entry.bind('<Key-Return>', self.nextEventnextEvent)
355 self.lbut = {}
356 x = 'withMC'
357 a = tkinter.IntVar()
358 if globals()['withMCTracks']: a.set(1)
359 else: a.set(0)
360 self.lbut[x] = tkinter.Checkbutton(self.master,text="with MC Tracks",compound=tkinter.LEFT,variable=a)
361 self.lbut[x].var = a
362 self.lbut[x]['command'] = self.toogleMCTracks
363 self.lbut[x].pack(side=tkinter.TOP)
364 self.geoscene = ROOT.gEve.GetScenes().FindChild("Geometry scene")
365 for v in top.GetNodes():
366 x=v.GetName()
367 cmd = 'toogle("'+x+'")'
368 a = tkinter.IntVar()
369 assemb = "Assembly" in v.GetVolume().__str__()
370 if v.IsVisible() or (assemb and v.IsVisDaughters()): a.set(1)
371 else : a.set(0)
372 self.lbut[x] = tkinter.Checkbutton(self.master,text=x.replace('_1',''),compound=tkinter.LEFT,variable=a)
373 self.lbut[x].var = a
374 self.lbut[x]['command'] = lambda j=x: self.toogle(j)
375 self.lbut[x].pack(side=tkinter.BOTTOM)
376 self.fram1.pack()
377# add ship actions to eve display
378 gEve = ROOT.gEve
379 slot = ROOT.TEveWindow.CreateWindowInTab(gEve.GetBrowser().GetTabLeft())
380 slot.SetShowTitleBar(ROOT.kFALSE)
381 packs = slot.MakePack();
382 packs.SetShowTitleBar(ROOT.kFALSE);
383 packs.SetElementName("SHiP actions")
384 packs.SetHorizontal()
385 slot = packs.NewSlot()
386 frame = slot.MakeFrame()
387 frame.SetElementName("commands")
388 frame.SetShowTitleBar(ROOT.kFALSE)
389 cf = frame.GetGUICompositeFrame()
390 hf = ROOT.TGVerticalFrame(cf)
391 hf.SetCleanup(ROOT.kLocalCleanup)
392 hf.SetWidth(150)
393 cf.AddFrame(hf)
394 guiFrame = ROOT.TGVerticalFrame(hf)
395 hf.AddFrame(guiFrame, ROOT.TGLayoutHints(ROOT.kLHintsExpandX))
396 guiFrame.SetCleanup(ROOT.kDeepCleanup)
397 b = ROOT.TGTextButton(guiFrame, "Add particle follower")
398 b.SetWidth(150)
399 b.SetToolTipText('start new window with top projection and energy loss')
400 b.SetCommand('TPython::ExecScript("'+os.environ['FAIRSHIP']+'/macro/evd_addParticleFollower.py")')
401 guiFrame.AddFrame(b, ROOT.TGLayoutHints(ROOT.kLHintsExpandX))
402 bn = ROOT.TGTextButton(guiFrame, "fill histogram")
403 bn.SetWidth(150)
404 bn.SetToolTipText('Fill histogram with energy along flight path')
405 bn.SetCommand('TPython::ExecScript("'+os.environ['FAIRSHIP']+'/macro/evd_fillEnergy.py")')
406 guiFrame.AddFrame(bn, ROOT.TGLayoutHints(ROOT.kLHintsExpandX))
407 bt = ROOT.TGTextButton(guiFrame, "switch transparent mode on/off")
408 bt.SetWidth(150)
409 bt.SetToolTipText('switch transparent mode on/off for better visibility of tracks')
410 bt.SetCommand('TPython::ExecScript("'+os.environ['FAIRSHIP']+'/macro/evd_transparentMode.py")')
411 guiFrame.AddFrame(bt, ROOT.TGLayoutHints(ROOT.kLHintsExpandX))
412 bnx = ROOT.TGTextButton(guiFrame, "next event")
413 bnx.SetWidth(150)
414 bnx.SetToolTipText('click for next event')
415 bnx.SetCommand('TPython::ExecScript("'+os.environ['FAIRSHIP']+'/macro/evd_nextEvent.py")')
416 guiFrame.AddFrame(bnx, ROOT.TGLayoutHints(ROOT.kLHintsExpandX))
417 bzt = ROOT.TGTextButton(guiFrame, "synch zoom top->side")
418 bzt.SetWidth(150)
419 bzt.SetToolTipText('synchronize zoom top with side')
420 bzt.SetCommand('TPython::ExecScript("'+os.environ['FAIRSHIP']+'/macro/evd_synchZoomt.py")')
421 guiFrame.AddFrame(bzt, ROOT.TGLayoutHints(ROOT.kLHintsExpandX))
422 bzs = ROOT.TGTextButton(guiFrame, "synch zoom side->top")
423 bzs.SetWidth(150)
424 bzs.SetToolTipText('synchronize zoom side with top')
425 bzs.SetCommand('TPython::ExecScript("'+os.environ['FAIRSHIP']+'/macro/evd_synchZooms.py")')
426 guiFrame.AddFrame(bzs, ROOT.TGLayoutHints(ROOT.kLHintsExpandX))
427#
428 cf.MapSubwindows()
429 cf.Layout()
430 cf.MapWindow()
431 def nextEvent(self,event=None):
432 i = int(self.contents.get())
433 if i==self.n: self.n+=1
434 else : self.n=i
435 self.contents.set(self.n)
436 SHiPDisplay.NextEvent(self.n)
437 def toogleMCTracks(self):
438 tl = fRun.GetMainTask().GetListOfTasks()
439 geoTask = tl.FindObject("GeoTracks")
440 if globals()['withMCTracks']:
441 globals()['withMCTracks'] = False
442 self.lbut['withMC'].var.set(1)
443 if geoTask: geoTask.SetActive(0)
444 else:
445 globals()['withMCTracks'] = True
446 self.lbut['withMC'].var.set(0)
447 if geoTask: geoTask.SetActive(1)
448 def toogle(self,x):
449 v = top.GetNode(x)
450 assemb = "Assembly" in v.GetVolume().__str__()
451 if v.IsVisible()>0 or assemb and v.IsVisDaughters()>0 :
452 print("switch off ",x)
453 v.SetVisibility(0)
454 v.SetVisDaughters(0)
455 self.lbut[x].var.set(0)
456 else:
457 print("switch on ",x)
458 if assemb: v.SetVisDaughters(1)
459 else: v.SetVisibility(1)
460 self.lbut[x].var.set(1)
461 gEve.ElementChanged(self.geoscene,True,True)
462 for v in top.GetNodes():
463 x = v.GetName()
464 if x in self.lbut:
465 assemb = "Assembly" in v.GetVolume().__str__()
466 if v.IsVisible()>0 or assemb and v.IsVisDaughters()>0 : self.lbut[x].var.set(1)
467 else : self.lbut[x].var.set(0)
468#
469class EventLoop(ROOT.FairTask):
470 " My Fair Task"
471 def InitTask(self):
472 self.n = 0
473 self.first = True
474 if sGeo.GetVolume('EmulsionDet'): DisplayNuDetector()
476 self.tracks.InitTask()
477# create SHiP GUI
478 self.ioBar = IO()
480 v1 = gEve.GetDefaultViewer()
481 v1.GetEveFrame().HideAllDecorations()
482 tr=gEve.GetBrowser().GetTabRight()
483 t0 = tr.GetTabTab(0)
484 t0.SetText(ROOT.TGString('3D'))
485 def NextEvent(self,i=-1):
486 if i<0: self.n+=1
487 else : self.n=i
488 fRun.Run(self.n,self.n+1) # go for first event
489# check if tracks are made from real pattern recognition
490 if sTree.GetBranch("FitTracks_PR"): sTree.FitTracks = sTree.FitTracks_PR
491 if sTree.GetBranch("fitTrack2MC_PR"): sTree.fitTrack2MC = sTree.fitTrack2MC_PR
492 if sTree.GetBranch("Particles_PR"): sTree.Particles = sTree.Particles_PR
493 if hasattr(self,"tracks"): self.tracks.ExecuteTask()
494 if ROOT.gROOT.FindObject('Root Canvas EnergyLoss'): evd_fillEnergy.execute()
495 print('Event %i ready'%(self.n))
496# make pointsets pickable
497 for x in mcHits:
498 p = ROOT.gEve.GetCurrentEvent().FindChild(mcHits[x].GetName())
499 if p:
500 p.SetPickable(ROOT.kTRUE)
501 p.SetTitle(p.__repr__())
502 def rotateView(self,hor=0,ver=0):
503 v = ROOT.gEve.GetDefaultGLViewer()
504 cam = v.CurrentCamera()
505 cam.Reset()
506 if hor!=0 or ver!=0:
507 cam.RotateRad(hor,ver)
508 v.DoDraw()
509 def topView(self):
510 self.rotateView(ROOT.TMath.Pi()/2.,0.) # rotation around z axis
511 def bottomView(self):
512 self.rotateView(-ROOT.TMath.Pi()/2.,0.) # rotation around z axis
513 def frontView(self):
514 self.rotateView(0.,ROOT.TMath.Pi()/2.) # rotation around y or x axis
515 def backView(self):
516 self.rotateView(0.,-ROOT.TMath.Pi()/2.) # rotation around y or x axis
517 def leftView(self):
518 self.rotateView(0.,ROOT.TMath.Pi()) # rotation around y or x axis
519 def rightView(self):
520 self.rotateView(0.,ROOT.TMath.Pi()) # rotation around y or x axis
521 def transparentMode(self,mode='on'):
522 for m in transparentMaterials:
523 mat = ROOT.gGeoManager.GetMaterial(m)
524 if not mat:continue
525 if mode.lower()=='on' or mode==1:
526 mat.SetTransparency(transparentMaterials[m])
527 self.TransparentMode = 1
528 else:
529 mat.SetTransparency("\x00")
530 self.TransparentMode = 0
531 sc = gEve.GetScenes()
532 geoscene = sc.FindChild('Geometry scene')
533 if geoscene: gEve.ElementChanged(geoscene,True,True)
534# add projections DOES NOT WORK YET AS FORESEEN, under investigation. 30.11.2016
536#if 1>0:
537 # camera
538 s = ROOT.gEve.SpawnNewScene("Projected Event")
539 ROOT.gEve.GetDefaultViewer().AddScene(s)
540 v = ROOT.gEve.GetDefaultGLViewer()
541 v.SetCurrentCamera(ROOT.TGLViewer.kCameraOrthoXOY)
542 cam = v.CurrentCamera()
543 cam.SetZoomMinMax(0.2, 20)
544 # projections
545 mng = ROOT.TEveProjectionManager(ROOT.TEveProjection.kPT_RPhi)
546 s.AddElement(mng)
547 axes = ROOT.TEveProjectionAxes(mng)
548 axes.SetTitle("TEveProjections demo")
549 s.AddElement(axes)
550 ROOT.gEve.AddToListTree(axes, ROOT.kTRUE)
551 ROOT.gEve.AddToListTree(mng, ROOT.kTRUE)
552
554#if 1>0:
555 v = gEve.GetViewers()
556 vw = v.FindChild('Viewer 1')
557 if vw: vw.SetName('3d')
558 sev = ROOT.gEve.SpawnNewViewer("Scaled 2D")
559 smng = ROOT.TEveProjectionManager(ROOT.TEveProjection.kPP_Plane)
560 sp = smng.GetProjection()
561 sp.SetUsePreScale(ROOT.kTRUE)
562 sp.AddPreScaleEntry(2, 100000000., 0.1)
563 ss = ROOT.gEve.SpawnNewScene("Scaled Geom")
564 sev.AddScene(ss)
565 ss.AddElement(smng)
566 N = sGeo.GetTopNode()
567 TNod=ROOT.TEveGeoTopNode(sGeo, N, 1, 3, 10)
568 ss.AddElement(TNod)
569 eventscene = ROOT.gEve.SpawnNewScene('Scaled event')
570 eventscene.AddElement(ROOT.FairEventManager.Instance())
571 sev.AddScene(eventscene)
572 eventscene.AddElement(smng)
573 ROOT.gEve.GetBrowser().GetTabRight().SetTab(1)
574 ROOT.gEve.FullRedraw3D(ROOT.kTRUE)
575
576def storeCameraSetting(fname='camSetting.root'):
577 f = ROOT.TFile.Open(fname, "RECREATE");
578 cam = ROOT.gEve.GetDefaultGLViewer().CurrentCamera()
579 cam.Write()
580 f.Close()
581def readCameraSetting(fname='camSetting.root'):
582 f = ROOT.TFile.Open(fname)
583 cam = ROOT.gEve.GetDefaultGLViewer().CurrentCamera()
584 f.GetKey(cam.ClassName()).Read(cam)
585 cam.IncTimeStamp()
586 gEve.GetDefaultGLViewer().RequestDraw()
587 f.Close()
589 for x in ["wire","gas","rockD","rockS","rockSFe"]:
590 xvol = sGeo.GetVolume(x)
591 if xvol: xvol.SetVisibility(0)
592 for k in range(1,7):
593 va = sGeo.GetVolume("T"+str(k))
594 if not va: continue
595 for x in va.GetNodes():
596 nm = x.GetName()
597 if not nm.find("Inner")<0 and k < 3:
598 x.SetVisDaughters(False)
599 x.SetVisibility(False)
600 if not nm.find("LiSc")<0: x.SetVisDaughters(False)
601 if not nm.find("RibPhi")<0: x.SetVisDaughters(False)
602#
603 for x in ["Ecal","Hcal"]:
604 xvol = sGeo.GetVolume(x)
605 if not xvol: continue
606 xvol.SetVisDaughters(0)
607 xvol.SetVisibility(1)
608 if x=="Ecal": xvol.SetLineColor(ROOT.kYellow)
609 else: xvol.SetLineColor(ROOT.kOrange+3)
610
611# set display properties for tau nu target
613 for x in ["Wall"]:
614 xvol = sGeo.GetVolume(x)
615 if not xvol: continue
616 xvol.SetVisDaughters(0)
617 xvol.SetVisibility(1)
618 sc = gEve.GetScenes()
619 geoscene = sc.FindChild('Geometry scene')
620 gEve.ElementChanged(geoscene,True,True)
621def switchOf(tag):
622 sc = gEve.GetScenes()
623 geoscene = sc.FindChild('Geometry scene')
624 for v in top.GetNodes():
625 vname = v.GetName()
626 if not vname.find(tag)<0:
627 v.SetVisibility(0)
628 v.SetVisDaughters(0)
629 gEve.ElementChanged(geoscene,True,True)
630def switchOn(tag):
631 sc = gEve.GetScenes()
632 geoscene = sc.FindChild('Geometry scene')
633 for v in top.GetNodes():
634 vname = v.GetName()
635 if not vname.find(tag)<0:
636 print('switch on ',vname)
637 v.SetVisibility(1)
638 v.SetVisDaughters(1)
639 gEve.ElementChanged(geoscene,True,True)
640
641# switch of drawing of rock
643 sc = gEve.GetScenes()
644 geoscene = sc.FindChild('Geometry scene')
645 for x in [ 'rockD', 'rockS']:
646 v = sGeo.FindVolumeFast(x)
647 v.SetVisibility(0)
648 gEve.ElementChanged(geoscene,True,True)
649def switchOfAll(exc):
650 sc = gEve.GetScenes()
651 geoscene = sc.FindChild('Geometry scene')
652 for v in top.GetNodes():
653 vname = v.GetName()
654 if not vname.find('cave')< 0 : continue
655 todo = True
656 for tag in exc:
657 if not tag.find(vname)<0: todo = False
658 if todo:
659 v.SetVisibility(0)
660 v.SetVisDaughters(0)
661 gEve.ElementChanged(geoscene,True,True)
662def switchOnAll(exc):
663 sc = gEve.GetScenes()
664 geoscene = sc.FindChild('Geometry scene')
665 for v in top.GetNodes():
666 vname = v.GetName()
667 if not vname.find('cave')< 0 : continue
668 todo = True
669 for tag in exc:
670 if not tag.find(vname)<0: todo = False
671 if todo:
672 v.SetVisibility(1)
673 v.SetVisDaughters(1)
674 gEve.ElementChanged(geoscene,True,True)
675
676def select(pattern):
677 exc = []
678 for v in sGeo.GetListOfVolumes():
679 vname = v.GetName()
680 if not vname.find(pattern) < 0 : exc.append(vname)
681 return exc
682def search(lvdict,tag):
683 for x in lvdict:
684 if not x.find(tag)<0: print(x)
685def rename(name='ship.TGeant4.root'):
686 f = ROOT.TFile(name,'UPDATE')
687 t = f.Get('cbmsim')
688 for x in t.GetListOfBranches():
689 nm = x.GetName().replace('_1','')
690 x.SetName(nm)
691 t.Write()
692 f.Close()
693
694class Rulers(ROOT.FairTask):
695 " add Ruler"
696 def __init__(self):
697 self.ruler = ROOT.TEveCompound('Rulers')
698 gEve.AddElement(self.ruler)
699 def show(self,xy=0,ticks=5):
700 self.ruler.DestroyElements()
701 self.ruler.OpenCompound()
702 xpos,ypos = -500., -1500.
703 zstart = ShipGeo.target.z0
704 zlength = ShipGeo.MuonStation3.z - zstart + 10*u.m
705 a1 = ROOT.TEveLine()
706 a1.SetNextPoint(xpos,ypos, zstart)
707 a1.SetNextPoint(xpos,ypos, zstart+zlength)
708 a1.SetMainColor(ROOT.kAzure-9)
709 a1.SetLineWidth(30)
710 #self.ruler.AddElement(a1)
711 z=zstart
712 for i in range(int(zlength/100/ticks)):
713 m = ROOT.TEveLine()
714 m.SetNextPoint(xpos,ypos, z)
715 m.SetNextPoint(xpos-1*u.m,ypos,z)
716 m.SetMainColor(ROOT.kRed)
717 m.SetLineWidth(5)
718 self.ruler.AddElement(m)
719 t1 = ROOT.TEveText(str(i*ticks)+'m')
720 t1.SetMainColor(ROOT.kGray+3)
721 t1.SetFontSize(5)
722 t1.RefMainTrans().SetPos(xpos-0.1*u.m,ypos+0.2*u.m,z)
723 self.ruler.AddElement(t1)
724 z+=ticks*u.m
725 xpos,ypos = 0., 0.
726 if xy==0: z = ShipGeo.MuonStation3.z+6*u.m
727 else: z=xy
728 ylength = 7*u.m
729 a2 = ROOT.TEveLine()
730 a2.SetNextPoint(xpos,-ylength, z)
731 a2.SetNextPoint(xpos,ylength, z)
732 a2.SetMainColor(ROOT.kAzure-9)
733 a2.SetLineWidth(30)
734 #self.ruler.AddElement(a2)
735 ypos=-ylength
736 for i in range(-int(ylength/100),int(ylength/100),1):
737 m = ROOT.TEveLine()
738 m.SetNextPoint(xpos,ypos, z)
739 m.SetNextPoint(xpos+0.05*u.m,ypos,z)
740 m.SetMainColor(ROOT.kRed)
741 m.SetLineWidth(3)
742 self.ruler.AddElement(m)
743 t1 = ROOT.TEveText(str(i)+'m')
744 t1.SetMainColor(ROOT.kGray+3)
745 t1.SetFontSize(5)
746 t1.RefMainTrans().SetPos(xpos-0.5*u.m,ypos,z)
747 self.ruler.AddElement(t1)
748 ypos+=1*u.m
749 ty = ROOT.TEveText("y-axis")
750 ty.SetFontSize(10)
751 ty.RefMainTrans().SetPos(0.,ypos+1*u.m,z)
752 ty.SetMainColor(ROOT.kRed-2)
753 self.ruler.AddElement(ty)
754 xpos,ypos = 0., 0.
755 if xy==0: z = ShipGeo.MuonStation3.z+10*u.m
756 xlength = 3*u.m
757 a3 = ROOT.TEveLine()
758 a3.SetNextPoint(-xlength,0, z)
759 a3.SetNextPoint(xlength,0, z)
760 a3.SetMainColor(ROOT.kAzure-9)
761 a3.SetLineWidth(30)
762 #self.ruler.AddElement(a3)
763 xpos=-xlength
764 for i in range(-int(xlength/100),int(xlength/100),1):
765 m = ROOT.TEveLine()
766 m.SetNextPoint(xpos,ypos, z)
767 m.SetNextPoint(xpos,ypos-0.05*u.m,z)
768 m.SetMainColor(ROOT.kRed)
769 m.SetLineWidth(3)
770 self.ruler.AddElement(m)
771 t1 = ROOT.TEveText(str(i)+'m')
772 t1.SetMainColor(ROOT.kGray+3)
773 t1.SetFontSize(5)
774 t1.RefMainTrans().SetPos(xpos,ypos-0.1*u.m,z)
775 self.ruler.AddElement(t1)
776 xpos+=1*u.m
777 tx = ROOT.TEveText("x-axis")
778 tx.SetFontSize(10)
779 tx.RefMainTrans().SetPos(xpos+1*u.m,0.,z)
780 tx.SetMainColor(ROOT.kRed-2)
781 self.ruler.AddElement(tx)
782 t1 = ROOT.TEveText("SHiP")
783 t1.SetFontSize(200)
784 t1.RefMainTrans().SetPos(0.,600.,ShipGeo.TrackStation1.z-10*u.m)
785 t1.PtrMainTrans().RotateLF(1, 3, ROOT.TMath.PiOver2())
786 t1.SetMainColor(ROOT.kOrange-2)
787 t1.SetFontMode(ROOT.TGLFont.kExtrude)
788 t1.SetLighting(ROOT.kTRUE)
789 self.ruler.AddElement(t1)
790 self.ruler.CloseCompound()
791 sc = ROOT.gEve.GetScenes()
792 geoscene = sc.FindChild('Geometry scene')
793 ROOT.gEve.ElementChanged(geoscene,True,True)
794 def remove(self):
795 self.ruler.DestroyElements()
796
797def mydebug():
798 t = g.FindObjectAny('cbmsim')
799 nev = t.GetEntriesFast()
800 t.GetEntry(0)
801# Loop over Geo tracks
802 for i in range( min(5,nev) ) :
803 t.GetEntry(i)
804 for gTr in t.GeoTracks:
805 gTr.Print()
806 part = gTr.GetParticle()
807 lorv = ROOT.TLorentzVector()
808 print('xyz E pxpypz',gTr.GetPoint(0)[0],gTr.GetPoint(0)[1] ,gTr.GetPoint(0)[2],lorv.E(),lorv.Px(),lorv.Py(),lorv.Pz())
809# Loop over MC tracks
810 for i in range( min(5,nev) ) :
811 t.GetEntry(i)
812 for gMCTr in t.MCTrack:
813 gMCTr.Print()
814 print(gMCTr.GetPdgCode(),gMCTr.GetMass(),gMCTr.GetP())
815# MC event header
816 for i in range( nev ) :
817 t.GetEntry(i)
818 print(t.MCEventHeader.GetEventID(),t.MCEventHeader.GetRunID(),t.MCEventHeader.GetZ())
819# geometrie
820 sGeo = ROOT.gGeoManager
821 cave = sGeo.GetTopVolume()
822 cave.Draw('ogl')
823# eve
824 gEve = ROOT.gEve
825#
826 sc = gEve.GetScenes()
827 geoscene = sc.FindChild('Geometry scene')
828 topnode = geoscene.FindChild('cave_1')
829 topnode.SetVisLevel(4)
830 gEve.ElementChanged(geoscene,True,True)
832 sGeo = ROOT.gGeoManager
833 vols = sGeo.GetListOfVolumes()
834 sTree = g.FindObjectAny('cbmsim')
835 sTree.GetEntry(n)
836 for s in sTree.strawtubesPoint:
837 print(vols[s.GetDetectorID()-1].GetName())
838
839
840#----Load the default libraries------
841from basiclibs import *
842# ----- Reconstruction run -------------------------------------------
843fRun = ROOT.FairRunAna()
844if options.geoFile:
845 if options.geoFile[0:4] == "/eos": options.geoFile=ROOT.gSystem.Getenv("EOSSHIP")+options.geoFile
846 fRun.SetGeomFile(options.geoFile)
847
848if options.InputFile[0:4] == "/eos": options.InputFile=ROOT.gSystem.Getenv("EOSSHIP")+options.InputFile
849if hasattr(fRun,'SetSource'):
850 inFile = ROOT.FairFileSource(options.InputFile)
851 fRun.SetSource(inFile)
852else:
853 fRun.SetInputFile(options.InputFile)
854if options.OutputFile == None:
855 options.OutputFile = ROOT.TMemFile('event_display_output', 'recreate')
856fRun.SetSink(ROOT.FairRootFileSink(options.OutputFile))
857
858if options.ParFile:
859 rtdb = fRun.GetRuntimeDb()
860 parInput1 = ROOT.FairParRootFileIo()
861 parInput1.open(options.ParFile)
862 rtdb.setFirstInput(parInput1)
863
864fMan= ROOT.FairEventManager()
865fMan.SetMaxEnergy(400.) # default is 25 GeV only !
866fMan.SetMinEnergy(0.1) # 100 MeV
867fMan.SetEvtMaxEnergy(400.) # what is the difference between EvtMaxEnergy and MaxEnergy ?
868fMan.SetPriOnly(False) # display everything
869
870#----------------------Tracks and points -------------------------------------
871verbose = 0 # 3 lot of output
872if withGeo:
873 Track = ROOT.FairMCTracks("Monte-Carlo Tracks",verbose)
874 GTrack = ROOT.FairMCTracks("GeoTracks",verbose)
875 fMan.AddTask(GTrack)
876 fMan.AddTask(Track)
877
878if not fRun.GetGeoFile().FindKey('ShipGeo'):
879 # old geofile, missing Shipgeo dictionary
880 # try to figure out which ecal geo to load
881 ShipGeo = ConfigRegistry.loadpy("$FAIRSHIP/geometry/geometry_config.py", Yheight = float(dy), EcalGeoFile = ecalGeoFile)
882else:
883 # new geofile, load Shipgeo dictionary written by run_simScript.py
884 upkl = Unpickler( fRun.GetGeoFile() )
885 ShipGeo = upkl.load('ShipGeo')
886
887mcHits = {}
888mcHits['EmulsionDetPoints'] = ROOT.FairMCPointDraw("EmulsionDetPoint", ROOT.kGreen, ROOT.kFullSquare)
889mcHits['ScifiPoints'] = ROOT.FairMCPointDraw("ScifiPoint", ROOT.kBlue, ROOT.kFullSquare)
890mcHits['MuFilterPoints'] = ROOT.FairMCPointDraw("MuFilterPoint", ROOT.kRed, ROOT.kFullSquare)
891
892for x in mcHits: fMan.AddTask(mcHits[x])
893
894fMan.Init(1,4,10) # default Init(visopt=1, vislvl=3, maxvisnds=10000), ecal display requires vislvl=4
895#visopt, set drawing mode :
896# option=0 (default) all nodes drawn down to vislevel
897# option=1 leaves and nodes at vislevel drawn
898# option=2 path is drawn
899# vislvl
900#
901fRman = ROOT.FairRootManager.Instance()
902sTree = fRman.GetInChain()
903lsOfGlobals = ROOT.gROOT.GetListOfGlobals()
904lsOfGlobals.Add(sTree)
905sGeo = ROOT.gGeoManager
906top = sGeo.GetTopVolume()
907# manipulate colors and transparency before scene created
908speedUp()
909gEve = ROOT.gEve
910
911geoMat = ROOT.genfit.TGeoMaterialInterface()
912ROOT.genfit.MaterialEffects.getInstance().init(geoMat)
913fM = ROOT.genfit.FieldManager.getInstance()
914#fM.init(bfield)
915
916import TrackExtrapolateTool
917br = gEve.GetBrowser()
918br.HideBottomTab() # make more space for graphics
919br.SetWindowName('SHiP Eve Window')
920
921#switchOf('RockD')
922if sGeo.FindVolumeFast('T2LiSc'): hidePlasticScintillator()
923rulers = Rulers()
924SHiPDisplay = EventLoop()
925SHiPDisplay.SetName('SHiP Displayer')
926lsOfGlobals.Add(SHiPDisplay)
927SHiPDisplay.InitTask()
928#DrawSimpleMCTracks()
929# SHiPDisplay.NextEvent(0)
930
931print('Help on GL viewer can be found by pressing Help button followed by help on GL viewer')
932print('With the camera button, you can switch to different views.')
933# short cuts
934# w go to wire frame
935# r smooth display
936# t technical display
937# e black<->white background
938# j zoom in
939# k zoom out
940# d GL debug mode
941
942# fGeo.SetNsegments(10) # can help a bit in case of performance problems
944 i = -1
945 for aTrack in sTree.MCTrack:
946 i+=1
947 if i<2: continue
948 if aTrack.GetMotherId()==1:
949 pa = pdg.GetParticle(sTree.MCTrack[i] .GetPdgCode())
950 if pa.Lifetime()>1.E-12:
951 print(sTree.MCTrack[i])
952 SHiPDisplay.tracks.DrawMCTrack(i)
953
955 i = -1
956 for aTrack in sTree.MCTrack:
957 i+=1
958 if abs(aTrack.GetPdgCode())==13:
959 print(sTree.MCTrack[i])
960 SHiPDisplay.tracks.DrawMCTrack(i)
961
962def positionText(r,x,y,z,angle,txt,size=200,color=ROOT.kBlue,mode=ROOT.TGLFont.kExtrude,light=ROOT.kTRUE):
963 tt = ROOT.TEveText(txt)
964 tt.SetFontSize(size)
965 tt.RefMainTrans().SetPos(x,y,z)
966 tt.PtrMainTrans().RotateLF(1, 3, angle)
967 tt.SetMainColor(color)
968 tt.SetFontMode(mode)
969 tt.SetLighting(light)
970 r.AddElement(tt)
973 for x in ['moreShieldingSide', 'moreShieldingTopBot','CoatWall','CoatVol','AbsorberVol']:
974 vol = ROOT.gGeoManager.FindVolumeFast(x)
975 vol.SetVisibility(0)
976 ROOT.gGeoManager.GetMaterial('Concrete').SetTransparency(0)
977 r = rulers.ruler
978 ticks = 5
979 r.DestroyElements()
980 r.OpenCompound()
981 xpos,ypos = -500., -1500.
982 zstart = ShipGeo.target.z0
983 zlength = ShipGeo.MuonStation3.z - zstart + 10*u.m
984 z=zstart
985 for i in range(int(zlength/100/ticks)):
986 m = ROOT.TEveLine()
987 m.SetNextPoint(xpos,ypos, z)
988 m.SetNextPoint(xpos-1*u.m,ypos,z)
989 m.SetMainColor(ROOT.kRed)
990 m.SetLineWidth(5)
991 r.AddElement(m)
992 t1 = ROOT.TEveText(str(i*ticks)+'m')
993 t1.SetMainColor(ROOT.kGray+3)
994 t1.SetFontSize(5)
995 t1.RefMainTrans().SetPos(xpos-0.1*u.m,ypos+0.2*u.m,z)
996 r.AddElement(t1)
997 z+=ticks*u.m
998 xpos,ypos = 0., 0.
999 z = ShipGeo.MuonStation3.z+6*u.m
1000 ylength = 7*u.m
1001 ypos=-ylength
1002 for i in range(-int(ylength/100),int(ylength/100),1):
1003 m = ROOT.TEveLine()
1004 m.SetNextPoint(xpos,ypos, z)
1005 m.SetNextPoint(xpos+0.05*u.m,ypos,z)
1006 m.SetMainColor(ROOT.kRed)
1007 m.SetLineWidth(3)
1008 r.AddElement(m)
1009 t1 = ROOT.TEveText(str(i)+'m')
1010 t1.SetMainColor(ROOT.kGray+3)
1011 t1.SetFontSize(5)
1012 t1.RefMainTrans().SetPos(xpos-0.5*u.m,ypos,z)
1013 r.AddElement(t1)
1014 ypos+=1*u.m
1015 ty = ROOT.TEveText("y-axis")
1016 ty.SetFontSize(10)
1017 ty.RefMainTrans().SetPos(0.,ypos+1*u.m,z)
1018 ty.SetMainColor(ROOT.kRed-2)
1019 r.AddElement(ty)
1020 xpos,ypos = 0., 0.
1021 z = ShipGeo.MuonStation3.z+10*u.m
1022 xlength = 3*u.m
1023 xpos=-xlength
1024 for i in range(-int(xlength/100),int(xlength/100),1):
1025 m = ROOT.TEveLine()
1026 m.SetNextPoint(xpos,ypos, z)
1027 m.SetNextPoint(xpos,ypos-0.05*u.m,z)
1028 m.SetMainColor(ROOT.kRed)
1029 m.SetLineWidth(3)
1030 r.AddElement(m)
1031 t1 = ROOT.TEveText(str(i)+'m')
1032 t1.SetMainColor(ROOT.kGray+3)
1033 t1.SetFontSize(5)
1034 t1.RefMainTrans().SetPos(xpos,ypos-0.1*u.m,z)
1035 r.AddElement(t1)
1036 xpos+=1*u.m
1037 tx = ROOT.TEveText("x-axis")
1038 tx.SetFontSize(10)
1039 tx.RefMainTrans().SetPos(xpos+1*u.m,0.,z)
1040 tx.SetMainColor(ROOT.kRed-2)
1041 r.AddElement(tx)
1042 rotAngle = ROOT.TMath.Pi()+ROOT.TMath.PiOver2()*5./2.
1043 positionText(r,0.,900.,ShipGeo.TrackStation1.z-20*u.m,rotAngle,"SHiP",200,ROOT.kOrange-2)
1044 positionText(r,0.,750.,ShipGeo.TrackStation1.z-40*u.m,rotAngle,"Vacuum decay vessel",200,ROOT.kGray+1)
1045 positionText(r,0.,100.,ShipGeo.target.z-6*u.m,rotAngle,"Target",200,ROOT.kBlue)
1046 positionText(r,0.,600.,ShipGeo.muShield.z-10*u.m,rotAngle,"Active muon shield",200,ROOT.kGreen-2)
1047 positionText(r,0.,600.,ShipGeo.tauMudet.zMudetC-10*u.m,rotAngle,"Tau neutrino detector",200,ROOT.kRed-2)
1048 positionText(r,0.,900.,ShipGeo.Bfield.z-5*u.m,rotAngle,"Dipole Magnet",200,ROOT.kBlue+2)
1049 positionText(r,-1500.,-800.,ShipGeo.TrackStation3.z-2*u.m,rotAngle,"Strawtracker",200,ROOT.kRed+2)
1050 positionText(r,0.,730.,ShipGeo.ecal.z-1*u.m,rotAngle,"Ecal",200,ROOT.kOrange)
1051 positionText(r,0.,700.,ShipGeo.MuonFilter2.z,rotAngle,"Muon",200,ROOT.kGreen+2)
1052 r.CloseCompound()
1053 sc = gEve.GetScenes()
1054 geoscene = sc.FindChild('Geometry scene')
1055 gEve.ElementChanged(geoscene,True,True)
1056
1057
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($
Definition CMakeLists.txt:1
rename(name='ship.TGeant4.root')
storeCameraSetting(fname='camSetting.root')
positionText(r, x, y, z, angle, txt, size=200, color=ROOT.kBlue, mode=ROOT.TGLFont.kExtrude, light=ROOT.kTRUE)
readCameraSetting(fname='camSetting.root')
configure(darkphoton=None)