Facing problem in writing a function in root

how to write crystal ball function in root?

Hi,

there is an example using this function: https://root.cern/doc/master/CrystalBall_8C_source.html

Better look at https://root.cern/doc/master/CrystalBall_8C.html
You will see the code and the graphics output produced by this macro.


I am doing this but getting error so can you please help me with this ?


With thisi am getting the error- undefined indetifier

void crb()
{
        TCanvas* c1 = new TCanvas("c1", "my canvas", 0, 0, 800, 600);

        TF1 *myCrystallBall = new TF1("myCrystallBall", "ROOT::Math::crystalball_function(x, 2., 2., 1., 0.)", -3., +3.);
        TH1D* h1 = new TH1D("h1", "test1", 100, -3, +3);
        h1->FillRandom("myCrystallBall", 10000);
        h1->SetLineColor(kRed);
        h1->Draw();

        return;
}



It is giving me this error and it is just creating canvas.so how can I correct this ?

I guess @moneta might help.
But, can what do you get when you run exactly the example provided here: https://root.cern/doc/master/CrystalBall_8C.html
If you get errors it might be your ROOT version is not supporting this functionality.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.