Dear RooFit experts,

when I try to fit a distribution with a pdf it looks like RooFit is ignoring the range if the pdf that I’m using to fit the data is being imported from a workspace. To reproduce this behaviour you can run

```
import ROOT
x = ROOT.RooRealVar("x","x",0.0,10.0)
# get the pdf from a workspace
in_file = ROOT.TFile.Open("myws.root")
ws = in_file.Get("w")
expo = ws.pdf("expo")
# generate data
c_expo_gen = ROOT.RooRealVar("c_expo_gen","c_expo_gen",-0.7)
expo_gen = ROOT.RooExponential("expo_gen","expo_gen",x,c_expo_gen)
data = expo_gen.generate(ROOT.RooArgSet(x),1000)
# set a fitting range
x.setRange("r",0.0,3.0)
# define the model
norm = ROOT.RooRealVar("norm","norm",0,1000)
model = ROOT.RooAddPdf("model","model", ROOT.RooArgList(expo), ROOT.RooArgList(norm))
# fit to generated data
model.fitTo(data,ROOT.RooFit.Range("r"))
frame = x.frame()
data.plotOn(frame)
model.plotOn(frame)
# draw and save
c = ROOT.TCanvas("c","c",600,600)
frame.Draw()
c.SaveAs("fit_output.png")
```

where the input workspace (myws.root) can be created by running:

```
import ROOT
w = ROOT.RooWorkspace("w")
w.factory("Exponential::expo(x[0,10],c[-2.0,0.])")
of = ROOT.TFile("myws.root","recreate")
w.Write()
of.Close()
```

On the other hand, if the pdf is defined within the script the fit is performed within the range and the behaviour is as expected, i.e. if I subsitute the lines below the `# get the pdf from a workspace`

comment with

```
# do not get the pdf from a workspace
c_expo = ROOT.RooRealVar("c_expo","c_expo",-2.,0.0)
expo = ROOT.RooExponential("expo","expo",x,c_expo)
```

I’ve tested it both in 6.12/07 and 6.26/04 root versions. While in the older version I don’t get any error message, in the second case i get the following warning message:

`[#0] WARNING:Fitting -- None of the fit observables seem to know the range 'r'. This means that the full range will be used.`

in both cases I didn’t manage to fit the data in the range, but I need to use the older root version.

Is there something that I’m missing?

Thanks a lot!

Leonardo