Hello All,
I have several TH2 histograms and I want to get values for x and y axis then use these values to plot new TH1.
I have tried:
for (int isect=0; isect<NSECTORS;isect++)
{
name = "h_ntrig"; name += isect;
h_ntrig[NSECTORS] = new TH1F(name,name,1000,0,0.001);
for(int iy = 0; iy<=h2_ntrig[isect]->GetNbinsX(); iy ++)
{
for(int iz = 0; iz<=h2_ntrig[isect]->GetNbinsY();iz++)
{
Double_t ntrig = h2_ntrig[isect]->GetBinContent(iz+1,iy+1);
cout << "NSECTORS = " <<"\t" << isect << "\t" << "iy = "<< "\t"
<< iy << "\t" << "iz = " << "\t" << iz << endl;
}
}
}
Results is not correct because the same values print for each x and y of different sectors. Kindly help.
Thank you.