Thank to so much for your response.

I am reading in these histogram from a file of several other different histograms. Then I am trying to calculate all the normalized integrals of these histograms. Then plotting these normalized integral against run number using TGraph and save new histograms to a new file.

From the code below, I have messed up the code some where but not sure where, need some help, please.

i_ntracks = new TGraph();

i_ntracks->SetName(“i_ntracks”);

TCanvas *ac = new TCanvas(“ac”,“ac”,800,600);

while ( runflist >> rootfile )

{

run = getrun(rootfile);

Double_t n_maxbins;

t_file[n_runs] = new TFile(rootfile,“READ”);

htrig[n_runs] = (TH1*)t_file[n_runs]->Get(“htrig”)

Double_t nevents = htrig[n_runs]->GetBinContent(1);

//trying to go over all the run number

for(int inbins = 1; inbins <= n_maxbins;inbins ++)

{

for (int iarm=0; iarm<2; iarm++)

{

for (int iside=0; iside<2; iside++)

{

name = “h_dcalphaboard”; name += iarm; name += iside;

h_dcalphaboard[n_runs][iarm][iside] = (TH2*)t_file[n_runs]->Get(name);

Double_t intgel = h_dcalphaboard[n_runs][iarm][iside] ->Integral()/htrig[nruns]->GetBinContent(1);//finding the normalized number of tracks

}

h_dcalphaboard[n_runs][iarm][iside]->Fill( intgel, n_runs );//fill histogram with intgel and run number

//print intgel and Tgraph

TGraph * f = new TGraph;

TFile *savefile = new TFile(“dcalpha.root”,“RECREATE”);//save to file

}