Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooRatio.cxx
Go to the documentation of this file.
1/*
2 * Project: RooFit
3 * Author:
4 * Rahul Balasubramanian, Nikhef 01 Apr 2021
5 *
6 * Copyright (c) 2023, CERN
7 *
8 * Redistribution and use in source and binary forms,
9 * with or without modification, are permitted according to the terms
10 * listed in LICENSE (http://roofit.sourceforge.net/license.txt)
11 */
12
13/**
14\file RooRatio.cxx
15\class RooRatio
16\ingroup Roofitcore
17
18Represents the ratio of two RooAbsReal objects.
19
20**/
21
22#include <RooRatio.h>
23
24#include <RooBatchCompute.h>
25#include <RooMsgService.h>
26#include <RooProduct.h>
27#include <RooRealVar.h>
28
30
31#include <TMath.h>
32
33
37
38RooRatio::RooRatio(const char *name, const char *title, RooAbsReal &nr, RooAbsReal &dr)
39 : RooAbsReal(name, title),
40 _numerator("numerator", "numerator", this, nr),
41 _denominator("denominator", "denominator", this, dr)
42{
43}
44
45RooRatio::RooRatio(const char *name, const char *title, RooAbsReal &nr, double dr)
46 : RooAbsReal(name, title),
47 _numerator("numerator", "numerator", this, nr),
48 _denominator("denominator", "denominator", this)
49{
50 auto drvar = new RooRealVar(Form("%s_dr", name), Form("%s_dr", name), dr);
53}
54
55RooRatio::RooRatio(const char *name, const char *title, double nr, RooAbsReal &dr)
56 : RooAbsReal(name, title),
57 _numerator("numerator", "numerator", this),
58 _denominator("denominator", "denominator", this, dr)
59{
60 auto nrvar = new RooRealVar(Form("%s_nr", name), Form("%s_nr", name), nr);
63}
64
65RooRatio::RooRatio(const char *name, const char *title, double nr, double dr)
66 : RooAbsReal(name, title),
67 _numerator("numerator", "numerator", this),
68 _denominator("denominator", "denominator", this)
69{
70 auto nrvar = new RooRealVar(Form("%s_nr", name), Form("%s_nr", name), nr);
71 auto drvar = new RooRealVar(Form("%s_dr", name), Form("%s_dr", name), dr);
75}
76
77RooRatio::RooRatio(const char *name, const char *title, const RooArgList &nrlist, const RooArgList &drlist)
78 : RooAbsReal(name, title),
79 _numerator("numerator", "numerator", this),
80 _denominator("denominator", "denominator", this)
81{
82 auto nrprod = new RooProduct(Form("%s_nr", name), Form("%s_nr", name), nrlist);
83 auto drprod = new RooProduct(Form("%s_dr", name), Form("%s_dr", name), drlist);
87}
88
92
95 _numerator("numerator", this, other._numerator),
96 _denominator("denominator", this, other._denominator)
97{
98}
99
104
105////////////////////////////////////////////////////////////////////////////////
106/// Evaluate in batch mode.
108{
110 {ctx.at(_numerator), ctx.at(_denominator)});
111}
char name[80]
Definition TGX11.cxx:142
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2571
bool addOwnedComponents(const RooAbsCollection &comps)
Take ownership of the contents of 'comps'.
Abstract base class for objects that represent a real value and implements functionality common to al...
Definition RooAbsReal.h:63
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition RooArgList.h:22
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:24
Represents the product of a given set of RooAbsReal objects.
Definition RooProduct.h:29
Represents the ratio of two RooAbsReal objects.
Definition RooRatio.h:21
RooRealProxy _numerator
Definition RooRatio.h:42
~RooRatio() override
Definition RooRatio.cxx:89
double evaluate() const override
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
Definition RooRatio.cxx:100
void doEval(RooFit::EvalContext &) const override
Evaluate in batch mode.
Definition RooRatio.cxx:107
RooRealProxy _denominator
Definition RooRatio.h:43
Variable that can be changed from the outside.
Definition RooRealVar.h:37
bool setArg(T &newRef)
Change object held in proxy into newRef.
void compute(Config cfg, Computer comp, std::span< double > output, VarSpan vars, ArgSpan extraArgs={})
double ratio(double numerator, double denominator)
Definition MathFuncs.h:106