Dear experts,
I am trying to do a 2d unbinned fit in subranges. I did follow the tutorial multirangefit to do it and the result seem to be reasonable with the another independent result. For instance here is the relevant part of the code about it:
/*some variable and pdf definitions*/
// Create the 2d acc and rmd model
RooProdPdf model_acc((string(pdf_acc->GetName()) + "_2d").c_str(), (string(pdf_acc->GetName()) + "_2d").c_str(), RooArgList(*pdf_acc, *pdf_cte));
RooProdPdf model_rmd((string(pdf_rmd->GetName()) + "_2d").c_str(), (string(pdf_rmd->GetName()) + "_2d").c_str(), RooArgList(*pdf_rmd, *pdf_gaus));
// Create the variables for rmd and acc
RooRealVar nRmd("nRmd", "nRmd", 1000, 0, 5000);
RooRealVar nAcc("nAcc", "nAcc", 500, 0, 5000);
// Create the 2d pdf
RooAddPdf model((model_name + "_2d").c_str(), (model_name + "_2d").c_str(), RooArgList(model_rmd, model_acc), RooArgList(nRmd, nAcc));
/*some other stuff*/
time->setRange(time_min, time_max);
time->setRange("fullRange", time_min, time_max);
time->setRange("leftSide", time_min, time_max);
time->setRange("rightSide", time_min, time_max);
minv->setRange(minv_min, minv_max);
minv->setRange("fullRange", minv_min, minv_max);
minv->setRange("leftSide", minv_min, -84);
minv->setRange("rightSide", 121, minv_max);
/*some other stuff*/
// Fit the model to the data
RooFitResult *result = model.fitTo(data, Save(), Range("leftSide,rightSide"), Strategy(2));
model.removeStringAttribute("fitrange");
result->Print("v");
Now I want to draw in different “slices” of my obsrevables minv and time the projection of the other variable. For instance, 3 slices of time the projection in each slice in the minv variable of the model. For this I followed rangeplot tutorial. When it comes to the drawing I wrote then:
RooPlot *plotMinvSlice = minv->frame(
Title(Form("m^{2}_{inv} projection for t_{e#gamma} #in [%.02f, %.02f] ns", t_low, t_high)));
data.plotOn(plotMinvSlice, CutRange(rangeName.c_str()));
model.plotOn(plotMinvSlice,
Range("fullRange"),
NormRange("leftSide,rightSide"),
ProjectionRange(rangeName.c_str()), /*name of the time sub-range*/
LineColor(kMagenta + 2),
LineStyle(kDashed));
It seems to work fine but the terminal tells me a warning like:
[#0] WARNING:Plotting -- RooHist::getFitRangeNEvt() WARNING: The number of normalisation events associated to histogram h_data_CutRange[slice1] is not equal to number of events in this histogram.
This is due a cut being applied while plotting the data. Automatic normalisation over a sub-range of a plot variable assumes
that the effect of that cut is uniform across the plot, which may be an incorrect assumption. To obtain a correct normalisation, it needs to be passed explicitly:
data->plotOn(frame01,CutRange("SB1"));
const double nData = data->sumEntries("", "SB1"); //or the cut string such as sumEntries("x > 0.");
model.plotOn(frame01, RooFit::Normalization(nData, RooAbsReal::NumEvent), ProjectionRange("SB1"));
If I apply these corrections my drawing does not make sense.
Is there anything that I am missing here?
Thanks in advance,
Elia