Re: Discrepancy in RooFit when used in python and C++

From: suvayu ali <fatkasuvayu_at_gmail.com>
Date: Wed, 11 Apr 2012 23:11:44 +0200


Hello Wim,

On Wed, Apr 11, 2012 at 22:25, <wlavrijsen_at_lbl.gov> wrote:
> Hi,
>
> what is "Model" in your example code?
>

The "Model" in my code is RooDecay with a RooGaussian resolution model. Where the resolution model uses per event errors from a RooDataSet. This decay model is then multiplied with an efficiency using RooEffProd. I have simplified a few things in the above description. But to be complete I'm quoting from my C++ program source below.

  RooGaussModel resmodel("resmodel", "Time resolution model", time,

                         mean, scale, dt); // dt -> per-event error

  // decay model
  RooDecay decayH("decayH", "Decay function for the B_{s,H}", time,

		  RooRealConstant::value(1.536875/1E3), resmodel,
                  RooDecay::SingleSided);
  RooDecay decayL("decayL", "Decay function for the B_{s,L}", time,
		  RooRealConstant::value(1.407125/1E3), resmodel,
                  RooDecay::SingleSided);
  RooAddPdf decay("decay", "Decay function for the B_{s}", decayH,
                  decayL, RooRealConstant::value(0.5));

  // acceptance
  RooFormulaVar acceptance("acceptance", "1-1/(1+(@0*@1)**@2)",

                           RooArgList(turnon, time, exponent));

  // Final model
  RooEffProd Model("Model", "Acceptance model", decay, acceptance);

> There are a range of issues with using RooFit from python. First,
> (common for plotOn, but that should've been fixed), the "using"
> declaration does not propagate through CINT dictionaries, so PyROOT is
> blind to it. Second, RooFit likes to cast const away from temporary
> variables. Third, RooFit likes to overload methods on both a derived
> as well as a base class. These last two, I consider bugs in RooFit, as
> they can bite you from C++ (it's just worse when used from python due
> to slightly different scoping rules).
>
> In general, I recommend not to use RooFit from python.
>

Personally I prefer C++, but I see more and more people preferring Python both within the collaboration (LHCb) and at my institute and then there is the convenience of a powerful interactive environment, so I decided to give it a try for my current project.

I'll give your recommendation some more thought and decide. Thanks a lot.

Cheers,

-- 
Suvayu

Open source is the future. It sets us free.
Received on Wed Apr 11 2012 - 23:12:10 CEST

This archive was generated by hypermail 2.2.0 : Thu Apr 12 2012 - 05:50:01 CEST