Hello Colleagues,
One weak-old Root user here. I’ve a written macro that does a fit to a histogram of the exponential decay of the dose (or intensity) of a photon beam traversing a water target in the presence of a magnetic field. The fit at 0 teslas gives me the parameters of the exponential (offset, amplitude and decay constant). The dose at higher magnetic field strengths will be a fraction of the dose at 0 teslas and I then use my parameters of the 0 tesla fit in the fits of the remaining histograms to obtain that fraction.
I have 2 questions, the first general and the second related to the above problem:
-
The main macro is called ‘dedao.C.’ Within it there is another macro called ‘dedo.C’. I notice that in order to get ‘dedao.C’ to work, I have to first run ‘dedo.C’ so that the order of my commands at the prompt is:
root[0] L. dedao.C
root[1] dedo();
root[2] dedao();
Otherwise I get the error message “Unknown function: dedo.” This seems odd to me, since there is no objection to the function within my macro. Can someone kindly explain?
- How can I improve my code? Ideally, I should be able to pass the parameters I have obtained from my 0 tesla fit into a new function or macro which I can then use to fit the remaining histograms. The only way I can think of how to do this is to write the parameters of the 0 tesla fit to a file which I can then open inside the new macro/function, which seems like a clunky work around. Is there a better way?
I have attached my workman-like code. It’s functional, so it’s really just in the interest of learning that I am reaching out for help.
Regards,
Ltest1.zip (146.7 KB)