#!/usr/bin/env python
# -*- coding: utf-8 -*-
import seutils
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('rootfile', type=str, help='Rootfile to be drawn from')
parser.add_argument('-t', '--tree', type=str, help='Name of the tree to count', default='auto')
parser.add_argument('-v', '--verbose', action='store_true', help='Increases verbosity')
args = parser.parse_args()

def main():
    if args.verbose: seutils.debug()
    for treepath, counts, branches in seutils.root.trees_and_counts(args.rootfile, branches=True):
        print(
            '\033[31mTTree {0} ({1} entries)\033[0m'
            .format(treepath, counts)
            )
        for b in branches:
            print('   ', b)

if __name__ == '__main__':
    main()