Coming soon - Get a detailed view of why an account is flagged as spam!
view details
6
ROOT help
Post Body

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?

Author
Account Strength
100%
Account Age
14 years
Verified Email
Yes
Verified Flair
No
Total Karma
27,184
Link Karma
6,860
Comment Karma
20,258
Profile updated: 5 days ago
Posts updated: 8 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
12 years ago