226 def terminate(self):
227 ''' Write histograms to file, fills and fits the resolution plots'''
228
229 self.h_ResolutionVSdVdt_RR.SetName('ResolutionVSdVdt_RR')
230 self.h_ResolutionVSdVdt_RR.SetTitle('Resolution VS dV/dt (rising-rising)')
231 self.h_ResolutionVSdVdt_FF.SetName('ResolutionVSdVdt_FF')
232 self.h_ResolutionVSdVdt_FF.SetTitle('Resolution VS dV/dt (falling-falling)')
233
234 for ibin in range(0, 10):
235 projection = self.h_DeltaTVSdVdt_RR.ProjectionY("tmpProj", ibin * 100 + 1, (ibin + 1) * 100)
236 gaussFit = TF1("gaussFit", "[0]*exp(-0.5*((x-[1])/[2])**2)", 10., 30.)
237 gaussFit.SetParameter(0, 1.)
238 gaussFit.SetParameter(1, projection.GetMean())
239 gaussFit.SetParameter(2, projection.GetRMS())
240 gaussFit.SetParLimits(2, 0., 3. * projection.GetRMS())
241
242 projection.Fit("gaussFit")
243 self.h_ResolutionVSdVdt_RR.SetPoint(ibin, ibin * 100. + 50., gaussFit.GetParameter(2))
244 self.h_ResolutionVSdVdt_RR.SetPointError(ibin, 50., gaussFit.GetParError(2))
245
246 tfile = TFile(self.outname, 'recreate')
247 self.h_WidthVSAmplitude_1.GetXaxis().SetTitle("TOPDigit amplitude [ADC counts]")
248 self.h_WidthVSAmplitude_1.GetYaxis().SetTitle("TOPDigit width [ns]")
249 self.h_WidthVSAmplitude_1.Write()
250 self.h_WidthVSAmplitude_2.GetXaxis().SetTitle("TOPDigit amplitude [ADC counts]")
251 self.h_WidthVSAmplitude_2.GetYaxis().SetTitle("TOPDigit width [ns]")
252 self.h_WidthVSAmplitude_2.Write()
253
254 self.h_dVdtRising_1.GetXaxis().SetTitle("dV/dt [ADC counts / sample]")
255 self.h_dVdtRising_1.Write()
256 self.h_dVdtRising_2.GetXaxis().SetTitle("dV/dt [ADC counts / sample]")
257 self.h_dVdtRising_2.Write()
258 self.h_dVdtFalling_1.GetXaxis().SetTitle("dV/dt [ADC counts / sample]")
259 self.h_dVdtFalling_1.Write()
260 self.h_dVdtFalling_2.GetXaxis().SetTitle("dV/dt [ADC counts / sample]")
261 self.h_dVdtFalling_2.Write()
262
263 self.h_dVdtRisingVSdVdtFalling_1.GetXaxis().SetTitle("dV/dt on the falling edge [ADC counts / sample]")
264 self.h_dVdtRisingVSdVdtFalling_1.GetYaxis().SetTitle("dV/dt on the rising edge [ADC counts / sample]")
265 self.h_dVdtRisingVSdVdtFalling_1.Write()
266
267 self.h_dVdtRisingVSdVdtFalling_2.GetXaxis().SetTitle("dV/dt on the falling edge [ADC counts / sample]")
268 self.h_dVdtRisingVSdVdtFalling_2.GetYaxis().SetTitle("dV/dt on the rising edge [ADC counts / sample]")
269 self.h_dVdtRisingVSdVdtFalling_2.Write()
270
271 self.h_dVdtFallingDifference.GetXaxis().SetTitle("dV/dt_1 - dV/dt_2 [ADC counts / sample]")
272 self.h_dVdtFallingDifference.Write()
273
274 self.h_dVdtRisingDifference.GetXaxis().SetTitle("dV/dt_1 - dV/dt_2 [ADC counts / sample]")
275 self.h_dVdtRisingDifference.Write()
276
277 self.h_DeltaT_RR.GetXaxis().SetTitle("#Delta t [ns]")
278 self.h_DeltaT_RR.Write()
279 self.h_DeltaT_FF.GetXaxis().SetTitle("#Delta t [ns]")
280 self.h_DeltaT_FF.Write()
281 self.h_DeltaT_FR.GetXaxis().SetTitle("#Delta t [ns]")
282 self.h_DeltaT_FR.Write()
283 self.h_DeltaT_RF.GetXaxis().SetTitle("#Delta t [ns]")
284 self.h_DeltaT_RF.Write()
285
286 self.h_DeltaTVSChannel_RR.GetXaxis().SetTitle("Global channel number [hwChannel + 512*(slotID-1)]")
287 self.h_DeltaTVSChannel_RR.GetYaxis().SetTitle("#Delta t [ns]")
288 self.h_DeltaTVSChannel_RR.Write()
289 self.h_DeltaTVSChannel_FF.GetXaxis().SetTitle("Global channel number [hwChannel + 512*(slotID-1)]")
290 self.h_DeltaTVSChannel_FF.GetYaxis().SetTitle("#Delta t [ns]")
291 self.h_DeltaTVSChannel_FF.Write()
292 self.h_DeltaTVSChannel_FR.GetXaxis().SetTitle("Global channel number [hwChannel + 512*(slotID-1)]")
293 self.h_DeltaTVSChannel_FR.GetYaxis().SetTitle("#Delta t [ns]")
294 self.h_DeltaTVSChannel_FR.Write()
295 self.h_DeltaTVSChannel_RF.GetXaxis().SetTitle("Global channel number [hwChannel + 512*(slotID-1)]")
296 self.h_DeltaTVSChannel_RF.GetYaxis().SetTitle("#Delta t [ns]")
297 self.h_DeltaTVSChannel_RF.Write()
298
299 self.h_DeltaTVSdVdt_RR.GetXaxis().SetTitle("Average of dV/dt on first and second pulse [ACD counts / sample]")
300 self.h_DeltaTVSdVdt_RR.GetYaxis().SetTitle("#Delta t [ns]")
301 self.h_DeltaTVSdVdt_RR.Write()
302
303 self.h_DeltaTVSdVdt_FF.GetXaxis().SetTitle("Average of dV/dt on first and second pulse [ACD counts / sample]")
304 self.h_DeltaTVSdVdt_FF.GetYaxis().SetTitle("#Delta t [ns]")
305 self.h_DeltaTVSdVdt_FF.Write()
306
307 self.h_ResolutionVSdVdt_RR.Write()
308 tfile.Close()
309
310