Logo ROOT   6.10/09
Reference Guide
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 *
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 RooArgusBG
18  \ingroup Roofit
19 
20 RooArgusBG is a RooAbsPdf implementation describing the ARGUS background shape.
21 */
22 
23 #include "RooFit.h"
24 
25 #include "Riostream.h"
26 #include "Riostream.h"
27 #include <math.h>
28 
29 #include "RooArgusBG.h"
30 #include "RooRealVar.h"
31 #include "RooRealConstant.h"
32 #include "RooMath.h"
33 #include "TMath.h"
34 
35 #include "TError.h"
36 
37 using namespace std;
38 
40 
41 ////////////////////////////////////////////////////////////////////////////////
42 /// Constructor.
43 
44 RooArgusBG::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 
57 RooArgusBG::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 
70 RooArgusBG::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 
92 Int_t RooArgusBG::getAnalyticalIntegral(RooArgSet& allVars, RooArgSet& analVars, const char* /*rangeName*/) const
93 {
94  if (p.arg().isConstant()) {
95  // We can integrate over m if power = 0.5
96  if (matchArgs(allVars,analVars,m) && p == 0.5) return 1;
97  }
98  return 0;
99 
100 }
101 
102 ////////////////////////////////////////////////////////////////////////////////
103 
104 Double_t RooArgusBG::analyticalIntegral(Int_t code, const char* rangeName) const
105 {
106  R__ASSERT(code==1);
107  // Formula for integration over m when p=0.5
108  static const Double_t pi = atan2(0.0,-1.0);
109  Double_t min = (m.min(rangeName) < m0) ? m.min(rangeName) : m0;
110  Double_t max = (m.max(rangeName) < m0) ? m.max(rangeName) : m0;
111  Double_t f1 = (1.-TMath::Power(min/m0,2));
112  Double_t f2 = (1.-TMath::Power(max/m0,2));
113  Double_t aLow, aHigh ;
114  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)));
115  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)));
116  Double_t area = aHigh - aLow;
117  //cout << "c = " << c << "aHigh = " << aHigh << " aLow = " << aLow << " area = " << area << endl ;
118  return area;
119 
120 }
RooRealProxy m0
Definition: RooArgusBG.h:41
const double pi
Bool_t matchArgs(const RooArgSet &allDeps, RooArgSet &numDeps, const RooArgProxy &a) const
Utility function for use in getAnalyticalIntegral().
#define R__ASSERT(e)
Definition: TError.h:96
int Int_t
Definition: RtypesCore.h:41
STL namespace.
RooRealConstant provides static functions to create and keep track of RooRealVar constants.
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Definition: TMath.h:628
double sqrt(double)
RooArgusBG is a RooAbsPdf implementation describing the ARGUS background shape.
Definition: RooArgusBG.h:25
RooRealProxy c
Definition: RooArgusBG.h:42
Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=0) const
Interface function getAnalyticalIntergral advertises the analytical integrals that are supported...
Definition: RooArgusBG.cxx:92
RooRealVar represents a fundamental (non-derived) real valued object.
Definition: RooRealVar.h:36
TMarker * m
Definition: textangle.C:8
Double_t evaluate() const
Definition: RooArgusBG.cxx:81
Double_t analyticalIntegral(Int_t code, const char *rangeName=0) const
Implements the actual analytical integral(s) advertised by getAnalyticalIntegral. ...
Definition: RooArgusBG.cxx:104
#define ClassImp(name)
Definition: Rtypes.h:336
Double_t min(const char *rname=0) const
Definition: RooRealProxy.h:56
double Double_t
Definition: RtypesCore.h:55
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:53
double atan2(double, double)
Double_t max(const char *rname=0) const
Definition: RooRealProxy.h:57
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
Definition: RooAbsPdf.h:41
double f2(const double *x)
RooRealProxy p
Definition: RooArgusBG.h:43
TF1 * f1
Definition: legend1.C:11
static std::complex< double > erf(const std::complex< double > z)
complex erf function
Definition: RooMath.cxx:580
const RooAbsReal & arg() const
Definition: RooRealProxy.h:43
double exp(double)
Bool_t isConstant() const
Definition: RooAbsArg.h:266
RooRealProxy m
Definition: RooArgusBG.h:40