Hello, I am using TH1 as the base and the plot the line using TGraph.
Since I used TGraph to draw the line, I cannot use h-> GetSum() like this.
Is there any way to extract the data point and get the sum value automatically?
I enclose the portion of the code
double Norm = 23.14;
ifstream infile(“lead.data”);
for (int i=0; i<455; i++){
infile >> E1box1 >> E2box1 >> Ybox1 >> EYbox1;
EnergyBox1[i] = (E2box1+E1box1)/2;
eEnergyBox1[i] = 0;
FluenceBox1[i] = NormYbox1*(E2box1-E1box1)/(log(E2box1)-log(E1box1));
eFluenceBox1[i] = Norm0.01EYbox1Ybox1(E2box1-E1box1);
eFluenceBox1[i] << endl;
sum+=FluenceBox1[i];
}
infile.close();
TGraph* lead = new TGraph(455,EnergyBox1,FluenceBox1);
lead->Draw(“PLZ”);