RooAbsReal::createHistogram

Hello,
I defined a pdf(net,tag) = pdf_1 (if tag=+1 Right tagged) |
pdf_2( if tag=-1 / Wrong tagged) | --> Tagged
pdf_3 (if tag=0 / Untagged)
I would like to create the histogram corresponding to
pdf_2

pdf_1 + pdf_2

by using something like
H1 = pdf.createHistogram(“name1”,net,Binning(100),ProjectionRange(“Right”));
H2 = pdf.createHistogram(“name2”,net,Binning(100),ProjectionRange(“Tagged”));

H1->Divide(H2);

is it possible?
I tried but the two histograms H1 and H2 seems to be the same.
Is there an alternative way?

Thanks
Stefania

If the code isn’t too long, …please post.

Dave

Hi,

The method createHistogram() does not (yet) support all the projection functionality of plotOn. This will be added soon. In the mean time
you can accomplish what you want as follows

RooAbsReal* proj_right = pdf.createIntegral(tag,Range(“Right”)) ;
RooAbsReal* proj_tagged = pdf.createIntegral(tag,Range(“Tagged”)) ;

I note that in general you can also make ‘efficiency’ plots that represent this ratio from RooDataSets and RooDataHists using the Efficiency() operator in plotOn()

data->plotOn(frame,Efficiency(myCat)) ;

where myCat is a category with two states (0,1). In this mode the proper binomial errors are drawn automatically. See $ROOTSYS/tutorials/roofit/rf701_efficiencyfit.C for a complete example.

In you case you would have to use cat->cat mapping function first to represent your problem in this form, e.g.

RooMappedCategory mapCat("mapCat","map",tag,"Default",0) ;
mapCat.map("Right","Right",1) ;
data->addColumn(mapCat) ;

see $ROOTSYS/tutorials/roofit/rf406_cattocatfuncs.C for more details on this.

Wouter