Dataset from histograms except a range

Hello.

If I have a histogram defined between A and B, and I have a range A1-B1, where A1 > A and B1 < B, so that this sub-range is included in the histogram one, can I create a dataset from this histogram with only the bins outside the interval A1-B1?

Thanks, cheers

Hello,

Could you be more specific on what you mean about “create a dataset”? Are you referring to RooFit? Are you meaning something like creating a RooHistPdf from a histogram and generate from it? Or you you speaking about plain TH1 histograms (and then I’m not sure what you mean about creating a dataset)…

Cheers,

– Gregory

Yes, sorry. I was convinced that this forum was devoted to RooFit.
I meant creating a RooDataHist or whatever analogue to this from a TH1D object.

Hi,

The encoding of ranges in RooFit happens in the observables and not in the dataset definition.

Thus if you want to process data in a 1D binned dataset in two disjoint ranges, the simplest way to proceed is

  1. Make a RooDataHist defining the range of ‘x’ to encompass all ranges you intend to use
  2. Define in your RooRealVar x the ranges of interest, e.g.
    x.setRange(“A”,-10,-5) ;
    x.setRange(“B”,5,10) ;
  3. Indicate the (multiple) ranges that you want to use in e.g. a fit
    pdf.fitTo(x,Range(“A,B”)) ;

Wouter