def runSubEventFinder(config, input, outfilename):
    print "Opening ... ", input

    # Load Data
    from pylard.pylardata.rawdigitsopdata import RawDigitsOpData
    opdata = RawDigitsOpData(input)
    ok = opdata.getNextEvent()

    # Load Calibration
    from pysubevent.pysubevent.cysubeventdisc import formSubEventsCPP
    import pysubevent.utils.pmtcalib as spe
    pmtspe = spe.getCalib("../config/pmtcalib_20150930.json")

    # Setup Output
    from pysubevent.pysubevent.cysubeventdisc import pyWaveformData, pySubEventIO, pySubEventList

    subeventio = pySubEventIO(outfilename, 'w')

    nevents = 0
    while ok:

        # first we get cosmic discriminator windows and make them into subevents
        cosmic_subevents, boundarysubevent = prepCosmicSubEvents(
            opdata, config)
        wfms, qs = prepWaveforms(
            opdata, boundarysubevent
        )  # extract numpy arrays, undershoot correct, pedestal correct
        pywfms = pyWaveformData()  # packages
        pywfms.storeWaveforms(wfms)

        # beam window subevents
        subevents, unclaimedflashes = formSubEventsCPP(pywfms, config, pmtspe)
        nsubevents = subevents.size

        subeventio.clearlist()
        subeventio.eventid = opdata.current_event
        subeventio.chmaxamp = np.max(wfms)
        print "chmaxamp: ", subeventio.chmaxamp
        subeventio.transferSubEventList(subevents)
        subeventio.transferSubEventList(cosmic_subevents)
        subeventio.fill()
        nevents += 1
        #if nsubevents>0:
        #raw_input()
        #if nevents>=200:
        #    break
        if opdata.current_event >= 1000:
            break
        ok = opdata.getNextEvent()

    subeventio.write()
def test_runSubEventFinder(opdata, seconfig, filename, opdisplay=None):

    subeventio = pySubEventIO(filename, 'w')

    from pysubevent.pysubevent.cysubeventdisc import formSubEventsCPP
    import pysubevent.utils.pmtcalib as spe
    pmtspe = spe.getCalib("../config/pmtcalib_20150930.json")

    ok = True
    opdisplay.gotoEvent(opdata.event)

    while ok:
        cosmic_subevents, boundary_subevent = prepCosmicSubEvents(
            opdata, seconfig)

        #boundary_subevent = None
        wfms, qs = prepWaveforms(opdata,
                                 seconfig.RC,
                                 seconfig.fA,
                                 seconfig.hgslot,
                                 seconfig.lgslot,
                                 boundary_subevent,
                                 doit=False)  # extract numpy arrays
        pywfms = pyWaveformData()
        pywfms.storeWaveforms(wfms)  # package
        pywfms.calcBaselineInfo()
        #for i in range(0,wfms.shape[1]):
        #    print "ch ",i,": max=",np.max(wfms[:,i])
        print "BEAM WINS: ", opdata.beamwindows.getNumWindows()
        print "COSMIC WINS: ", opdata.cosmicwindows.getNumWindows()

        baselines = np.zeros(wfms.shape, dtype=np.float)
        variances = np.zeros(wfms.shape, dtype=np.float)
        print "baslines: ", baselines.shape
        for ch in range(0, wfms.shape[1]):
            baselines[:, ch] = pywfms.getbaseline(ch)

        subevents, unclaimed_flashes = formSubEventsCPP(
            pywfms, seconfig, pmtspe)
        if boundary_subevent is None:
            print "[NUMBER OF SUBEVENT: ", subevents.size, "]"
        else:
            print "[NUMBER OF SUBEVENT: ", subevents.size, "] + [BOUNDARY SUBEVENT]"
        for subevent in subevents.getlist():
            print subevents, "t=", subevent.tstart_sample, " nflashes=", len(
                subevent.getFlashList())
        subeventio.transferSubEventList(subevents)
        subeventio.fill()
        subeventio.write()

        hgslot = 5
        if opdisplay is not None:
            # add subevent drawings
            #opdisplay.clearUserWaveformItem()
            subeventlist = subevents.getlist()
            if boundary_subevent is not None:
                subeventlist.append(boundary_subevent)
            for isubevent, subevent in enumerate(subeventlist):
                for flash in subevent.getFlashList():
                    beamchoffset = opdata.getBeamWindows(
                        hgslot, flash.ch)[0].getTimestamp()
                    x, y = makeFlashPlotArrays(flash,
                                               seconfig,
                                               color=colorlist[isubevent % 6])
                    opdata.userwindows.makeWindow(
                        y,
                        x + beamchoffset,
                        5,
                        flash.ch,
                        default_color=colorlist[isubevent % 6],
                        highlighted_color=colorlist[isubevent % 6])
                    if subevent in [boundary_subevent]:
                        x = np.linspace(
                            seconfig.nspersample * flash.tstart,
                            seconfig.nspersample *
                            (flash.tstart + len(flash.waveform)),
                            len(flash.waveform))
                        y = flash.waveform
                        opdata.userwindows.makeWindow(
                            y,
                            x,
                            5,
                            flash.ch,
                            default_color=colorlist[isubevent % 6],
                            highlighted_color=colorlist[isubevent % 6])
                        if flash.ch in opdata.suppressed_wfm:
                            beamchoffset2 = opdata.getBeamWindows(
                                hgslot, flash.ch)[0].getTimestamp()
                            x = np.linspace(
                                0,
                                len(opdata.suppressed_wfm[flash.ch]) *
                                seconfig.nspersample,
                                len(opdata.suppressed_wfm[
                                    flash.ch])) + beamchoffset2
                            y = opdata.suppressed_wfm[flash.ch]
                            opdata.userwindows.makeWindow(y, x, 5, flash.ch)

                for flash in subevent.getFlash2List():
                    beamchoffset = opdata.getBeamWindows(
                        hgslot, flash.ch)[0].getTimestamp()
                    x, y = makeFlashPlotArrays(flash,
                                               seconfig,
                                               color=colorlist[isubevent % 6])
                    #opdata.userwindows.makeWindow( y, x+beamchoffset, 5, flash.ch, default_color=colorlist[ isubevent%6 ], highlighted_color=colorlist[ isubevent%6 ] )

            #for flash in unclaimed_flashes.getFlashes():
            #    beamchoffset = opdata.getBeamWindows( hgslot, flash.ch )[0].getTimestamp()
            #    x,y = makeFlashPlotArrays( flash, seconfig )
            #    opdata.userwindows.makeWindow( y, x+beamchoffset, 5, flash.ch, default_color=(0,255,0,255), highlighted_color=(0,255,0,255)  )

            for ch in range(0, 32):
                beamchoffset = opdata.getBeamWindows(hgslot,
                                                     ch)[0].getTimestamp()
                x = np.linspace(0,
                                len(baselines[:, ch]) * seconfig.nspersample,
                                len(baselines[:, ch])) + beamchoffset
                y = baselines[:, ch]
                #opdata.userwindows.makeWindow( y, x, 5, ch, default_color=(255,128,0,255), highlighted_color=(255,128,0,255) )

                qcorr = qs[ch]
                x = np.linspace(
                    beamchoffset,
                    beamchoffset + len(qcorr) * seconfig.nspersample,
                    len(qcorr))
                y = qcorr
                opdata.userwindows.makeWindow(y,
                                              x,
                                              5,
                                              ch,
                                              default_color=(255, 128, 0, 50),
                                              highlighted_color=(255, 128, 0,
                                                                 50))

                #plot_variance = pg.PlotCurveItem()
                #x = np.linspace( 0, len(variances[:,ch])*seconfig.nspersample, len(variances[:,ch]) )
                #y = variances[:,ch]
                #plot_variance.setData( x=x, y=y, pen=(255,204,153,255) )
                #opdisplay.addUserWaveformItem( plot_variance, ch=ch )

        #if subevents.size>0:
            opdisplay.plotData()
            #opdisplay.gotoEvent( opdata.event )
            raw_input()
        ok = opdata.getNextEntry()
def test_runSubEventFinder( opdata, seconfig, filename, opdisplay=None ):

    from pysubevent.pysubevent.cysubeventdisc import formSubEventsCPP
    import pysubevent.utils.pmtcalib as spe
    pmtspe = spe.getCalib( "../config/pmtcalib_20150930.json" )

    from pysubevent.pyoptrackfit.cyoptrackfit import runpyOpTrackFit, pyOpTrackFitConfig, makeHistograms

    tf = ROOT.TFile("test_optrack.root","recreate")
    opconfig = pyOpTrackFitConfig( "optrackfit.json" )

    ok = True
    hgslot = 5
    lgslot = 6

    while ok:

        cosmic_subevents, boundary_subevent = prepCosmicSubEvents( opdata, seconfig )
        #boundary_subevent = None
        wfms,qs = prepWaveforms( opdata, boundary_subevent )   # extract numpy arrays
        pywfms = pyWaveformData()
        pywfms.storeWaveforms( wfms )  # package
        pywfms.calcBaselineInfo()
        #for i in range(0,wfms.shape[1]):
        #    print "ch ",i,": max=",np.max(wfms[:,i])

        baselines = np.zeros( wfms.shape, dtype=np.float )
        variances = np.zeros( wfms.shape, dtype=np.float )
        print "baslines: ",baselines.shape
        for ch in range(0, wfms.shape[1] ):
            baselines[:,ch] = pywfms.getbaseline( ch )

        subevents, unclaimed_flashes = formSubEventsCPP( pywfms, seconfig, pmtspe )
        if boundary_subevent is None:
            print "[NUMBER OF SUBEVENT: ",subevents.size,"]"
        else:
            print "[NUMBER OF SUBEVENT: ",subevents.size,"] + [BOUNDARY SUBEVENT]"

        subevents.sortByAmp()
        for subevent in subevents.getlist():
            print subevents, "t=",subevent.tstart_sample, " nflashes=",len(subevent.getFlashList())

        print "Run OpTrackFin"
        #OpTrackFit( subevents ) # pythonthin

        ndims = 6
        sampler = runpyOpTrackFit( subevents.getlist()[0], opconfig, photonlib.photonlib ) # native c++
        print "op track fit returned"
        np.savez( "tracksamples.npz", sampler.flatchain )
        print "samples saved"
        hzy, hxy, hzx = makeHistograms( sampler.flatchain, photonlib, photonlib.photonlib, opconfig, "event%d"%(opdata.event) )
        print "made histograms"
        hzy.Write()
        hxy.Write()
        hzx.Write()
        #for i in range(ndims):
        #    pl.figure()
        #    pl.hist(sampler.flatchain[:,i], 100, color="k", histtype="step")
        #    pl.title("Dimension {0:d}".format(i))
        #pl.show()
            
        if opdisplay is not None:
            # add subevent drawings
            #opdisplay.clearUserWaveformItem()
            subeventlist = subevents.getlist()
            if boundary_subevent is not None:
                subeventlist.append( boundary_subevent )
            for isubevent,subevent in enumerate( subeventlist ):
                for flash in subevent.getFlashList():
                    beamchoffset = opdata.getBeamWindows( hgslot, flash.ch )[0].getTimestamp()
                    x,y = makeFlashPlotArrays( flash, seconfig, color=colorlist[ isubevent%6 ] )
                    opdata.userwindows.makeWindow( y, x+beamchoffset, 5, flash.ch, default_color=colorlist[ isubevent%6 ], highlighted_color=colorlist[ isubevent%6 ] )
                    if subevent in [boundary_subevent]:
                        x = np.linspace( seconfig.nspersample*flash.tstart, seconfig.nspersample*(flash.tstart+len(flash.waveform)), len(flash.waveform) )
                        y = flash.waveform
                        opdata.userwindows.makeWindow( y, x, 5, flash.ch, default_color=colorlist[ isubevent%6 ], highlighted_color=colorlist[ isubevent%6 ] )
                        if flash.ch in opdata.suppressed_wfm:
                            beamchoffset2 = opdata.getBeamWindows( hgslot, flash.ch )[0].getTimestamp()
                            x = np.linspace( 0, len(opdata.suppressed_wfm[flash.ch])*seconfig.nspersample, len( opdata.suppressed_wfm[flash.ch]) ) + beamchoffset2
                            y = opdata.suppressed_wfm[flash.ch]
                            opdata.userwindows.makeWindow( y, x, 5, flash.ch )

                for flash in subevent.getFlash2List():
                    beamchoffset = opdata.getBeamWindows( hgslot, flash.ch )[0].getTimestamp()
                    x,y = makeFlashPlotArrays( flash, seconfig, color=colorlist[ isubevent%6 ] )
                    opdata.userwindows.makeWindow( y, x+beamchoffset, 5, flash.ch, default_color=colorlist[ isubevent%6 ], highlighted_color=colorlist[ isubevent%6 ] )

            for flash in unclaimed_flashes.getFlashes():
                beamchoffset = opdata.getBeamWindows( hgslot, flash.ch )[0].getTimestamp()
                x,y = makeFlashPlotArrays( flash, seconfig )
                opdata.userwindows.makeWindow( y, x+beamchoffset, 5, flash.ch, default_color=(0,255,0,255), highlighted_color=(0,255,0,255)  )

            for ch in range(0,32):
                plot_baseline = pg.PlotCurveItem()
                beamchoffset = opdata.getBeamWindows( hgslot, ch )[0].getTimestamp()
                x = np.linspace( 0, len(baselines[:,ch])*seconfig.nspersample, len(baselines[:,ch]) ) + beamchoffset
                y = baselines[:,ch]
                #opdata.userwindows.makeWindow( y, x, 5, ch, default_color=(255,128,0,255), highlighted_color=(255,128,0,255) )
                
                #plot_variance = pg.PlotCurveItem()
                #x = np.linspace( 0, len(variances[:,ch])*seconfig.nspersample, len(variances[:,ch]) )
                #y = variances[:,ch]
                #plot_variance.setData( x=x, y=y, pen=(255,204,153,255) )
                #opdisplay.addUserWaveformItem( plot_variance, ch=ch )

        #if subevents.size>0:
            #opdisplay.plotData()
            opdisplay.gotoEvent( opdata.event )
  
        #if subevents.size>0:
            raw_input()
        ok = opdata.getNextEntry()
def test_runSubEventFinder( opdata, seconfig, filename, opdisplay=None ):

    subeventio = pySubEventIO( filename, 'w' )
    
    from pysubevent.pysubevent.cysubeventdisc import formSubEventsCPP
    import pysubevent.utils.pmtcalib as spe
    pmtspe = spe.getCalib( "../config/pmtcalib_20150930.json" )

    ok = True
    opdisplay.gotoEvent( opdata.event )

    while ok:
        cosmic_subevents, boundary_subevent = prepCosmicSubEvents( opdata, seconfig )

        #boundary_subevent = None
        wfms,qs = prepWaveforms( opdata, seconfig.RC, seconfig.fA, seconfig.hgslot, seconfig.lgslot, boundary_subevent, doit=False )   # extract numpy arrays
        pywfms = pyWaveformData()
        pywfms.storeWaveforms( wfms )  # package
        pywfms.calcBaselineInfo()
        #for i in range(0,wfms.shape[1]):
        #    print "ch ",i,": max=",np.max(wfms[:,i])
        print "BEAM WINS: ",opdata.beamwindows.getNumWindows()
        print "COSMIC WINS: ",opdata.cosmicwindows.getNumWindows()

        baselines = np.zeros( wfms.shape, dtype=np.float )
        variances = np.zeros( wfms.shape, dtype=np.float )
        print "baslines: ",baselines.shape
        for ch in range(0, wfms.shape[1] ):
            baselines[:,ch] = pywfms.getbaseline( ch )

        subevents, unclaimed_flashes = formSubEventsCPP( pywfms, seconfig, pmtspe )
        if boundary_subevent is None:
            print "[NUMBER OF SUBEVENT: ",subevents.size,"]"
        else:
            print "[NUMBER OF SUBEVENT: ",subevents.size,"] + [BOUNDARY SUBEVENT]"
        for subevent in subevents.getlist():
            print subevents, "t=",subevent.tstart_sample, " nflashes=",len(subevent.getFlashList())
        subeventio.transferSubEventList( subevents )
        subeventio.fill()
        subeventio.write()
        
        hgslot = 5
        if opdisplay is not None:
            # add subevent drawings
            #opdisplay.clearUserWaveformItem()
            subeventlist = subevents.getlist()
            if boundary_subevent is not None:
                subeventlist.append( boundary_subevent )
            for isubevent,subevent in enumerate( subeventlist ):
                for flash in subevent.getFlashList():
                    beamchoffset = opdata.getBeamWindows( hgslot, flash.ch )[0].getTimestamp()
                    x,y = makeFlashPlotArrays( flash, seconfig, color=colorlist[ isubevent%6 ] )
                    opdata.userwindows.makeWindow( y, x+beamchoffset, 5, flash.ch, default_color=colorlist[ isubevent%6 ], highlighted_color=colorlist[ isubevent%6 ] )
                    if subevent in [boundary_subevent]:
                        x = np.linspace( seconfig.nspersample*flash.tstart, seconfig.nspersample*(flash.tstart+len(flash.waveform)), len(flash.waveform) )
                        y = flash.waveform
                        opdata.userwindows.makeWindow( y, x, 5, flash.ch, default_color=colorlist[ isubevent%6 ], highlighted_color=colorlist[ isubevent%6 ] )
                        if flash.ch in opdata.suppressed_wfm:
                            beamchoffset2 = opdata.getBeamWindows( hgslot, flash.ch )[0].getTimestamp()
                            x = np.linspace( 0, len(opdata.suppressed_wfm[flash.ch])*seconfig.nspersample, len( opdata.suppressed_wfm[flash.ch]) ) + beamchoffset2
                            y = opdata.suppressed_wfm[flash.ch]
                            opdata.userwindows.makeWindow( y, x, 5, flash.ch )

                for flash in subevent.getFlash2List():
                    beamchoffset = opdata.getBeamWindows( hgslot, flash.ch )[0].getTimestamp()
                    x,y = makeFlashPlotArrays( flash, seconfig, color=colorlist[ isubevent%6 ] )
                    #opdata.userwindows.makeWindow( y, x+beamchoffset, 5, flash.ch, default_color=colorlist[ isubevent%6 ], highlighted_color=colorlist[ isubevent%6 ] )

            #for flash in unclaimed_flashes.getFlashes():
            #    beamchoffset = opdata.getBeamWindows( hgslot, flash.ch )[0].getTimestamp()
            #    x,y = makeFlashPlotArrays( flash, seconfig )
            #    opdata.userwindows.makeWindow( y, x+beamchoffset, 5, flash.ch, default_color=(0,255,0,255), highlighted_color=(0,255,0,255)  )

            for ch in range(0,32):
                beamchoffset = opdata.getBeamWindows( hgslot, ch )[0].getTimestamp()
                x = np.linspace( 0, len(baselines[:,ch])*seconfig.nspersample, len(baselines[:,ch]) ) + beamchoffset
                y = baselines[:,ch]
                #opdata.userwindows.makeWindow( y, x, 5, ch, default_color=(255,128,0,255), highlighted_color=(255,128,0,255) )
                
                qcorr = qs[ch]
                x = np.linspace( beamchoffset, beamchoffset+len(qcorr)*seconfig.nspersample, len(qcorr) )
                y = qcorr
                opdata.userwindows.makeWindow( y, x, 5, ch, default_color=(255,128,0,50), highlighted_color=(255,128,0,50) )

                #plot_variance = pg.PlotCurveItem()
                #x = np.linspace( 0, len(variances[:,ch])*seconfig.nspersample, len(variances[:,ch]) )
                #y = variances[:,ch]
                #plot_variance.setData( x=x, y=y, pen=(255,204,153,255) )
                #opdisplay.addUserWaveformItem( plot_variance, ch=ch )

        #if subevents.size>0:
            opdisplay.plotData()
            #opdisplay.gotoEvent( opdata.event )
            raw_input()
        ok = opdata.getNextEntry()
Beispiel #5
0
def test_runSubEventFinder(opdata, seconfig, filename, opdisplay=None):

    from pysubevent.pysubevent.cysubeventdisc import formSubEventsCPP
    import pysubevent.utils.pmtcalib as spe
    pmtspe = spe.getCalib("../config/pmtcalib_20150930.json")

    from pysubevent.pyoptrackfit.cyoptrackfit import runpyOpTrackFit, pyOpTrackFitConfig, makeHistograms

    tf = ROOT.TFile("test_optrack.root", "recreate")
    opconfig = pyOpTrackFitConfig("optrackfit.json")

    ok = True
    hgslot = 5
    lgslot = 6

    while ok:

        cosmic_subevents, boundary_subevent = prepCosmicSubEvents(
            opdata, seconfig)
        #boundary_subevent = None
        wfms, qs = prepWaveforms(opdata,
                                 boundary_subevent)  # extract numpy arrays
        pywfms = pyWaveformData()
        pywfms.storeWaveforms(wfms)  # package
        pywfms.calcBaselineInfo()
        #for i in range(0,wfms.shape[1]):
        #    print "ch ",i,": max=",np.max(wfms[:,i])

        baselines = np.zeros(wfms.shape, dtype=np.float)
        variances = np.zeros(wfms.shape, dtype=np.float)
        print "baslines: ", baselines.shape
        for ch in range(0, wfms.shape[1]):
            baselines[:, ch] = pywfms.getbaseline(ch)

        subevents, unclaimed_flashes = formSubEventsCPP(
            pywfms, seconfig, pmtspe)
        if boundary_subevent is None:
            print "[NUMBER OF SUBEVENT: ", subevents.size, "]"
        else:
            print "[NUMBER OF SUBEVENT: ", subevents.size, "] + [BOUNDARY SUBEVENT]"

        subevents.sortByAmp()
        for subevent in subevents.getlist():
            print subevents, "t=", subevent.tstart_sample, " nflashes=", len(
                subevent.getFlashList())

        print "Run OpTrackFin"
        #OpTrackFit( subevents ) # pythonthin

        ndims = 6
        sampler = runpyOpTrackFit(subevents.getlist()[0], opconfig,
                                  photonlib.photonlib)  # native c++
        print "op track fit returned"
        np.savez("tracksamples.npz", sampler.flatchain)
        print "samples saved"
        hzy, hxy, hzx = makeHistograms(sampler.flatchain, photonlib,
                                       photonlib.photonlib, opconfig,
                                       "event%d" % (opdata.event))
        print "made histograms"
        hzy.Write()
        hxy.Write()
        hzx.Write()
        #for i in range(ndims):
        #    pl.figure()
        #    pl.hist(sampler.flatchain[:,i], 100, color="k", histtype="step")
        #    pl.title("Dimension {0:d}".format(i))
        #pl.show()

        if opdisplay is not None:
            # add subevent drawings
            #opdisplay.clearUserWaveformItem()
            subeventlist = subevents.getlist()
            if boundary_subevent is not None:
                subeventlist.append(boundary_subevent)
            for isubevent, subevent in enumerate(subeventlist):
                for flash in subevent.getFlashList():
                    beamchoffset = opdata.getBeamWindows(
                        hgslot, flash.ch)[0].getTimestamp()
                    x, y = makeFlashPlotArrays(flash,
                                               seconfig,
                                               color=colorlist[isubevent % 6])
                    opdata.userwindows.makeWindow(
                        y,
                        x + beamchoffset,
                        5,
                        flash.ch,
                        default_color=colorlist[isubevent % 6],
                        highlighted_color=colorlist[isubevent % 6])
                    if subevent in [boundary_subevent]:
                        x = np.linspace(
                            seconfig.nspersample * flash.tstart,
                            seconfig.nspersample *
                            (flash.tstart + len(flash.waveform)),
                            len(flash.waveform))
                        y = flash.waveform
                        opdata.userwindows.makeWindow(
                            y,
                            x,
                            5,
                            flash.ch,
                            default_color=colorlist[isubevent % 6],
                            highlighted_color=colorlist[isubevent % 6])
                        if flash.ch in opdata.suppressed_wfm:
                            beamchoffset2 = opdata.getBeamWindows(
                                hgslot, flash.ch)[0].getTimestamp()
                            x = np.linspace(
                                0,
                                len(opdata.suppressed_wfm[flash.ch]) *
                                seconfig.nspersample,
                                len(opdata.suppressed_wfm[
                                    flash.ch])) + beamchoffset2
                            y = opdata.suppressed_wfm[flash.ch]
                            opdata.userwindows.makeWindow(y, x, 5, flash.ch)

                for flash in subevent.getFlash2List():
                    beamchoffset = opdata.getBeamWindows(
                        hgslot, flash.ch)[0].getTimestamp()
                    x, y = makeFlashPlotArrays(flash,
                                               seconfig,
                                               color=colorlist[isubevent % 6])
                    opdata.userwindows.makeWindow(
                        y,
                        x + beamchoffset,
                        5,
                        flash.ch,
                        default_color=colorlist[isubevent % 6],
                        highlighted_color=colorlist[isubevent % 6])

            for flash in unclaimed_flashes.getFlashes():
                beamchoffset = opdata.getBeamWindows(
                    hgslot, flash.ch)[0].getTimestamp()
                x, y = makeFlashPlotArrays(flash, seconfig)
                opdata.userwindows.makeWindow(y,
                                              x + beamchoffset,
                                              5,
                                              flash.ch,
                                              default_color=(0, 255, 0, 255),
                                              highlighted_color=(0, 255, 0,
                                                                 255))

            for ch in range(0, 32):
                plot_baseline = pg.PlotCurveItem()
                beamchoffset = opdata.getBeamWindows(hgslot,
                                                     ch)[0].getTimestamp()
                x = np.linspace(0,
                                len(baselines[:, ch]) * seconfig.nspersample,
                                len(baselines[:, ch])) + beamchoffset
                y = baselines[:, ch]
                #opdata.userwindows.makeWindow( y, x, 5, ch, default_color=(255,128,0,255), highlighted_color=(255,128,0,255) )

                #plot_variance = pg.PlotCurveItem()
                #x = np.linspace( 0, len(variances[:,ch])*seconfig.nspersample, len(variances[:,ch]) )
                #y = variances[:,ch]
                #plot_variance.setData( x=x, y=y, pen=(255,204,153,255) )
                #opdisplay.addUserWaveformItem( plot_variance, ch=ch )

        #if subevents.size>0:
        #opdisplay.plotData()
            opdisplay.gotoEvent(opdata.event)

            #if subevents.size>0:
            raw_input()
        ok = opdata.getNextEntry()