How do I make my poln fit go through the origin?

Hello, ROOTers! I have a very simple question that I imagine has a very simple solution, but I can’t seem to figure it out myself.

I have a polynomial fit I’m doing, and I would like to make it go through the origin. The online tutorials say to use the “B” option, but I have no idea how to use it. I have right now:

TFitResultPtr r = hEPDRefMult[i]->Fit(Form("pol%d",polyFit),"S")

The polyFit stuff is because I’m using a different degree polynomial for different values of [i] (works fine).
So, how do I demand that the p0 coefficient is 0.0?



TF1 *f = ((TF1*)(gROOT->GetFunction(Form("pol%d", polyFit))));
f->SetParameters(0., ... ); // set "reasonable" initial values for all parameters
f->FixParameter(0, 0.); // "p0"
TFitResultPtr r = hEPDRefMult[i]->Fit(f, "S");
f->ReleaseParameter(0); // "p0"

That did the trick; thank you!