Home | News | Documentation | Download

RooDataSet: 2D weights?

Dear All,
could you please help me out a bit with Roofit?
My problem is that I have a dataset formed of two variables, cos(theta) and phi.
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,
Simone

Hi,

I am sorry I don’t understand the 2D weights. A weight is a scalar associated with each single event and not to the variables. The event then can have multi-dimensional observable variables, like cos(theta) and phi in your case

Lorenzo

Buongiorno,
Thanks for the reply.
I understand what you mean.

The point here is that in this case, cos(theta) and phi have two different weights in a single event. This is typically the case when the weight is due to the acceptance, and it is not possible to compute the acceptance as a function of both observables, but only one at a time.

In fact, the example code I put is for this 2D “acceptance”.

Please, let me know if I have been able to clarify it.
Otherwise I can go more into detail.

Thanks again for the reply.
Simone

Hi,

Still I am not sure I have understood the problem well. If you compute one at a time, you neglect correlation between variables and it is then like to build a 1D model where you have a dataset on cos(theta) and one on phi and not a 2D data set.

Lorenzo

1 Like

Many thanks,
yes, that is exactly the case.
Unfortunately, it seems like it is not possible to describe the weights in a 2D fashion (thus taking care of the correlations from the get and go), and one would have to adopt two 1D descriptions i.e. one for cos(theta) and another for phi.
I seem to now understand that such an approach is not accepted by Roofit…
Thanks for your replies,
Simone

Hi,

To be clear, this is not a RooFit limitation, but a limitation of your analysis method that you cannot get the acceptance as function of the two variables, but only its projections.
The correct procedure is to have a weight for each (x,y) point of your data and this can be modeled in RooFit

Lorenzo

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.