Exemplo n.º 1
0
def create_tables(xmldoc, rootfiles):

    sim_tree = TChain("waveburst")
    liv_tree = TChain("liveTime")
    for rootfile in rootfiles:
        sim_tree.Add(rootfile)
        liv_tree.Add(rootfile)

    # Define tables
    sngl_burst_table = lsctables.New(lsctables.SnglBurstTable, [
        "peak_time_ns", "start_time_ns", "stop_time_ns", "process_id", "ifo",
        "peak_time", "start_time", "stop_time", "duration", "time_lag",
        "peak_frequency", "search", "flow", "fhigh", "bandwidth", "tfvolume",
        "hrss", "event_id"
    ])
    xmldoc.childNodes[0].appendChild(sngl_burst_table)
    sngl_burst_table.sync_next_id()

    coinc_event_table = lsctables.New(lsctables.CoincTable, [
        "process_id", "coinc_event_id", "nevents", "instruments",
        "time_slide_id", "coinc_def_id"
    ])
    xmldoc.childNodes[0].appendChild(coinc_event_table)
    coinc_event_table.sync_next_id()

    multi_burst_table = lsctables.New(
        lsctables.MultiBurstTable,
        ["process_id", "peak_time", "peak_time_ns", "coinc_event_id"])
    xmldoc.childNodes[0].appendChild(multi_burst_table)

    coinc_event_map_table = lsctables.New(lsctables.CoincMapTable)
    xmldoc.childNodes[0].appendChild(coinc_event_map_table)

    do_process_table(xmldoc, sim_tree, liv_tree)
    process_index = dict((int(row.process_id), row)
                         for row in lsctables.ProcessTable.get_table(xmldoc))

    do_summary_table(xmldoc, sim_tree, liv_tree)

    # create coinc_definer row
    row = get_coinc_def_row(sim_tree)
    coinc_def_id = llwapp.get_coinc_def_id(xmldoc,
                                           row.search,
                                           row.search_coinc_type,
                                           description=row.description)

    for i in range(0, sim_tree.GetEntries()):
        sim_tree.GetEntry(i)

        offset_vector = dict(
            (get_ifos_from_index(instrument_index), offset)
            for instrument_index, offset in zip(sim_tree.ifo, sim_tree.lag))

        coinc_event = coinc_event_table.RowType()
        coinc_event.process_id = process_index[sim_tree.run].process_id
        coinc_event.coinc_event_id = coinc_event_table.get_next_id()
        coinc_event.coinc_def_id = coinc_def_id
        coinc_event.nevents = sim_tree.ndim
        coinc_event.instruments = get_ifos_from_index(
            branch_array_to_list(sim_tree.ifo, sim_tree.ndim))
        coinc_event.time_slide_id = llwapp.get_time_slide_id(
            xmldoc, offset_vector, process_index[sim_tree.run])
        coinc_event_table.append(coinc_event)

        for d in range(0, sim_tree.ndim):
            sngl_burst = get_sngl_burst_row(sngl_burst_table, sim_tree, d)
            sngl_burst.process_id = coinc_event.process_id
            sngl_burst.event_id = sngl_burst_table.get_next_id()
            sngl_burst_table.append(sngl_burst)

            coinc_event_map = coinc_event_map_table.RowType()
            coinc_event_map.event_id = sngl_burst.event_id
            coinc_event_map.table_name = sngl_burst.event_id.table_name
            coinc_event_map.coinc_event_id = coinc_event.coinc_event_id
            coinc_event_map_table.append(coinc_event_map)

        multi_burst = get_multi_burst_row(multi_burst_table, sim_tree)
        multi_burst.process_id = coinc_event.process_id
        multi_burst.coinc_event_id = coinc_event.coinc_event_id
        multi_burst_table.append(multi_burst)
Exemplo n.º 2
0
    def __init__(self, xmldoc, sbdef, process):
        #
        # store the process row
        #

        self.process = process

        #
        # locate the multi_inspiral and sim_inspiral tables
        #

        self.multiinspiraltable = table.get_table(
                                      xmldoc,
                                      lsctables.MultiInspiralTable.tableName)
        self.siminspiraltable = table.get_table(
                                    xmldoc,
                                    lsctables.SimInspiralTable.tableName)

        #
        # get out segment lists for programs that generated
        # triggers (currently only used for time_slide vector
        # construction)
        #

        search_summary = table.get_table(
                             xmldoc, lsctables.SearchSummaryTable.tableName)
        pids = set(self.multiinspiraltable.getColumnByName("process_id"))
        seglists = search_summary.get_out_segmentlistdict(pids)\
                                 .coalesce()

        #
        # construct the zero-lag time slide needed to cover the
        # instruments listed in all the triggers, then determine
        # its ID (or create it if needed)
        #
        # FIXME:  in the future, the sim_inspiral table should
        # indicate time slide at which the injection was done
        #

        self.tisi_id = ligolw_tisi.get_time_slide_id(
                           xmldoc,
                           dict.fromkeys(seglists, 0.0),
                           create_new=process)

        #
        # get coinc_definer row for sim_inspiral <--> multi_inspiral
        # coincs; this creates a coinc_definer table if the
        # document doesn't have one
        #

        self.sb_coinc_def_id = llwapp.get_coinc_def_id(
                                   xmldoc,
                                   sbdef.search,
                                   sbdef.search_coinc_type,
                                   create_new=True,
                                   description=sbdef.description)

        #
        # get coinc table, create one if needed
        #

        try:
            self.coinctable = table.get_table(xmldoc,
                                              lsctables.CoincTable.tableName)
        except ValueError:
            self.coinctable = lsctables.New(lsctables.CoincTable)
            xmldoc.childNodes[0].appendChild(self.coinctable)
        self.coinctable.sync_next_id()

        #
        # get coinc_map table, create one if needed
        #

        try:
            self.coincmaptable = table.get_table(
                                     xmldoc,
                                     lsctables.CoincMapTable.tableName)
        except ValueError:
            self.coincmaptable = lsctables.New(lsctables.CoincMapTable)
            xmldoc.childNodes[0].appendChild(self.coincmaptable)

        #
        # sort multi_inspiral table by end time
        #

        self.multiinspiraltable.sort(lambda a, b:
                                         cmp(a.end_time, b.end_time) or
                                         cmp(a.end_time_ns, b.end_time_ns))
Exemplo n.º 3
0
    def __init__(self, xmldoc, sbdef, process):
        #
        # store the process row
        #

        self.process = process

        #
        # locate the multi_inspiral and sim_inspiral tables
        #

        self.multiinspiraltable = lsctables.MultiInspiralTable.get_table(
            xmldoc)
        self.siminspiraltable = lsctables.SimInspiralTable.get_table(xmldoc)

        #
        # get out segment lists for programs that generated
        # triggers (currently only used for time_slide vector
        # construction)
        #

        search_summary = lsctables.SearchSummaryTable.get_table(xmldoc)
        pids = set(self.multiinspiraltable.getColumnByName("process_id"))
        seglists = search_summary.get_out_segmentlistdict(pids)\
                                 .coalesce()

        #
        # construct the zero-lag time slide needed to cover the
        # instruments listed in all the triggers, then determine
        # its ID (or create it if needed)
        #
        # FIXME:  in the future, the sim_inspiral table should
        # indicate time slide at which the injection was done
        #

        self.tisi_id = ligolw_tisi.get_time_slide_id(xmldoc,
                                                     dict.fromkeys(
                                                         seglists, 0.0),
                                                     create_new=process)

        #
        # get coinc_definer row for sim_inspiral <--> multi_inspiral
        # coincs; this creates a coinc_definer table if the
        # document doesn't have one
        #

        self.sb_coinc_def_id = llwapp.get_coinc_def_id(
            xmldoc,
            sbdef.search,
            sbdef.search_coinc_type,
            create_new=True,
            description=sbdef.description)

        #
        # get coinc table, create one if needed
        #

        try:
            self.coinctable = lsctables.CoincTable.get_table(xmldoc)
        except ValueError:
            self.coinctable = lsctables.New(lsctables.CoincTable)
            xmldoc.childNodes[0].appendChild(self.coinctable)
        self.coinctable.sync_next_id()

        #
        # get coinc_map table, create one if needed
        #

        try:
            self.coincmaptable = lsctables.CoincMapTable.get_table(xmldoc)
        except ValueError:
            self.coincmaptable = lsctables.New(lsctables.CoincMapTable)
            xmldoc.childNodes[0].appendChild(self.coincmaptable)

        #
        # sort multi_inspiral table by end time
        #

        self.multiinspiraltable.sort(lambda a, b: cmp(a.end_time, b.end_time)
                                     or cmp(a.end_time_ns, b.end_time_ns))
Exemplo n.º 4
0
def ligolw_rinca(
	xmldoc,
	process_id,
	EventListType,
	CoincTables,
	coinc_definer_row,
	event_comparefunc,
	thresholds,
	ntuple_comparefunc = lambda events, offset_vector: False,
	small_coincs = False,
	veto_segments = None,
	coinc_end_time_segment = None,
	verbose = False
):
	#
	# prepare the coincidence table interface.
	#

	if verbose:
		print >>sys.stderr, "indexing ..."
	coinc_tables = CoincTables(xmldoc, vetoes = veto_segments)
	coinc_def_id = llwapp.get_coinc_def_id(xmldoc, coinc_definer_row.search, coinc_definer_row.search_coinc_type, create_new = True, description = coinc_definer_row.description)
	sngl_index = dict((row.event_id, row) for row in lsctables.table.get_table(xmldoc, lsctables.SnglRingdownTable.tableName))

	#
	# build the event list accessors, populated with events from those
	# processes that can participate in a coincidence.  apply vetoes by
	# removing events from the lists that fall in vetoed segments
	#

	eventlists = snglcoinc.make_eventlists(xmldoc, EventListType, lsctables.SnglRingdownTable.tableName)
	if veto_segments is not None:
		for eventlist in eventlists.values():
			iterutils.inplace_filter((lambda event: event.ifo not in veto_segments or event.get_start() not in veto_segments[event.ifo]), eventlist)

	#
	# set the \Delta t parameter on all the event lists
	#

	max_dt = ringdown_max_dt(lsctables.table.get_table(xmldoc, lsctables.SnglRingdownTable.tableName), thresholds)
	if verbose:
		print >>sys.stderr, "event bisection search window will be %.16g s" % max_dt
	for eventlist in eventlists.values():
		eventlist.set_dt(max_dt)

	#
	# replicate the ds_sq threshold for every possible instrument
	# pair
	#

	thresholds = replicate_threshold(thresholds, set(eventlists))

	#
	# construct offset vector assembly graph
	#

	time_slide_graph = snglcoinc.TimeSlideGraph(coinc_tables.time_slide_index, verbose = verbose)

	#
	# retrieve all coincidences, apply the final n-tuple compare func
	# and record the survivors
	#

	for node, coinc in time_slide_graph.get_coincs(eventlists, event_comparefunc, thresholds, include_small_coincs = small_coincs, verbose = verbose):
		ntuple = tuple(sngl_index[id] for id in coinc)
		if not ntuple_comparefunc(ntuple, node.offset_vector):
			coinc_tables.append_coinc(process_id, node, coinc_def_id, ntuple)

	#
	# remove time offsets from events
	#

	del eventlists.offsetvector

	#
	# done
	#

	return xmldoc
  def create_tables(self, xmldoc, rootfiles):
    """
    Sets up table structures and calls populating methods.
    """

    if os.path.splitext(rootfiles[0])[1] == ".root":
      sim_tree = TChain("waveburst")
    else: # If the file is (for example) text, use a proxy class
      sim_tree = CWBTextConverter()

    for rootfile in rootfiles:
	  sim_tree.Add(rootfile)

    # Define tables
    sngl_burst_table = lsctables.New(lsctables.SnglBurstTable,
	  ["peak_time_ns", "start_time_ns", "stop_time_ns",
	  "process_id", "ifo", "peak_time", "start_time", "stop_time", 
	  "duration", "time_lag", "peak_frequency", "search",
	  "flow", "fhigh", "bandwidth", "tfvolume", "hrss", "event_id", "snr"])
    xmldoc.childNodes[0].appendChild(sngl_burst_table)
    sngl_burst_table.sync_next_id()
  
    coinc_event_table = lsctables.New(lsctables.CoincTable,
	  [ "process_id", "coinc_event_id", "nevents", "instruments", "time_slide_id",
	  "coinc_def_id", "likelihood"])
    xmldoc.childNodes[0].appendChild(coinc_event_table)
    coinc_event_table.sync_next_id()
  
    # TODO: Reimplement this when the cwb_table module is included
    #if self.cwbtable:
      #cohwb_table = lsctables.New(cwb_table.CoherentWaveburstTable,
	    #["ellipticity", "correlated_energy", "eff_correlated_energy", 
      #"coherent_network_amp", "penalty", "network_correlation", 
      #"energy_disbalance", "ellip_energy_disbalance", "process_id", 
      #"coinc_event_id", "cwb_id"])
      #xmldoc.childNodes[0].appendChild(cohwb_table)
      #cohwb_table.sync_next_id()
  
    multi_burst_table = lsctables.New(lsctables.MultiBurstTable,
	  ["process_id", "peak_time", "peak_time_ns", "coinc_event_id", "snr", "ifos",
    # NOTE: Added to the table definition
    "false_alarm_rate", "ligo_axis_ra", "ligo_axis_dec"])
    xmldoc.childNodes[0].appendChild(multi_burst_table)
  
    coinc_event_map_table = lsctables.New(lsctables.CoincMapTable)
    xmldoc.childNodes[0].appendChild(coinc_event_map_table)
  
    jobsegment = None
    if self.start and self.end :
      jobsegment = segments.segment(LIGOTimeGPS(self.start), LIGOTimeGPS(self.end))
  
    if self.verbose:
      print "Creating Process Table...",
  
    if self.job_list:
      self.do_process_table(xmldoc, sim_tree)
    else :
      self.do_process_table_from_segment(xmldoc, sim_tree, jobsegment)
  
    process_index = dict((int(row.process_id), row) for row in lsctables.ProcessTable.get_table(xmldoc))
  
    if self.verbose:
      print " done."
  
    if self.verbose:
      print "Creating Summary Table...",
    # If we are provided a joblist, use it to generate the list
    if self.job_list :
      self.do_summary_table_from_joblist(xmldoc, sim_tree)
    elif self.job_list == None and self.start and self.end :
      self.do_summary_table_from_segment(xmldoc, jobsegment, sim_tree)
    else :
      self.do_summary_table(xmldoc, sim_tree)
    if self.verbose:
      print " done."
  
    # create coinc_definer row
    row = self.get_coinc_def_row(sim_tree)
    coinc_def_id = llwapp.get_coinc_def_id(xmldoc, row.search, row.search_coinc_type, description = row.description)
  
    entries = sim_tree.GetEntries()
    for i in range(0, entries):
      sim_tree.GetEntry(i)
      if self.start != None :
        if float(self.start) > sim_tree.start[0] : continue
      if self.end != None :
        if float(self.end) < sim_tree.stop[0] : continue
        
  
      offset_vector = dict((get_ifos_from_index(instrument_index), offset) for instrument_index, offset in zip(sim_tree.ifo, sim_tree.lag))
  
      coinc_event = coinc_event_table.RowType()
      coinc_event.process_id = process_index[sim_tree.run].process_id
      coinc_event.coinc_event_id = coinc_event_table.get_next_id()
      coinc_event.coinc_def_id = coinc_def_id
      coinc_event.nevents = sim_tree.ndim
      coinc_event.instruments = lsctables.ifos_from_instrument_set( get_ifos_from_index( branch_array_to_list ( sim_tree.ifo, sim_tree.ndim ) ) )
      coinc_event.time_slide_id = time_slide.get_time_slide_id(xmldoc, offset_vector, process_index[sim_tree.run])
      coinc_event.likelihood = sim_tree.likelihood
      coinc_event_table.append(coinc_event)
  
      for d in range(0, sim_tree.ndim):
        sngl_burst = self.get_sngl_burst_row(sngl_burst_table, sim_tree, d)
        sngl_burst.process_id = coinc_event.process_id
        sngl_burst.event_id = sngl_burst_table.get_next_id()
        sngl_burst_table.append(sngl_burst)
  
        coinc_event_map = coinc_event_map_table.RowType()
        coinc_event_map.event_id = sngl_burst.event_id
        coinc_event_map.table_name = sngl_burst.event_id.table_name
        coinc_event_map.coinc_event_id = coinc_event.coinc_event_id
        coinc_event_map_table.append(coinc_event_map)
  
      # TODO: Reimplement when cwb_table module is included
      #if self.cwbtable:
        #cwb = get_cwb_row(cohwb_table, sim_tree)
        #cwb.process_id = coinc_event.process_id
        #cwb.coinc_event_id = coinc_event.coinc_event_id
        #cwb.cwb_id = cohwb_table.get_next_id()
        #cohwb_table.append(cwb)
  
      multi_burst = self.get_multi_burst_row(multi_burst_table, sim_tree)
      multi_burst.process_id = coinc_event.process_id
      multi_burst.coinc_event_id = coinc_event.coinc_event_id
      # NOTE: Until we have an embedded cwb table definition, this will be
      # copied here so official tools have a ranking statistic to use
      try:
        multi_burst.snr = sim_tree.rho[1]
      except TypeError: # difference in definition between ROOT and text
        multi_burst.snr = sim_tree.rho
      # NOTE: To be filled in later by farburst
      multi_burst.false_alarm_rate = -1.0 
      # Reconstructed right ascension and declination
      multi_burst.ligo_axis_ra = sim_tree.phi[2]
      multi_burst.ligo_axis_dec = sim_tree.theta[2]
      multi_burst.ifos = lsctables.ifos_from_instrument_set( get_ifos_from_index( branch_array_to_list ( sim_tree.ifo, sim_tree.ndim ) ) )
  
      multi_burst_table.append(multi_burst)
Exemplo n.º 6
0
def ligolw_rinca(xmldoc,
                 process_id,
                 EventListType,
                 CoincTables,
                 coinc_definer_row,
                 event_comparefunc,
                 thresholds,
                 ntuple_comparefunc=lambda events, offset_vector: False,
                 small_coincs=False,
                 veto_segments=None,
                 coinc_end_time_segment=None,
                 verbose=False):
    #
    # prepare the coincidence table interface.
    #

    if verbose:
        print >> sys.stderr, "indexing ..."
    coinc_tables = CoincTables(xmldoc, vetoes=veto_segments)
    coinc_def_id = llwapp.get_coinc_def_id(
        xmldoc,
        coinc_definer_row.search,
        coinc_definer_row.search_coinc_type,
        create_new=True,
        description=coinc_definer_row.description)
    sngl_index = dict((row.event_id, row)
                      for row in lsctables.SnglRingdownTable.get_table(xmldoc))

    #
    # build the event list accessors, populated with events from those
    # processes that can participate in a coincidence.  apply vetoes by
    # removing events from the lists that fall in vetoed segments
    #

    eventlists = snglcoinc.EventListDict(
        EventListType, lsctables.SnglRingdownTable.get_table(xmldoc))
    if veto_segments is not None:
        for eventlist in eventlists.values():
            iterutils.inplace_filter(
                (lambda event: event.ifo not in veto_segments or event.
                 get_start() not in veto_segments[event.ifo]), eventlist)

    #
    # set the \Delta t parameter on all the event lists
    #

    max_dt = ringdown_max_dt(lsctables.SnglRingdownTable.get_table(xmldoc),
                             thresholds)
    if verbose:
        print >> sys.stderr, "event bisection search window will be %.16g s" % max_dt
    for eventlist in eventlists.values():
        eventlist.set_dt(max_dt)

    #
    # replicate the ds_sq threshold for every possible instrument
    # pair
    #

    thresholds = replicate_threshold(thresholds, set(eventlists))

    #
    # construct offset vector assembly graph
    #

    time_slide_graph = snglcoinc.TimeSlideGraph(coinc_tables.time_slide_index,
                                                verbose=verbose)

    #
    # retrieve all coincidences, apply the final n-tuple compare func
    # and record the survivors
    #

    for node, coinc in time_slide_graph.get_coincs(eventlists,
                                                   event_comparefunc,
                                                   thresholds,
                                                   verbose=verbose):
        if len(coinc) < 2 or (len(coinc) < len(node.offset_vector)
                              and not small_coincs):
            continue
        ntuple = tuple(sngl_index[id] for id in coinc)
        if not ntuple_comparefunc(ntuple, node.offset_vector):
            coinc_tables.append_coinc(*coinc_tables.coinc_rows(
                process_id, node, coinc_def_id, ntuple))

    #
    # remove time offsets from events
    #

    del eventlists.offsetvector

    #
    # done
    #

    return xmldoc
Exemplo n.º 7
0
def create_tables(xmldoc, rootfiles):

  sim_tree = TChain("waveburst")
  liv_tree = TChain("liveTime")
  for rootfile in rootfiles :
    sim_tree.Add(rootfile)
    liv_tree.Add(rootfile)

  # Define tables
  sngl_burst_table = lsctables.New(lsctables.SnglBurstTable,
	["peak_time_ns", "start_time_ns", "stop_time_ns",
        "process_id", "ifo", "peak_time", "start_time", "stop_time", 
	"duration", "time_lag", "peak_frequency", "search",
	"flow", "fhigh", "bandwidth", "tfvolume", "hrss", "event_id"])
  xmldoc.childNodes[0].appendChild(sngl_burst_table)
  sngl_burst_table.sync_next_id()

  coinc_event_table = lsctables.New(lsctables.CoincTable,
	[ "process_id", "coinc_event_id", "nevents", "instruments", "time_slide_id",
	"coinc_def_id"])
  xmldoc.childNodes[0].appendChild(coinc_event_table)
  coinc_event_table.sync_next_id()

  multi_burst_table = lsctables.New(lsctables.MultiBurstTable,
	["process_id", "peak_time", "peak_time_ns", "coinc_event_id"])
  xmldoc.childNodes[0].appendChild(multi_burst_table)

  coinc_event_map_table = lsctables.New(lsctables.CoincMapTable)
  xmldoc.childNodes[0].appendChild(coinc_event_map_table)

  do_process_table(xmldoc, sim_tree, liv_tree)
  process_index = dict((int(row.process_id), row) for row in lsctables.ProcessTable.get_table(xmldoc))

  do_summary_table(xmldoc, sim_tree, liv_tree)

  # create coinc_definer row
  row = get_coinc_def_row(sim_tree)
  coinc_def_id = llwapp.get_coinc_def_id(xmldoc, row.search, row.search_coinc_type, description = row.description)

  for i in range(0, sim_tree.GetEntries()):
    sim_tree.GetEntry(i)

    offset_vector = dict((get_ifos_from_index(instrument_index), offset) for instrument_index, offset in zip(sim_tree.ifo, sim_tree.lag))

    coinc_event = coinc_event_table.RowType()
    coinc_event.process_id = process_index[sim_tree.run].process_id
    coinc_event.coinc_event_id = coinc_event_table.get_next_id()
    coinc_event.coinc_def_id = coinc_def_id
    coinc_event.nevents = sim_tree.ndim
    coinc_event.instruments = get_ifos_from_index( branch_array_to_list ( sim_tree.ifo, sim_tree.ndim ) )
    coinc_event.time_slide_id = llwapp.get_time_slide_id(xmldoc, offset_vector, process_index[sim_tree.run])
    coinc_event_table.append(coinc_event)

    for d in range(0, sim_tree.ndim):
      sngl_burst = get_sngl_burst_row(sngl_burst_table, sim_tree, d)
      sngl_burst.process_id = coinc_event.process_id
      sngl_burst.event_id = sngl_burst_table.get_next_id()
      sngl_burst_table.append(sngl_burst)

      coinc_event_map = coinc_event_map_table.RowType()
      coinc_event_map.event_id = sngl_burst.event_id
      coinc_event_map.table_name = sngl_burst.event_id.table_name
      coinc_event_map.coinc_event_id = coinc_event.coinc_event_id
      coinc_event_map_table.append(coinc_event_map)

    multi_burst = get_multi_burst_row(multi_burst_table, sim_tree)
    multi_burst.process_id = coinc_event.process_id
    multi_burst.coinc_event_id = coinc_event.coinc_event_id
    multi_burst_table.append(multi_burst)
Exemplo n.º 8
0
    def create_tables(self, xmldoc, rootfiles):
        """
    Sets up table structures and calls populating methods.
    """

        if os.path.splitext(rootfiles[0])[1] == ".root":
            sim_tree = TChain("waveburst")
        else:  # If the file is (for example) text, use a proxy class
            sim_tree = CWBTextConverter()

        for rootfile in rootfiles:
            sim_tree.Add(rootfile)

        # Define tables
        sngl_burst_table = lsctables.New(lsctables.SnglBurstTable, [
            "peak_time_ns", "start_time_ns", "stop_time_ns", "process_id",
            "ifo", "peak_time", "start_time", "stop_time", "duration",
            "time_lag", "peak_frequency", "search", "flow", "fhigh",
            "bandwidth", "tfvolume", "hrss", "event_id", "snr"
        ])
        xmldoc.childNodes[0].appendChild(sngl_burst_table)
        sngl_burst_table.sync_next_id()

        coinc_event_table = lsctables.New(lsctables.CoincTable, [
            "process_id", "coinc_event_id", "nevents", "instruments",
            "time_slide_id", "coinc_def_id", "likelihood"
        ])
        xmldoc.childNodes[0].appendChild(coinc_event_table)
        coinc_event_table.sync_next_id()

        # TODO: Reimplement this when the cwb_table module is included
        #if self.cwbtable:
        #cohwb_table = lsctables.New(cwb_table.CoherentWaveburstTable,
        #["ellipticity", "correlated_energy", "eff_correlated_energy",
        #"coherent_network_amp", "penalty", "network_correlation",
        #"energy_disbalance", "ellip_energy_disbalance", "process_id",
        #"coinc_event_id", "cwb_id"])
        #xmldoc.childNodes[0].appendChild(cohwb_table)
        #cohwb_table.sync_next_id()

        multi_burst_table = lsctables.New(
            lsctables.MultiBurstTable,
            [
                "process_id",
                "peak_time",
                "peak_time_ns",
                "coinc_event_id",
                "snr",
                "ifos",
                # NOTE: Added to the table definition
                "false_alarm_rate",
                "ligo_axis_ra",
                "ligo_axis_dec"
            ])
        xmldoc.childNodes[0].appendChild(multi_burst_table)

        coinc_event_map_table = lsctables.New(lsctables.CoincMapTable)
        xmldoc.childNodes[0].appendChild(coinc_event_map_table)

        jobsegment = None
        if self.start and self.end:
            jobsegment = segments.segment(LIGOTimeGPS(self.start),
                                          LIGOTimeGPS(self.end))

        if self.verbose:
            print "Creating Process Table...",

        if self.job_list:
            self.do_process_table(xmldoc, sim_tree)
        else:
            self.do_process_table_from_segment(xmldoc, sim_tree, jobsegment)

        process_index = dict(
            (int(row.process_id), row)
            for row in lsctables.ProcessTable.get_table(xmldoc))

        if self.verbose:
            print " done."

        if self.verbose:
            print "Creating Summary Table...",
        # If we are provided a joblist, use it to generate the list
        if self.job_list:
            self.do_summary_table_from_joblist(xmldoc, sim_tree)
        elif self.job_list == None and self.start and self.end:
            self.do_summary_table_from_segment(xmldoc, jobsegment, sim_tree)
        else:
            self.do_summary_table(xmldoc, sim_tree)
        if self.verbose:
            print " done."

        # create coinc_definer row
        row = self.get_coinc_def_row(sim_tree)
        coinc_def_id = llwapp.get_coinc_def_id(xmldoc,
                                               row.search,
                                               row.search_coinc_type,
                                               description=row.description)

        entries = sim_tree.GetEntries()
        for i in range(0, entries):
            sim_tree.GetEntry(i)
            if self.start != None:
                if float(self.start) > sim_tree.start[0]: continue
            if self.end != None:
                if float(self.end) < sim_tree.stop[0]: continue

            offset_vector = dict(
                (get_ifos_from_index(instrument_index), offset)
                for instrument_index, offset in zip(sim_tree.ifo,
                                                    sim_tree.lag))

            coinc_event = coinc_event_table.RowType()
            coinc_event.process_id = process_index[sim_tree.run].process_id
            coinc_event.coinc_event_id = coinc_event_table.get_next_id()
            coinc_event.coinc_def_id = coinc_def_id
            coinc_event.nevents = sim_tree.ndim
            coinc_event.instruments = lsctables.ifos_from_instrument_set(
                get_ifos_from_index(
                    branch_array_to_list(sim_tree.ifo, sim_tree.ndim)))
            coinc_event.time_slide_id = time_slide.get_time_slide_id(
                xmldoc, offset_vector, process_index[sim_tree.run])
            coinc_event.likelihood = sim_tree.likelihood
            coinc_event_table.append(coinc_event)

            for d in range(0, sim_tree.ndim):
                sngl_burst = self.get_sngl_burst_row(sngl_burst_table,
                                                     sim_tree, d)
                sngl_burst.process_id = coinc_event.process_id
                sngl_burst.event_id = sngl_burst_table.get_next_id()
                sngl_burst_table.append(sngl_burst)

                coinc_event_map = coinc_event_map_table.RowType()
                coinc_event_map.event_id = sngl_burst.event_id
                coinc_event_map.table_name = sngl_burst.event_id.table_name
                coinc_event_map.coinc_event_id = coinc_event.coinc_event_id
                coinc_event_map_table.append(coinc_event_map)

            # TODO: Reimplement when cwb_table module is included
            #if self.cwbtable:
            #cwb = get_cwb_row(cohwb_table, sim_tree)
            #cwb.process_id = coinc_event.process_id
            #cwb.coinc_event_id = coinc_event.coinc_event_id
            #cwb.cwb_id = cohwb_table.get_next_id()
            #cohwb_table.append(cwb)

            multi_burst = self.get_multi_burst_row(multi_burst_table, sim_tree)
            multi_burst.process_id = coinc_event.process_id
            multi_burst.coinc_event_id = coinc_event.coinc_event_id
            # NOTE: Until we have an embedded cwb table definition, this will be
            # copied here so official tools have a ranking statistic to use
            try:
                multi_burst.snr = sim_tree.rho[1]
            except TypeError:  # difference in definition between ROOT and text
                multi_burst.snr = sim_tree.rho
            # NOTE: To be filled in later by farburst
            multi_burst.false_alarm_rate = -1.0
            # Reconstructed right ascension and declination
            multi_burst.ligo_axis_ra = sim_tree.phi[2]
            multi_burst.ligo_axis_dec = sim_tree.theta[2]
            multi_burst.ifos = lsctables.ifos_from_instrument_set(
                get_ifos_from_index(
                    branch_array_to_list(sim_tree.ifo, sim_tree.ndim)))

            multi_burst_table.append(multi_burst)