120 def event(self):
121 '''
122 Event processor: fill the histograms, display them,
123 wait for user respond.
124 '''
125
127 event = evtMetaData.obj().getEvent()
128 run = evtMetaData.obj().getRun()
129
131
132 k = 0
133
134 fname = 'waveforms_run' + str(run) + '_event' + str(event) + '_chan'
135
136 self.pdfFile = fname
137 for waveform in waveforms:
138 slot = waveform.getModuleID()
139 chan = waveform.getChannel()
140 self.pdfFile = self.pdfFile + '-S' + str(slot) + '_' + str(chan)
141 wf = waveform.getWaveform()
142 self.hist[k].Reset()
143 numSamples = waveform.getSize()
144 startSample = waveform.getStartSample()
145 self.hist[k].SetBins(numSamples, float(startSample), float(startSample + numSamples))
146 title = 'S' + str(slot) + ' chan ' + str(chan) + ' win'
147 if waveform.getStorageWindows().empty():
148 title += ' ' + str(waveform.getStorageWindow())
149 else:
150 for window in waveform.getStorageWindows():
151 title += ' ' + str(window)
152 self.hist[k].SetTitle(title)
153 self.hist[k].SetStats(False)
154 self.hist[k].SetLineColor(8)
155
156 i = 0
157 for sample in wf:
158 i = i + 1
159 self.hist[k].SetBinContent(i, sample)
160
161 self.gpaint[k].SetLineColor(9)
162 self.set_gpaint(waveform, k)
163
164 rawDigits = waveform.getRelationsWith("TOPRawDigits")
165 self.graphs[k].clear()
166 self.tlpfgraphs[k].clear()
167 for raw in rawDigits:
168 graph = TGraph(5)
169 graph.SetMarkerStyle(24)
170 graph.SetPoint(0, raw.getSampleRise() + 0.5, raw.getValueRise0())
171 graph.SetPoint(1, raw.getSampleRise() + 1.5, raw.getValueRise1())
172 graph.SetPoint(2, raw.getSamplePeak() + 0.5, raw.getValuePeak())
173 graph.SetPoint(3, raw.getSampleFall() + 0.5, raw.getValueFall0())
174 graph.SetPoint(4, raw.getSampleFall() + 1.5, raw.getValueFall1())
175 if raw.isMadeOffline():
176 graph.SetMarkerStyle(5)
177 if raw.isFEValid() and not raw.isAtWindowDiscontinuity():
178 graph.SetMarkerColor(2)
179 if raw.isPedestalJump():
180 graph.SetMarkerColor(3)
181 else:
182 graph.SetMarkerColor(4)
183 self.graphs[k].append(graph)
184
185 tlpfResult = raw.getRelated("TOPTemplateFitResults")
186 if tlpfResult:
187 tlpfgraph = TGraph(2)
188 tlpfgraph.SetMarkerStyle(25)
189 tlpfgraph.SetPoint(0, tlpfResult.getRisingEdge(),
190 tlpfResult.getAmplitude() / 2 + tlpfResult.getBackgroundOffset())
191 tlpfgraph.SetPoint(1, tlpfResult.getRisingEdge(), tlpfResult.getBackgroundOffset())
192 print('Template Fit Chisquare: ', tlpfResult.getChisquare())
193 self.tlpfgraphs[k].append(tlpfgraph)
194
195 k = k + 1
196 if k == 4:
197 stat = self.draw(k, event, run)
198 if stat:
199 return
200 k = 0
201 self.pdfFile = fname
202
203 if k > 0:
204 self.draw(k, event, run)
205
206
A (simplified) python wrapper for StoreArray.
a (simplified) python wrapper for StoreObjPtr.