Problem fitting a histogram with an array of input values

Greetings all,

Sorry to have to ask for help again.

I am trying to fit a function of the form IMPORTANT EDIT - F[i]=X0[i]+G2X2[i]+G4X4[i] IMPORTANT EDIT (please note that original form of equation had a typo “G4+X2[i]” instead of “G4*X4[i]”) where I have values for the arrays F, X0, X2 and X4 and I want to perform fits to determine the best values for G2 and G4 (which should be constants with an uncertainty). I also have values for the error on F.

Physically reasonable values for G2 and G4 are in the range 0 to 1.

I have attached:

  • a small ROOT file with a canvas that contains one set of normalised experimental data;
  • a short text file that contains 20 sets of values for theta, det_no, X0, X2 and X4 (with the angle phi = (det_no-1)*45); and
  • a short C script that shows one of ways I have tried to make the fit work.

The attached script runs but generates screen after screen of the following error:
“Error: Cint::G__CallFunc::SetArgArray() must be initialized with ‘Cint::G__CallFunc::SetFunc(G__ClassInfo* cls,char* fname,char* args,long* poffset)’ first” and crashes after ten minutes or so.

Any guidance you can give on what I am doing wrong would be greatly appreciated.

EDIT my root details are as follows

ROOT 5.18/00b (branches/v5-18-00-patches@22563, Mar 20 2009, 00:45:00 on linuxx8664gcc)

CINT/ROOT C/C++ Interpreter version 5.16.29, Jan 08, 2008
test.C (1.9 KB)
Ru960309.txt (1.02 KB)
Ru960309_PhiCanvas.root (16.1 KB)

Hi,

the way you are doing is not right. Your script contains various C++ errors and then you are fitting the histogram with the theta distribution.
If I have understood well you want to fit just the values F versus the dependent variables X0, X2 and X4, right ?
I just need the test file with the values, X0, X2, X4, F and error and then I can send you a simple script, but it will work only with a ROOT version > 5.22. With an older version is of corse possible, but it is more complicated. Can you upgrade version of ROOT ?

Lorenzo

Dear Lorenzo

Thank you very much for our offer of help.

Sorry for the C++ errors - typos are the bane of my existence

Each theta case is examined independently with 5 data points representing 5 phi/detector number values.

Each theta case has an array of 5 values of X0,X2 and X4 (one for each phi/detector number). These values are supplied (in the text file attached t the original post) and I am trying to determine the values for G2 and G4.

EDIT: - The relevant files are attached to the original post - the X0, X2 and X4 values are in the file Ru960309.txt and the F values (theta values by angle) and the error are included in Ru960309_PhiCanvas.root.

Any pointers you can give or examples of how to get around my problem will be gratefully appreciated. I have access to ROOT version 5.22 and 5.23.

I am lost here so any guidance will really help.

Hi,

I have not understood if you want to determine the value of G2 and G4 each theta case (i.e. an independent fit for each theta) or you have common values of G2 and G4 for all theta (you need to make a global fit).

Otherwise, it would be easier if you send me a an ASCII file (or a TTree) with all the (X0,X2,X4,F, Error_F). If not I can retrieve them from the histogram assuming that these are consistent with the ASCII file.

Best Regards

Lorenzo

Dear Lorenzo,

I have discovered that the calculation that I need to perform is a more complicated than I had originally supposed.

I am aiming for G2 and G4 values that are consistent across all values of theta, but the X0, X2 and X4 values are actually dependent upon the values of G2 and G4.

The X0, X2 and X4 values in my ASCII text files are reasonable starting values, but every set has to be renormalised for any given value of G2 and G4.

Thank you again for your offer of help - but it is not worth your time to try to produce a solution for the problem that I originally was trying to solve - it is the wrong problem.

I will plug away for myself to better understand my problem and if I get stuck again I will ask further questions.

Regards