could you please help me out a bit with Roofit?
My problem is that I have a dataset formed of two variables,
I have to attach weights to this dataset to eventually perform a 2D fit.
If the event has the same weight for both observables, I can do:
RooRealVar t("t", "Cos(theta) ", -0.6, 0.6) ; RooRealVar p("p", "phi angle ", 0, 2*3.14) ; RooRealVar* weight = new RooRealVar("weight", "weight", 0.0, 1000. ); RooArgSet* ArgSet = new RooArgSet("args"); ArgSet->add(t); ArgSet->add(p); ArgSet->add(*weight); RooDataSet* dataAnglOld = new RooDataSet("dataAnglOld", "dataAnglOld", *ArgSet); ... t.setVal(ct); p.setVal(phiF); weight->setVal(w); // dataAngl->add(*ArgSet, w, 0); dataAnglOld->add(*ArgSet);
And when the dataset is complete, I create the new one like this:
RooDataSet* dataAngl = new RooDataSet("dataAngl", "dataAngl", dataAnglOld,*dataAnglOld->get(),0,weight->GetName()); dataAngl->get(0)->Print("V"); cout << dataAngl->weight() << endl; dataAngl->get(1)->Print("V"); cout << dataAngl->weight() << endl; dataAngl->get(2)->Print("V"); cout << dataAngl->weight() << endl;
With the last few
couts I could tell if weights had been set properly, and they were.
However, it is not clear to me how to give a 2D weight there…
Would you be able to advise me?
Just a note, I would need to do it this way to do a 2D fit.
Thanks in advance,