def constructTotalCounts(self, logger):
        '''
        This function constructs the total count for each valid character in the array and stores it under '<DIR>/totalCounts.p'
        since these values are independent of compression
        '''
        self.letterBits = 3
        self.numberBits = 8-self.letterBits
        self.numPower = 2**self.numberBits
        self.mask = 255 >> self.numberBits
        
        abtFN = self.dirName+'/totalCounts.p'
        if os.path.exists(abtFN):
            fp = open(abtFN, 'r')
            self.totalCounts = pickle.load(fp)
            fp.close()
        else:
            if logger != None:
                logger.info('First time calculation of \'%s\'' % abtFN)
            
            self.totalCounts = [0]*self.vcLen
            
            binSize = 2**15
            end = 0
            
            while end < self.bwt.shape[0]:
                start = end
                end = end + binSize
                if end > self.bwt.shape[0]:
                    end = self.bwt.shape[0]
                
                #find a clean break in the characters
                while end < self.bwt.shape[0] and ((self.bwt[end] & self.mask) == (self.bwt[end-1] & self.mask)):
                    end += 1
                
                letters = np.bitwise_and(self.bwt[start:end], self.mask)
                counts = np.right_shift(self.bwt[start:end], self.letterBits, dtype='<u8')
                powers = np.zeros(dtype='<u8', shape=(end-start,))
                
                #solve the actual powers
                i = 1
                same = (letters[0:-1] == letters[1:])
                while np.sum(same) > 0:
                    (powers[i:])[same] += 1
                    i += 1
                    same = np.bitwise_and(same[0:-1], same[1:])
                
                #each letter has a variable 'weight' which is the runlength of that region
                self.totalCounts += np.bincount(letters, np.multiply(counts, self.numPower**powers), minlength=self.vcLen)
                
            fp = open(abtFN, 'w+')
            pickle.dump(self.totalCounts, fp)
            fp.close()
        
        self.totalSize = int(np.sum(self.totalCounts))
This function constructs the total count for each valid character in the array and stores it under '<DIR>/totalCounts.p'
        since these values are independent of compression