Thank you for your message and your code runs in my ROOT system. I don’t know why the your previous code does not run in my ROOT package.
I am not mature about ROOT, yet. So, I have a question about the compilation of ROOT. I often write the ROOT macro and run it, but I don’t understand why I have to compile the code and run it in this case.
In other word, can I write the ROOT macro for this integral calculation and the fitting without the compilation (alternative way)?
sorry for my late reply on your posting - I just forgot to press the “submit” button
[quote=“Nobu”]I could compile this, but would you tell me how to use it after compiling?
I see “bwfit02_2_C.so” file.
What is “bwfit02_2_C.d” file?[/quote]The .d file contains information for ACLiC when it’s needed to rebuild the file. Only then will a subsequent “.L bwfit02_2.C+” actually call the compiler and linker - otherwise it will just load the file.
You can simply call its functions after the .L …+, just like for the .L without the “+”.
[quote=“Nobu”]In addition,
just to clarify: it MUST NOT BE USED in a named macro!
What does it mean? Would you explain about it to use the example?[/quote]As I said in the sentence following this one the rule is very simple: as soon as your code has one single function you must not use gROOT->Reset().
[quote=“Nobu”]In other word, can I write the ROOT macro for this integral calculation and the fitting without the compilation (alternative way)?[/quote]You can try, but it’s much more reliable and also faster when it comes to execution to use the “.L …+”, i.e. to compile it. So the rule of thumb is: for simple cases use CINT to interpret it; if it’s complex or performance matters or you get errors that you don’t understand then compile the code using “.L …+”
I am sorry to reply to you. I have another question about these integral function call. I could compile the previous code and run it.
But it has the fixed integral constant or the fixed normalization constant (con) and con ~= 1000. Now, I want to vary the constant and fit it. So, I changed the constant con to the fitting parameter par[3] for that purpose. The code is attached with this message.
Line 142: out = par[3] * x[0] * mt …
instead of out = con * x[0] * mt …
and
Line 134: Double_t mt = par[4];
instead of Double_t mt = par[3];
Line 161: std::copy(p, p + 4, param);
Line 162: param[4] = *x;
Line 168: double param[5];
…
So, I added one extra parameter par[3] = con and par[4] = mt.
I can compile this code and run it.
The questions are that
What does Line 161 mean? copy parameters?
How about Line 168? I need only par[0] ~ par[4], five parameters.
But what does param[5] mean?
Thank you for your nice explanation and I understood it.
I have a question about the radius variable.
I attached the code which I modified a little about
Double_t radius = 13.0;
Line 159: Double_t radius = 13.0;
…
Line 178: Double_t radius = 13.0;
…
I changed from radius = 13.0 to radius = 5.0 in struct MyIntegFunc (Line 159), then the fitting parameters are changed.
I wrote the code Double_t radius = 13.0 in Line 178 and integral from 0.0 to radius+2.0 (skin thickness, 2.0 fm, so total 15.0 fm).
The integral fitting should not affect Line 159: radius = 5.0 since the real calculation depends on the TF1 *functions in the fitexample() code.
I thought the Line 159: Double_t radius = …; is just dummy variable.
Is it wrong?
I want to integral just from 0.0 to 13.0 + skin thickness (~= 2.0 fm)
Would you explain what is going on this code for me?
Thank you so much for your help!
/Nobu/ bwfitpiplus02.C (7.63 KB)
the integral limits depend on what you put as argument in the TF1::Integral method. It is called at the line 162, and the integration is done between 0 and the value of radius, which is defined at line 159.
return fFunc->Integral(0.0, radius, param);
At the line 180,
TF1 *funcx = new TF1("funcx", bwfitfunc, 0.0, radius+2.0, 5);
the function is created. There are passed as arguments the plotting range values (xmin = 0, xmax = radius+2.). These values have nothing to do with the integration limits.
When you plot the function (using TF1::Draw() ), it is shown in the axis range
[xmin,xmax]. These values are given when constructing the TF1 object.
See also the TF1 doc:
I have started learning ROOT and using blast wave fit for my work. I wanted to know whether there is any way in which we can properly set the parameter limits? Or we have to do that by trial and error seeing the chi-square/ndf value?
Thanks!
Sinjini