13 from ROOT
import PyConfig
14 PyConfig.StartGuiThread =
False
21 from ROOT
import Belle2
22 from ROOT
import TCanvas, TH1F
23 from simulation
import add_simulation
24 from reconstruction
import add_reconstruction
36 Simple event display for TOP.
37 It displays single event timing distributions of modules using TOPDigits.
38 Distributions of modules with the track impact are shown in red color.
42 hist = [TH1F(
'h' + str(i),
'module#' + str(i), 128, 0.0, 256.0)
for i
in
45 c1 = TCanvas(
'c1',
'TOP event display', 1000, 800)
48 ''' Initialize the Module: open the canvas. '''
50 self.
c1c1.Divide(4, 4)
55 Event processor: reset and fill the histograms, display them,
56 wait for user respond.
60 self.
histhist[i].Reset()
61 self.
histhist[i].SetFillColor(0)
62 self.
histhist[i].SetLineColor(1)
65 for likelihood
in likelihoods:
66 if likelihood.getFlag() == 1:
67 exthit = likelihood.getRelated(
'ExtHits')
69 moduleID = exthit.getCopyID()
70 self.
histhist[moduleID - 1].SetFillColor(2)
71 self.
histhist[moduleID - 1].SetLineColor(2)
73 b2.B2ERROR(
'No relation to ExtHit')
77 moduleID = digit.getModuleID()
78 tdc = digit.getRawTime()
79 self.
histhist[moduleID - 1].Fill(tdc)
83 self.
histhist[i].Draw()
88 user_input = input(
"Press Enter to continue or Q to quit ").lower().strip()
91 evtMetaData.obj().setEndOfData()
95 if 'DISPLAY' not in os.environ:
96 print(
'DISPLAY variable is not set')
97 print(
'- to set it in bash: export DISPLAY=:0')
98 print(
'- to set it in csh: setenv DISPLAY :0')
102 b2.set_log_level(b2.LogLevel.ERROR)
105 main = b2.create_path()
108 eventinfosetter = b2.register_module(
'EventInfoSetter')
109 eventinfosetter.param(
'evtNumList', [1000])
110 main.add_module(eventinfosetter)
113 evtgeninput = b2.register_module(
'EvtGenInput')
114 main.add_module(evtgeninput)
118 if 'BELLE2_BACKGROUND_DIR' in os.environ:
119 bg = glob.glob(os.environ[
'BELLE2_BACKGROUND_DIR'] +
'/*.root')
120 add_simulation(main, bkgfiles=bg)
123 add_reconstruction(main)
129 progress = b2.register_module(
'Progress')
130 main.add_module(progress)
A (simplified) python wrapper for StoreArray.
a (simplified) python wrapper for StoreObjPtr.