def unpack(event, data, n=0):
    """ Fills the event dictionary with selected events.

    Args:

	**event** (dict): Event dictionary to be filled

	**data** (dict): Data dictionary used to fill the event dictionary

    """
    keys = event.keys()
    for key in keys:
        if key in data['list_of_counters'] or key in data['_SINGLETON_']:
            event[key] = data[key][n]
        elif 'INDEX' not in key:
            indexkey = data['datasets_and_indices'][key]
            numkey = data['datasets_and_counters'][key]
            if len(data[indexkey]) > 0:
                index = data[indexkey][n]
            if len(data[numkey]) > 0:
                nobjs = data[numkey][n]
                event[key] = data[key][index:index + nobjs]
