Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooCBShape.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 RooCBShape
18 \ingroup Roofit
19
20PDF implementing the Crystal Ball line shape.
21**/
22
23#include "RooCBShape.h"
24
25#include "RooRealVar.h"
26#include "RooMath.h"
27#include "RooBatchCompute.h"
28
30
31#include "TMath.h"
32
33#include <cmath>
34
36
37////////////////////////////////////////////////////////////////////////////////
38
39RooCBShape::RooCBShape(const char *name, const char *title,
40 RooAbsReal& _m, RooAbsReal& _m0, RooAbsReal& _sigma,
41 RooAbsReal& _alpha, RooAbsReal& _n) :
42 RooAbsPdf(name, title),
43 m("m", "Dependent", this, _m),
44 m0("m0", "M0", this, _m0),
45 sigma("sigma", "Sigma", this, _sigma),
46 alpha("alpha", "Alpha", this, _alpha),
47 n("n", "Order", this, _n)
48{
49}
50
51////////////////////////////////////////////////////////////////////////////////
52
53RooCBShape::RooCBShape(const RooCBShape& other, const char* name) :
54 RooAbsPdf(other, name), m("m", this, other.m), m0("m0", this, other.m0),
55 sigma("sigma", this, other.sigma), alpha("alpha", this, other.alpha),
56 n("n", this, other.n)
57{
58}
59
60////////////////////////////////////////////////////////////////////////////////
61
63{
65}
66
67////////////////////////////////////////////////////////////////////////////////
68/// Compute multiple values of Crystal ball Shape distribution.
70{
72 {ctx.at(m), ctx.at(m0), ctx.at(sigma), ctx.at(alpha), ctx.at(n)});
73}
74
75////////////////////////////////////////////////////////////////////////////////
76
77Int_t RooCBShape::getAnalyticalIntegral(RooArgSet& allVars, RooArgSet& analVars, const char* /*rangeName*/) const
78{
79 if( matchArgs(allVars,analVars,m) )
80 return 1 ;
81
82 return 0;
83}
84
85////////////////////////////////////////////////////////////////////////////////
86
87double RooCBShape::analyticalIntegral(Int_t /*code*/, const char *rangeName) const
88{
89 using namespace RooFit::Detail::MathFuncs;
90 return cbShapeIntegral(m.min(rangeName), m.max(rangeName), m0, sigma, alpha, n);
91}
92
93////////////////////////////////////////////////////////////////////////////////
94/// Advertise that we know the maximum of self for given (m0,alpha,n,sigma)
95
97{
98 RooArgSet dummy ;
99
100 if (matchArgs(vars,dummy,m)) {
101 return 1 ;
102 }
103 return 0 ;
104}
105
106////////////////////////////////////////////////////////////////////////////////
107
108double RooCBShape::maxVal(Int_t code) const
109{
110 R__ASSERT(code==1) ;
111
112 // The maximum value for given (m0,alpha,n,sigma)
113 // is 1./ Integral in the variable range
114 return 1.0/analyticalIntegral(1) ;
115}
#define ClassImp(name)
Definition Rtypes.h:382
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
Definition TError.h:125
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
PDF implementing the Crystal Ball line shape.
Definition RooCBShape.h:24
Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=nullptr) const override
Interface function getAnalyticalIntergral advertises the analytical integrals that are supported.
void doEval(RooFit::EvalContext &) const override
Compute multiple values of Crystal ball Shape distribution.
double analyticalIntegral(Int_t, const char *rangeName=nullptr) const override
Implements the actual analytical integral(s) advertised by getAnalyticalIntegral.
RooRealProxy n
Definition RooCBShape.h:55
RooRealProxy m0
Definition RooCBShape.h:52
RooRealProxy m
Definition RooCBShape.h:51
RooRealProxy sigma
Definition RooCBShape.h:53
double evaluate() const override
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
RooRealProxy alpha
Definition RooCBShape.h:54
Int_t getMaxVal(const RooArgSet &vars) const override
Advertise that we know the maximum of self for given (m0,alpha,n,sigma)
double maxVal(Int_t code) const override
Return maximum value for set of observables identified by code assigned in getMaxVal.
std::span< double > output()
RooBatchCompute::Config config(RooAbsArg const *arg) const
double max(const char *rname=nullptr) const
Query upper limit of range. This requires the payload to be RooAbsRealLValue or derived.
double min(const char *rname=nullptr) const
Query lower limit of range. This requires the payload to be RooAbsRealLValue or derived.
const Double_t sigma
const Int_t n
Definition legend1.C:16
void compute(Config cfg, Computer comp, std::span< double > output, VarSpan vars, ArgSpan extraArgs={})
double cbShape(double m, double m0, double sigma, double alpha, double n)
Definition MathFuncs.h:387
TMarker m
Definition textangle.C:8