Hi roofit experts,
I am trying to fit a Simultaneous pdf (Signal + Background) to my data where I fit the background and signal functions for different ranges. Can anyone tell me why the following code doesn’t work?
RooCategory cat(“cat”,“cat”);
cat.defineType(“Signal”);
cat.defineType(“Back”);
RooDataHist data(“data”,“data”,RooArgSet(x),histo); //histo is a TH1F histogram
RooSimultaneous simPdf(“simPdf”,“simPdf”);
simPdf.addPdf(Signal,“Signal”); //Signal is defined elswhere
simPdf.addPdf(Back,“Back”); //Back is also defined
x.setRange(“fitRange_Signal”,4904,4935);
x.setRange(“fitRange_Back”,4840,4902);
simPdf.fitTo(data, Range(“fitRange”), SplitRange());
I think maybe I am not understanding the use of categories in this particular case. I would be very greatful if anyone could help.
Thanks