# no entries, just write empty histograms to file
  if tree is None or tree.get_entries() == 0:
    print("\tNo entries in ntuple, writing empty histograms and finishing.")
    for histName, st3 in boundaries.iteritems():
      h = Hist(st3[2], st3[0], st3[1], name=histName)
      h.write()
  else:
    differences = []
    #c = ROOT.TCanvas("canvas", "canvas", 500, 500)
    for subercuts in combinations(supercuts, len(supercuts)-1):
      # hold the differences and create a text file with them later for reference
      # use integers to denote them
      differences.append([x for x in supercuts if x not in subercuts][0])

      # get the selection we apply to draw it
      selection = optimize.cuts_to_selection(subercuts)
      # get the branch we need to draw
      selection_string = differences[-1]['selections']

      print("\tLooking at selection: {0}".format(selection_string))
      branchesSpecified = set(optimize.selection_to_branches(selection_string, tree))
      # get actual list of branches in the file
      availableBranches = optimize.tree_get_branches(tree, args.eventWeightBranch)
      # remove anything that doesn't exist
      branchesToUse = [branch for branch in branchesSpecified if branch in availableBranches]

      # more than one branch, we skip and move to the next
      if len(branchesToUse) == 0:
        print("\t\tWarning: selection has no branches.")
        del differences[-1]
        continue
    branchesSpecified = list(set(itertools.chain.from_iterable(selection_to_branches(supercut['selections'], tree) for supercut in supercuts)))
    eventWeightBranchesSpecified = list(set(selection_to_branches(eventWeightBranch, tree)))

    # get actual list of branches in the file
    availableBranches = tree_get_branches(tree, eventWeightBranchesSpecified)

    # remove anything that doesn't exist
    branchesToUse = [branch for branch in branchesSpecified if branch in availableBranches]
    branchesSkipped = list(set(branchesSpecified) - set(branchesToUse))
    if branchesSkipped:
        logger.info("The following branches have been skipped...")
    for branch in branchesSkipped:
        logger.info("\t{0:s}".format(branch))
    tree = rnp.tree2array(tree, branches=eventWeightBranchesSpecified+branchesToUse)

    entireSelection = '{0:s}*{1:s}'.format(eventWeightBranch, cuts_to_selection(supercuts))

    result = ne.evaluate(entireSelection, local_dict = tree)

    for event_number in result[np.where(result!=0)]:
        eventNumbers[event_number].append(region)
    #    print "\t", event_number

overlapsByColumn = [0]*len(regions)

atLeastOneOverlap = 0

print "{0:s}\t\t{1:s}\t| {2:s}".format("Event #", "\t".join(map(lambda x: os.path.basename(x).split('.')[0], regions)), "# Overlaps")
print "-"*80
for event_number, in_regions in eventNumbers.iteritems():
    overlaps = [bool(region in in_regions) for region in regions]
    # remove anything that doesn't exist
    branchesToUse = [
        branch for branch in branchesSpecified if branch in availableBranches
    ]
    branchesSkipped = list(set(branchesSpecified) - set(branchesToUse))
    if branchesSkipped:
        logger.info("The following branches have been skipped...")
    for branch in branchesSkipped:
        logger.info("\t{0:s}".format(branch))
    tree = rnp.tree2array(tree,
                          branches=eventWeightBranchesSpecified +
                          branchesToUse)

    entireSelection = '{0:s}*{1:s}'.format(eventWeightBranch,
                                           cuts_to_selection(supercuts))

    result = ne.evaluate(entireSelection, local_dict=tree)

    for event_number in result[np.where(result != 0)]:
        eventNumbers[event_number].append(region)
    #    print "\t", event_number

overlapsByColumn = [0] * len(regions)

atLeastOneOverlap = 0

print("{0:s}\t\t{1:s}\t| {2:s}".format(
    "Event #", "\t".join([os.path.basename(x).split('.')[0] for x in regions]),
    "# Overlaps"))
print("-" * 80)