def extract_sn_all(snall, snallrow, geomap):
    """
    Extract snall tree out of file
    
    SNDAQ/ROOT querk: 
    ROOT does not understand the SNDAQ ROOT files. The CINT dicts that are needed
    are not written into the file. SNDAQ creates normal ROOT trees, branches, leaves,
    but does not write the structure of these into the file. Hence ROOT will not understand
    them without the proper definitions. You have to tell ROOT what the structure is supposed
    and where in memory to address it. 
    Thanks to Lutz for the inspiration.
    
    :param snall: Pointer to scaler data object (snall) in ROOT file
    :param snallrow: Pointer to HDF5 row object that referes to a row in the table 
                      we are writing to
    :param geomap: Dictionary that maps the location in the ROOT file's array to a DOM
    """

    # Allocating memory
    snallstreaming = ROOT.streaming_t()
    snallvar = ROOT.all_t()

    # Setting pointers in to right memory locations
    snall.SetMakeClass(1)
    set_branches(snall, snallstreaming, 
                 ["base_time", "gps_time_high", "gps_time_low"])
    set_branches(snall, snallvar, 
                 ["no_channels", "data"])
    
    # General description for the loops:
    # Since we dont know the structure of the file, ROOT does not allow us to loop 
    # through the records directly. We have to tell it which record to look at by 
    # number. Not sure how this works internally, lets just say the desired result 
    # is achieved.
    for i in range(snall.GetEntries()):
        # Getting data by index
        snall.GetEntry(i)

        # Getting correct time
        time = get_daq_time_as_long(snallstreaming.gps_time_high, 
                                    snallstreaming.gps_time_low)

        # The detector has 5160 DOMs. The maximum size of the data array is therefore 5160
        data = np.array([snallvar.data[j] for j in range(5160)])
        
        # Correcting for the geometry of the detector
        data = geo_map_data(data, geomap)
        
        # Putting things into the row
        snallrow["gps_time"] = time
        snallrow["counts"] = data
        snallrow.append()
    def extract_sn_cand(self, sncand, sncandrow):
        """
        Extract sncand tree from file
    
        SNDAQ/ROOT querk: 
        ROOT does not understand the SNDAQ ROOT files. The CINT dicts that are needed
        are not written into the file. SNDAQ creates normal ROOT trees, branches, leaves,
        but does not write the structure of these into the file. Hence ROOT will not understand
        them without the proper definitions. You have to tell ROOT what the structure is supposed
        and where in memory to address it. 
        Thanks to Lutz for the inspiration.
    
        :param sncand: Pointer to supernova candidate object (sncand) in ROOT file
        :param snroutrow: Pointer to HDF5 row object that referes to a row in the table 
                          we are writing to
        """

        # Allocating memory
        sncandstreaming = ROOT.streaming_t()
        sncandroutvar = ROOT.rout_t()
        sncandvar = ROOT.cand_t()

        # Setting pointers in to right memory locations
        sncand.SetMakeClass(1)
        set_branches(sncand, sncandstreaming,
                     ["base_time", "gps_time_high", "gps_time_low"])
        set_branches(sncand, sncandroutvar,
                     ["NMAvBins", "NRebins", "Signal", "SignalError",
                      "Chi2", "ActiveChannels", "RebinIndex",
                      "NNewActOMs", "NewActOMs", "NNewInactOMs", "NewInactOMs"])
        set_branches(sncand, sncandvar,
                     ["NCandidate", "NChannels", "NEvent", "ChannelRate",
                      "ChannelMean", "ChannelSigmaSquare", "ChannelWeighedDev"])

        # General description for the loops:
        # Since we dont know the structure of the file, ROOT does not allow us to loop 
        # through the records directly. We have to tell it which record to look at by 
        # number. Not sure how this works internally, lets just say the desired result happens.
        for i in range(sncand.GetEntries()):
            # Getting data by index
            sncand.GetEntry(i)

            time = get_daq_time_as_long(sncandstreaming.gps_time_high, 
                                        sncandstreaming.gps_time_low)

            sncandrow["gps_time"] = time
            # Correction to get the right bin size. Note from GK
            sncandrow["base_time"] = sncandroutvar.NRebins * 500 
            sncandrow["NMAvBins"] = sncandroutvar.NMAvBins
            sncandrow["NRebins"] = sncandroutvar.NRebins
            sncandrow["Signal"] = sncandroutvar.Signal
            sncandrow["SignalError"] = sncandroutvar.SignalError
            sncandrow["Chi2"] = sncandroutvar.Chi2
            sncandrow["ActiveChannels"] = sncandroutvar.ActiveChannels
            sncandrow["RebinIndex"] = sncandroutvar.RebinIndex
            sncandrow["NCandidate"] = sncandvar.NCandidate
            sncandrow["NChannels"] = sncandvar.NChannels
            sncandrow["NEvent"] = sncandvar.NEvent
            # The detector has 5160 DOMs. The maximum size of the data array is therefore 5160
            sncandrow["ChannelRate"] = np.array([sncandvar.ChannelRate[j] for j in range(5160)])
            sncandrow["ChannelMean"] = np.array([sncandvar.ChannelMean[j] for j in range(5160)])
            sncandrow["ChannelSigmaSquare"] = np.array([sncandvar.ChannelSigmaSquare[j] for j in range(5160)])
            sncandrow["ChannelWeighedDev"] = np.array([sncandvar.ChannelWeighedDev[j] for j in range(5160)])
        
            ##########################################################
            # Stuff that doesn't work at the moment
            # Prototype code
            # This attempts to get the number of new active DOMs 
            # out of the file. The problem is again variable
            # length arrays. One can not save a variable length
            # array to an HDF5 file without some contortions. 
            # We don't need the information right now, so ignore it.
            # We still need to tell ROOT that the data is there
            # else we will reading in the wrong data
            ##########################################################

            # sncandrow["NNewActOMs"] = sncandroutvar.NNewActOMs
            # newDOMs = np.array([sncandroutvar.NewActOMs[j] for j in range(sncandroutvar.NNewActOMs)])
            # for j in range(len(newDOMs)): NewActOMs[j] = newDOMs[j]
            # sncandrow["NewActOMs"] = NewActOMs
        
            # sncandrow["NNewInactOMs"] = sncandroutvar.NNewInactOMs
            # removedDOMs = np.array([sncandroutvar.NewInactOMs[j] for j in range(sncandroutvar.NNewInactOMs)])
            # for j in range(len(removedDOMs)): NewInactOMs[j] = removedDOMs[j]
            # sncandrow["NewInactOMs"] = NewInactOMs
        
            sncandrow.append()