# ====================================
# PROCESS DATA WITH ROOT
# ====================================
# switch off printing the canvas for the save mode
if args.save:
    gROOT.SetBatch(1)

# start class instance
do_histo = False
if not do_histo:
    z = RootGraphs(x, run_mode, args.number)
    z.init_loop()
else:
    z = RootGraphs(x, run_mode, args.number)
    test = Analysis(x, run_mode, args.number)
    test.main_loop()


# ====================================
# UPDATE LOOP
# ====================================
if loop_mode:
    signal.signal(signal.SIGINT, signal_handler)
    print "\nStarting loop-mode!"
    while True:
        print "\rlast update:", strftime("%H:%M:%S", localtime()),
        sys.stdout.flush()
        x.update_data()
        z.refresh_graphs()
        z.make_margins()
        z.main_loop()