Dear roottalkers ! I need to output an ascii file from a histogram. I've written this little macro m60co2a4_geap.C : { gROOT->Reset(); TFile f("m60co2a4_geap.root"); /* root file obtained by h2root from hbook*/ FILE *f1; int i, nc = 4096; /* known numbers and limits of channels */ float hsup = 3000; f1 = fopen ("m60co2a4_geap.tsv", "w"); /* tab separated values */ if (!f1) puts ("? output file"); else { for (i=1; i<=nc; i++) fprintf (f1, "%f\t%f\n", (i-.5)*hsup/nc, h21->GetBinContent(i)); fclose (f1); } } h21 is the 4096 channels histogram to output, I supposed that the channels 0 and 4097 are for under and overflows (isn't it ?). The first time I run this macro I get fprintf parameter mismatch param[0] E C FILE:/home/jpl/geant/geap/current/result/spectra/m60co2a4_geap_calc.C LINE:13 The second time 4096 times : Error: fprintf parameter mismatch param[0] E C FILE:/home/jpl/geant/geap/current/result/spectra/m60co2a4_geap_calc.C LINE:13 And the third, the expected file, but after a long time. Is it a simpler way to do this ? (I use Linux 2.0.33 on a pentium 100) Best Regards -- - Jean-Pascal Laedermann mathematicien, ing. physicien EPFL Institut de Radiophysique Appliquee Cité Universitaire CH-1015 Lausanne Switzerland phone: +41 21 693 3665 email: jean-pascal.laedermann@inst.hospvd.ch
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:37 MET