How to use class RooSetProxy


Can anybody let me know how to use class RooSetProxy? I’m a completely newbie in this roofit. I’m writing my own pdf class reffering class RooEfficiency. One of the arguments of the class I want is RooArgSet. Reffering class RooEfficiency, I’m trying to store the argument, RooArgSet by using RooSetProxy. The problem is I don’t know how to do. Unlike class RooCategoryProxy, the constructor of RooSetProxy doesn’t receive RooArgSet as argument. Thus I can’t figure out how to store reference of RooArgSet with RooSetProxy.

Any comment will be appreciated.

Thank you very much in advance,
InseokDischarge_Prob.cxx (3.6 KB) MyPdf.cxx (1.4 KB) MyPdf.h (962 Bytes)

Hi @isyoon,

  1. Proxies allow for access to other RooFit objects.
    1.1 If you know the number of objects that you need access to, use RooTemplateProxy starting from ROOT 6.22 or RooRealProxy for older RooFit versions.
    Example: mean and sigma of a Gaussian distribution.
    1.2 If you don’t know how many objects you have to store, you need a RooListProxy or RooSetProxy. These don’t store another object directly, but they store a set (no duplicates) or a list (permits duplicates) with a varying number of objects.
    Example: An addition of n functions, where the number n is not known at compile time.
  2. If you figured out from 1. that you need a set or list of objects, simply add all objects that come as argument. Note that you don’t store references to the set, but to the objects that are in the set that is passed as argument.
    Check out the docs of e.g. RooSetProxy, you will find a lot of add() functions. You can e.g. do:
Constructor(const RooArgSet& arguments) :
  _setProxy("parameters", "Set of all parameters", this) {

Note that you need to invoke the constructor of the SetProxy so that the proxy knows for which instance it is working.

Hi StephanH,

Thank you very much, StephanH. It’s really helpful. Can I ask one more question? How can I access RooArgSet which is stored by RooSetProxy in MyPdf? I can’t figure it out although I’ve search reference page.



The short answer is:
RooSetProxy is a RooArgSet, i.e., it derives from it. Just use it as if it were a RooArgSet.

Check the documentation page:

You will see that first, SetProxy functions are listed. Below that, you will find that there are all functions of RooArgSet listed in a folded section.
A bit more below is also an inheritance diagram that shows the inheritance.

Hi StephanH,

Thank you very much. Now I figure out why MyPdf cant’ read data argument. The reason is I didn’t complete copy constructor of MyPdf. Because I didn’t use the copy constructor, I thought the copy constructor was not neccessary. It seems the constructor is called from other parts of fitting.


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