@@ -0,0 +1,1861 @@
+# Tai Sakuma %3Ctai.sakuma@cern.ch%3E%0A%0A##____________________________________________________________________________%7C%7C%0Aclass GenericKeyComposerB(object):%0A    def __init__(self, varNames, binnings, indices = None):%0A        self._varNames = varNames%0A        self._binnings = binnings%0A        self._indices = indices if indices is not None else %5BNone%5D*len(self._varNames)%0A        self._first = True%0A%0A    def __call__(self, event):%0A        if self._first:%0A            self._findArrays(event)%0A            self._first = False%0A%0A        ret = %5B %5D%0A        for branche, binning, index in self._zip:%0A            if index is not None:%0A                if len(branche) %3C= index: return None%0A                var = branche%5Bindex%5D%0A            else:%0A                var = branche%5B0%5D%0A            var_bin = binning(var)%0A            if var_bin is None: return None%0A            ret.append(var_bin)%0A        return tuple(ret)%0A%0A    def next(self, key):%0A        ret = %5B %5D%0A        for i in range(len(self._binnings)):%0A            keyc = list(key)%0A            keyc%5Bi%5D = self._binnings%5Bi%5D.next(keyc%5Bi%5D)%0A            ret.append(tuple(keyc))%0A        return tuple(ret)%0A%0A    def binnings(self):%0A        return self._binnings%0A%0A    def _findArrays(self, event):%0A        self._branches = %5Bgetattr(event, n) for n in self._varNames%5D%0A        self._zip = zip(self._branches, self._binnings, self._indices)%0A%0A##____________________________________________________________________________%7C%7C%0Aclass GenericKeyComposerBBuilder(object):%0A    def __init__(self, varNames, binnings, indices = None):%0A        self.varNames = varNames%0A        self.binnings = binnings%0A        self.indices = indices%0A    def __call__(self):%0A        return GenericKeyComposerB(varNames = self.varNames, binnings = self.binnings, indices = self.indices)%0A%0A##____________________________________________________________________________%7C%7C%0A

add a new class GenericKeyComposerB