Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooBifurGauss.cxx
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitModels *
4 * @(#)root/roofit:$Id$
5 * Authors: *
6 * Abi Soffer, Colorado State University, abi@slac.stanford.edu *
7 * *
8 * Copyright (c) 2000-2005, Regents of the University of California, *
9 * Colorado State University *
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 RooBifurGauss
18 \ingroup Roofit
19
20Bifurcated Gaussian p.d.f with different widths on left and right
21side of maximum value.
22**/
23
24#include <RooBifurGauss.h>
25
26#include "RooBatchCompute.h"
27
30
32
33////////////////////////////////////////////////////////////////////////////////
34
35RooBifurGauss::RooBifurGauss(const char *name, const char *title, RooAbsReal &_x, RooAbsReal &_mean,
36 RooAbsReal &_sigmaL, RooAbsReal &_sigmaR)
37 : RooAbsPdf(name, title),
38 x("x", "Dependent", this, _x),
39 mean("mean", "Mean", this, _mean),
40 sigmaL("sigmaL", "Left Sigma", this, _sigmaL),
41 sigmaR("sigmaR", "Right Sigma", this, _sigmaR)
42
43{
44}
45
46////////////////////////////////////////////////////////////////////////////////
47
49 : RooAbsPdf(other, name),
50 x("x", this, other.x),
51 mean("mean", this, other.mean),
52 sigmaL("sigmaL", this, other.sigmaL),
53 sigmaR("sigmaR", this, other.sigmaR)
54{
55}
56
57////////////////////////////////////////////////////////////////////////////////
58
60{
62}
63
64////////////////////////////////////////////////////////////////////////////////
65
67{
68 ctx.addResult(this, ctx.buildCall("RooFit::Detail::EvaluateFuncs::bifurGaussEvaluate", x, mean, sigmaL, sigmaR));
69}
70
71////////////////////////////////////////////////////////////////////////////////
72/// Compute multiple values of BifurGauss distribution.
73void RooBifurGauss::computeBatch(double *output, size_t nEvents, RooFit::Detail::DataMap const &dataMap) const
74{
76 {dataMap.at(x), dataMap.at(mean), dataMap.at(sigmaL), dataMap.at(sigmaR)});
77}
78
79////////////////////////////////////////////////////////////////////////////////
80
81Int_t RooBifurGauss::getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char * /*rangeName*/) const
82{
83 if (matchArgs(allVars, analVars, x))
84 return 1;
85 if (matchArgs(allVars, analVars, mean))
86 return 2;
87 return 0;
88}
89
90////////////////////////////////////////////////////////////////////////////////
91
92double RooBifurGauss::analyticalIntegral(Int_t code, const char *rangeName) const
93{
94 auto &constant = code == 1 ? mean : x;
95 auto &integrand = code == 1 ? x : mean;
96
97 return RooFit::Detail::AnalyticalIntegrals::bifurGaussIntegral(integrand.min(rangeName), integrand.max(rangeName),
98 constant, sigmaL, sigmaR);
99}
100
101////////////////////////////////////////////////////////////////////////////////
102
103std::string RooBifurGauss::buildCallToAnalyticIntegral(Int_t code, const char *rangeName,
105{
106 auto &constant = code == 1 ? mean : x;
107 auto &integrand = code == 1 ? x : mean;
108
109 return ctx.buildCall("RooFit::Detail::AnalyticalIntegrals::bifurGaussIntegral", integrand.min(rangeName),
110 integrand.max(rangeName), constant, sigmaL, sigmaR);
111}
#define ClassImp(name)
Definition Rtypes.h:377
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:55
Bifurcated Gaussian p.d.f with different widths on left and right side of maximum value.
Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=nullptr) const override
Interface function getAnalyticalIntergral advertises the analytical integrals that are supported.
RooRealProxy mean
std::string buildCallToAnalyticIntegral(Int_t code, const char *rangeName, RooFit::Detail::CodeSquashContext &ctx) const override
This function defines the analytical integral translation for the class.
RooRealProxy sigmaL
double evaluate() const override
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
void computeBatch(double *output, size_t nEvents, RooFit::Detail::DataMap const &) const override
Compute multiple values of BifurGauss distribution.
RooRealProxy sigmaR
void translate(RooFit::Detail::CodeSquashContext &ctx) const override
This function defines a translation for each RooAbsReal based object that can be used to express the ...
RooRealProxy x
double analyticalIntegral(Int_t code, const char *rangeName=nullptr) const override
Implements the actual analytical integral(s) advertised by getAnalyticalIntegral.
A class to maintain the context for squashing of RooFit models into code.
std::string buildCall(std::string const &funcname, Args_t const &...args)
Build the code to call the function with name funcname, passing some arguments.
void addResult(RooAbsArg const *key, std::string const &value)
A function to save an expression that includes/depends on the result of the input node.
RooBatchCompute::Config config(RooAbsArg const *arg) const
Definition DataMap.cxx:73
Double_t x[n]
Definition legend1.C:17
void compute(Config cfg, Computer comp, RestrictArr output, size_t size, VarSpan vars, ArgSpan extraArgs={})
double bifurGaussIntegral(double xMin, double xMax, double mean, double sigmaL, double sigmaR)
double bifurGaussEvaluate(double x, double mean, double sigmaL, double sigmaR)
static void output()