ROOT   Reference Guide
Searching...
No Matches
RooArgusBG.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 *
11 * *
12 * Redistribution and use in source and binary forms, *
13 * with or without modification, are permitted according to the terms *
15 *****************************************************************************/
16
17/** \class RooArgusBG
18 \ingroup Roofit
19
20RooArgusBG is a RooAbsPdf implementation describing the ARGUS background shape.
21\f[
22 \mathrm{Argus}(m, m_0, c, p) = \mathcal{N} \cdot m \cdot \left[ 1 - \left( \frac{m}{m_0} \right)^2 \right]^p
23 \cdot \exp\left[ c \cdot \left(1 - \left(\frac{m}{m_0}\right)^2 \right) \right]
24\f]
25\image html RooArgusBG.png
26*/
27
28#include "RooArgusBG.h"
29#include "RooRealVar.h"
30#include "RooRealConstant.h"
31#include "RooMath.h"
32#include "RooBatchCompute.h"
33
34#include "TMath.h"
35
36#include <cmath>
37using namespace std;
38
40
41////////////////////////////////////////////////////////////////////////////////
42/// Constructor.
43
44RooArgusBG::RooArgusBG(const char *name, const char *title,
45 RooAbsReal& _m, RooAbsReal& _m0, RooAbsReal& _c) :
46 RooAbsPdf(name, title),
47 m("m","Mass",this,_m),
48 m0("m0","Resonance mass",this,_m0),
49 c("c","Slope parameter",this,_c),
50 p("p","Power",this,(RooRealVar&)RooRealConstant::value(0.5))
51{
52}
53
54////////////////////////////////////////////////////////////////////////////////
55/// Constructor.
56
57RooArgusBG::RooArgusBG(const char *name, const char *title,
58 RooAbsReal& _m, RooAbsReal& _m0, RooAbsReal& _c, RooAbsReal& _p) :
59 RooAbsPdf(name, title),
60 m("m","Mass",this,_m),
61 m0("m0","Resonance mass",this,_m0),
62 c("c","Slope parameter",this,_c),
63 p("p","Power",this,_p)
64{
65}
66
67////////////////////////////////////////////////////////////////////////////////
68/// Constructor.
69
70RooArgusBG::RooArgusBG(const RooArgusBG& other, const char* name) :
71 RooAbsPdf(other,name),
72 m("m",this,other.m),
73 m0("m0",this,other.m0),
74 c("c",this,other.c),
75 p("p",this,other.p)
76{
77}
78
79////////////////////////////////////////////////////////////////////////////////
80
82 Double_t t= m/m0;
83 if(t >= 1) return 0;
84
85 Double_t u= 1 - t*t;
86 //cout << "c = " << c << " result = " << m*TMath::Power(u,p)*exp(c*u) << endl ;
87 return m*TMath::Power(u,p)*exp(c*u) ;
88}
89
90////////////////////////////////////////////////////////////////////////////////
91/// Compute multiple values of Argus distribution.
93 return RooBatchCompute::dispatch->computeArgusBG(this, evalData, m->getValues(evalData, normSet), m0->getValues(evalData, normSet), c->getValues(evalData, normSet), p->getValues(evalData, normSet));
94}
95
96////////////////////////////////////////////////////////////////////////////////
97
98Int_t RooArgusBG::getAnalyticalIntegral(RooArgSet& allVars, RooArgSet& analVars, const char* /*rangeName*/) const
99{
100 if (p.arg().isConstant()) {
101 // We can integrate over m if power = 0.5
102 if (matchArgs(allVars,analVars,m) && p == 0.5) return 1;
103 }
104 return 0;
105
106}
107
108////////////////////////////////////////////////////////////////////////////////
109
110Double_t RooArgusBG::analyticalIntegral(Int_t code, const char* rangeName) const
111{
112 R__ASSERT(code==1);
113 // Formula for integration over m when p=0.5
114 static const Double_t pi = atan2(0.0,-1.0);
115 Double_t min = (m.min(rangeName) < m0) ? m.min(rangeName) : m0;
116 Double_t max = (m.max(rangeName) < m0) ? m.max(rangeName) : m0;
117 Double_t f1 = (1.-TMath::Power(min/m0,2));
118 Double_t f2 = (1.-TMath::Power(max/m0,2));
119 Double_t aLow, aHigh ;
120 if ( c < 0. ) {
121 aLow = -0.5*m0*m0*(exp(c*f1)*sqrt(f1)/c + 0.5/TMath::Power(-c,1.5)*sqrt(pi)*RooMath::erf(sqrt(-c*f1)));
122 aHigh = -0.5*m0*m0*(exp(c*f2)*sqrt(f2)/c + 0.5/TMath::Power(-c,1.5)*sqrt(pi)*RooMath::erf(sqrt(-c*f2)));
123 } else if ( c == 0. ) {
124 aLow = -m0*m0/3.*f1*sqrt(f1);
125 aHigh = -m0*m0/3.*f1*sqrt(f2);
126 } else {
127 aLow = 0.5*m0*m0*exp(c*f1)/(c*sqrt(c)) * (0.5*sqrt(pi)*(RooMath::faddeeva(sqrt(c*f1))).imag() - sqrt(c*f1));
128 aHigh = 0.5*m0*m0*exp(c*f2)/(c*sqrt(c)) * (0.5*sqrt(pi)*(RooMath::faddeeva(sqrt(c*f2))).imag() - sqrt(c*f2));
129 }
130 Double_t area = aHigh - aLow;
131 //cout << "c = " << c << "aHigh = " << aHigh << " aLow = " << aLow << " area = " << area << endl ;
132 return area;
133
134}
#define c(i)
Definition RSha256.hxx:101
#define ClassImp(name)
Definition Rtypes.h:364
#define R__ASSERT(e)
Definition TError.h:120
char name[80]
Definition TGX11.cxx:110
double atan2(double, double)
double sqrt(double)
double exp(double)
Bool_t isConstant() const
Check if the "Constant" attribute is set.
Definition RooAbsArg.h:380
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition RooAbsReal.h:61
virtual RooSpan< const double > getValues(RooBatchCompute::RunContext &evalData, const RooArgSet *normSet=nullptr) const
by this change, please consult the release notes for ROOT 6.24 for guidance on how to make this trans...
Bool_t 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:29
RooArgusBG is a RooAbsPdf implementation describing the ARGUS background shape.
Definition RooArgusBG.h:22
RooRealProxy m
Definition RooArgusBG.h:37
Double_t evaluate() const
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=0) const
Interface function getAnalyticalIntergral advertises the analytical integrals that are supported.
RooSpan< double > evaluateSpan(RooBatchCompute::RunContext &evalData, const RooArgSet *normSet) const
Compute multiple values of Argus distribution.
RooRealProxy c
Definition RooArgusBG.h:39
RooRealProxy p
Definition RooArgusBG.h:40
Double_t analyticalIntegral(Int_t code, const char *rangeName=0) const
Implements the actual analytical integral(s) advertised by getAnalyticalIntegral.
RooRealProxy m0
Definition RooArgusBG.h:38
virtual RooSpan< double > computeArgusBG(const RooAbsReal *, RunContext &, RooSpan< const double > m, RooSpan< const double > m0, RooSpan< const double > c, RooSpan< const double > p)=0
static std::complex< double > erf(const std::complex< double > z)
complex erf function
Definition RooMath.cxx:580
static std::complex< double > faddeeva(std::complex< double > z)
evaluate Faddeeva function for complex argument
Definition RooMath.cxx:542
RooRealConstant provides static functions to create and keep track of RooRealVar constants.
RooRealVar represents a variable that can be changed from the outside.
Definition RooRealVar.h:39
A simple container to hold a batch of data values.
Definition RooSpan.h:34
double min(const char *rname=0) const
Query lower limit of range. This requires the payload to be RooAbsRealLValue or derived.
double max(const char *rname=0) const
Query upper limit of range. This requires the payload to be RooAbsRealLValue or derived.
const T & arg() const
Return reference to object held in proxy.
TF1 * f1
Definition legend1.C:11
R__EXTERN RooBatchComputeInterface * dispatch
This dispatch pointer points to an implementation of the compute library, provided one has been loade...
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Definition TMath.h:735
This struct enables passing computation data around between elements of a computation graph.
Definition RunContext.h:31
auto * m
Definition textangle.C:8