Excluding regions in a fit

Dear Experts,
I would like to exclude the central region (where the signal peak is) on a fit in order to fit the background on both sides together.

I saw an old entry (Fri Oct 16, 2009) about this topic http://root.cern.ch/phpBB3//viewtopic.php?t=9318&start=0&postdays=0&postorder=asc&highlight=&sid=86b1697a176fbfda2edc9cf5d84fb073
where Wouter proposed a solution.

When I tried to apply the proposed method I had this error:
Traceback (most recent call last):
File “tmp.py”, line 21, in
r_sig = model.fitTo(modelData,RooFit.Save(kTRUE),RooFit.Range(“left”,“right”)) ;
TypeError: none of the 4 overloaded methods succeeded. Full details:
RooCmdArg RooFit::Range(const char* rangeName, Bool_t adjustNorm = kTRUE) =>
could not convert argument 2 (boolean value should be bool, or integer 1 or 0)
RooCmdArg RooFit::Range(const char* rangeName, Bool_t adjustNorm = kTRUE) =>
could not convert argument 2 (boolean value should be bool, or integer 1 or 0)
RooCmdArg RooFit::Range(Double_t lo, Double_t hi, Bool_t adjustNorm = kTRUE) =>
could not convert argument 1 (a float is required)
RooCmdArg RooFit::Range(Double_t lo, Double_t hi, Bool_t adjustNorm = kTRUE) =>
could not convert argument 1 (a float is required)

It looks like it is not possible anymore to give two strings to Range. Is it possible?

I attached a python and a C version of a code that reproduce the problem.

Thanks a lot in advance for your help,

     Barbara

roofit_tmp.py (1.48 KB)
roofit_tmp.C (2.66 KB)

Hi,

the code that Wouter indicated is slightly different from what you are using. You have ‘RooFit.Range(“left”,“right”)’ but the referenced example proposes something like: ‘RooFit.Range(“left,right”)’. Note the difference: two string variables versus one string variable of two comma-separated parts.

HTH,
Wim