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.
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;
}
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.


