Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Loading...
Searching...
No Matches
RooExponential.cxx
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitModels *
4 * @(#)root/roofit:$Id$
5 * Authors: *
6 * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7 * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8 * *
9 * Copyright (c) 2000-2005, Regents of the University of California *
10 * and Stanford University. All rights reserved. *
11 * *
12 * Redistribution and use in source and binary forms, *
13 * with or without modification, are permitted according to the terms *
14 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15 *****************************************************************************/
16
17/** \class RooExponential
18 \ingroup Roofit
19
20Exponential PDF. It computes
21\f[
22 \mathrm{RooExponential}(x, c) = \mathcal{N} \cdot \exp(c\cdot x),
23\f]
24where \f$ \mathcal{N} \f$ is a normalisation constant that depends on the
25range and values of the arguments.
26**/
27
28#include "RooExponential.h"
29
30#include "RooRealVar.h"
31#include "RooBatchCompute.h"
32
34
35#include <algorithm>
36#include <cmath>
37
38
39////////////////////////////////////////////////////////////////////////////////
40
41RooExponential::RooExponential(const char *name, const char *title, RooAbsReal &variable, RooAbsReal &coefficient,
42 bool negateCoefficient)
43 : RooAbsPdf{name, title},
44 x{"x", "Dependent", this, variable},
45 c{"c", "Exponent", this, coefficient},
46 _negateCoefficient{negateCoefficient}
47{
48}
49
50////////////////////////////////////////////////////////////////////////////////
51
53 : RooAbsPdf{other, name}, x{"x", this, other.x}, c{"c", this, other.c}, _negateCoefficient{other._negateCoefficient}
54{
55}
56
57////////////////////////////////////////////////////////////////////////////////
58
60{
61 double coef = c;
63 coef = -coef;
64 }
65 return std::exp(coef * x);
66}
67
68////////////////////////////////////////////////////////////////////////////////
69/// Compute multiple values of Exponential distribution.
75
76Int_t RooExponential::getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char * /*rangeName*/) const
77{
78 if (matchArgs(allVars, analVars, x))
79 return 1;
80 if (matchArgs(allVars, analVars, c))
81 return 2;
82 return 0;
83}
84
85////////////////////////////////////////////////////////////////////////////////
86
87double RooExponential::analyticalIntegral(Int_t code, const char *rangeName) const
88{
89 assert(code == 1 || code == 2);
90
91 bool isOverX = code == 1;
92
93 double coef = c;
95 coef = -coef;
96 }
97
98 double constant = isOverX ? coef : x;
99 auto &integrand = isOverX ? x : c;
100
101 double min = integrand.min(rangeName);
102 double max = integrand.max(rangeName);
103
104 if (!isOverX && _negateCoefficient) {
105 std::swap(min, max);
106 min = -min;
107 max = -max;
108 }
109
111}
#define c(i)
Definition RSha256.hxx:101
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
char name[80]
Definition TGX11.cxx:110
Abstract interface for all probability density functions.
Definition RooAbsPdf.h:40
Abstract base class for objects that represent a real value and implements functionality common to al...
Definition RooAbsReal.h:59
bool matchArgs(const RooArgSet &allDeps, RooArgSet &numDeps, const RooArgProxy &a) const
Utility function for use in getAnalyticalIntegral().
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:24
Exponential PDF.
void doEval(RooFit::EvalContext &) const override
Compute multiple values of Exponential distribution.
RooRealProxy c
double analyticalIntegral(Int_t code, const char *rangeName=nullptr) const override
Implements the actual analytical integral(s) advertised by getAnalyticalIntegral.
double evaluate() const override
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
RooRealProxy x
Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=nullptr) const override
Interface function getAnalyticalIntergral advertises the analytical integrals that are supported.
std::span< double > output()
RooBatchCompute::Config config(RooAbsArg const *arg) const
double min(const char *rname=nullptr) const
Query lower limit of range. This requires the payload to be RooAbsRealLValue or derived.
Double_t x[n]
Definition legend1.C:17
void compute(Config cfg, Computer comp, std::span< double > output, VarSpan vars, ArgSpan extraArgs={})
double exponentialIntegral(double xMin, double xMax, double constant)
Definition MathFuncs.h:497