Problem makking a TGraphErrors


The code below is intensed to read in data from an ascii file and make a TGraphErrors.

[code]#include “Riostream.h"
void lambda_fwhm() {
// based on $ROOTSYS/tutorials/tree/basic.dat
ifstream in;”…/data/lambda-fwhm-dat.txt");

TString run;
const Float_t centre, cse, width, wse, composition, cmpse;
Int_t nlines = 0;

while (1) {
in >> run >> centre >> cse >> width >> wse >> composition;
if (!in.good()) break;
if (nlines < 5) printf(“run=%s, centre=%8f, cse=%8f, width=%8f, wse=%8f, comp=%8f\n”, run.Data(), centre, cse, width, wse, composition);
printf(" found %d points\n",nlines);
for (Int_t i = 0; i < nlines; i++ ) cmpse[i] = 0.0; // Dont’t have errors on composition

TGraphErrors *g1 = new TGraphErrors(nlines,composition,centre,cmpse,cse);


The output is:

root [3] .x lambda-fwhm.C
run=88001, centre=602.409973, cse=2.610000, width=77.000000, wse=3.300000, comp=15.060000
run=88020, centre=599.979980, cse=0.770000, width=78.680000, wse=0.770000, comp=35.099998
run=89029, centre=599.799988, cse=0.300000, width=79.000000, wse=0.200000, comp=68.599998
run=89030, centre=601.169373, cse=0.331000, width=77.634186, wse=0.396172, comp=376.200012
run=89030, centre=600.599976, cse=0.300000, width=78.199997, wse=0.300000, comp=376.200012
found 72 points
Warning: Re-initialization ignored const cmpse lambda-fwhm.C:14:
(const double)0.00000000000000000e+00
*** Interpreter error recovered ***

Can someone point out what I’m doing wrong?


I see the problem, sorry for the noise