Problem in tree branch filled by a function


Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


Hello,

I am struggling with saving data (on an event by event basis) into a tree branch using a function.

Could you please help me in pointing out what is the problem in the following piece of code:

tt -> Branch ("var1",&var1,"var1/d");
TF1 *f1 = new TF1("f1","(2.0/[1])*(TMath::Gaus(((x - [0]) / [1]), 0.0, 1.0))*(0.5 * (1.0 + ROOT::Math::erf(([2]*((x - [0]) / [1]))/1.41421356)))",0.0,1000.0);  
f1->FixParameter(0,100.0);             
f1->FixParameter(1,12.0);     
f1->FixParameter(2,2.0);     
f1->SetNpx(4);
var1 = f1->GetRandom();

Thanks.

Hi,

Everything seems fine: what’s the problem? Can you post a complete standalone example?

Cheers,
D

Hi @Danilo

That’s not possible, as the program is long.

I know that in the definition of function there is no problem, as I checked plotting that separately using an array.

Feeding the same to the tree branch on an even by even basis is not working. Its frozen there and not allowing me to click out of the window.

I am using root 5.34/36

Hi @Danilo

It seems the SetNpx() is taking longer time. It is working. But after some time it freezes.
Is there any other way to do such thing?

Hi,

As perhaps suggested in a previous conversation, maybe the function could be simplified or provided as a compiled (optimized) C++ function pointer.

D