Issue regarding Making Accumulated Plots

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided

Sorry if my question is stupid. But understand that I am new to CERN-ROOT.
I am working with the latest version of root. Using a python code (attached in the end) I have converted CSV format files into ROOT files. I can also individually plot them.
But I want an accumulated plot of all the files (approximately 100). Can anyone help me with this?

Python Code:

import sys, os, re
from ROOT import *

format is


def do(ifname,ofname):

g = {}
g[0] = TGraph(0)
g[1] = TGraph(0)
g[2] = TGraph(0)
g[3] = TGraph(0)

sw = 0
for line in open(ifname).readlines():
    m = str(line).replace('\n','')

    if (sw == 1) and (len(m) > 5):
        s = m.replace(',',' ')
        ss = s.split()
        if(len(ss)<2): continue

        tm = float(ss[0])
        v  = map(float,ss[1:])
        for i in range(len(ss)-1):
            g[i].SetPoint( g[i].GetN(), tm, v[i] )
        sw = 1

ofile = TFile(ofname,"RECREATE")
for i in range(4):
    if g[i].GetN() > 0:


if name == ‘main’:
if len(sys.argv) < 3:
print "Usage : “,sys.argv[0],” "

ifname = str( sys.argv[1] )
ofname = str( sys.argv[2] )


Use THStack or add the histograms.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.