Here's the relevant lines of code:
TH1D hProject = (TH1D)hNeutron->Project3D("x"); TF1 *LeftFit = new TF1("LeftFit","expo",600,-35000);
void background_subtract()
{
hProject->Fit("LeftFit","R",-201,-15199);
}
So the idea is to fit the hProject histogram over the interval (-15199, -201) but have this exponential function be defined on the interval (-35000, 600). hNeutron is a histogram that is already filled and loaded before running the macro. The intervals are reversed since the predefined function "expo" is an exponential decay and I want an exponential growth fit. The error I'm getting is:
Error: Can't call TH1D::Fit("LeftFit","R",-201,-15199) in current scope background_subtract.C:26
I used almost identical syntax in another macro, and it worked fine. Here's the relevant lines from that macro:
TF1 *fit = new TF1("fit","expo",0,-5000);
void background_fit()
{
hGondTime->Fit("fit","R",0,-5000);
}
Again, hGondTime (a TH1D) is filled and loaded before the macro is run. What's the difference here? Why does one work but the other doesn't?
Is there any other info you need in order to figure out what's going on?
Subreddit
Post Details
- Posted
- 12 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/ParticlePhy...