Logo ROOT  
Reference Guide
RooGExpModel.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitModels *
4 * File: $Id: RooGExpModel.h,v 1.16 2007/05/11 09:13:07 verkerke Exp $
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#ifndef ROO_GEXP_MODEL
17#define ROO_GEXP_MODEL
18
19#include <cmath>
20#include <complex>
21
22#include "Rtypes.h"
23#include "RooResolutionModel.h"
24#include "RooRealProxy.h"
25#include "RooMath.h"
26
28public:
29
35
36
37
39 enum BasisSign { Both=0, Plus=+1, Minus=-1 } ;
40 enum Type { Normal, Flipped };
41
42 // Constructors, assignment etc
43 inline RooGExpModel() {
44 // coverity[UNINIT_CTOR]
45 }
46 RooGExpModel(const char *name, const char *title, RooRealVar& x,
49
50 RooGExpModel(const char *name, const char *title, RooRealVar& x,
52 RooAbsReal& srSF,
54
55 RooGExpModel(const char *name, const char *title, RooRealVar& x,
57 RooAbsReal& sigmaSF, RooAbsReal& rlifeSF,
59
60 RooGExpModel(const RooGExpModel& other, const char* name=0);
61 virtual TObject* clone(const char* newname) const { return new RooGExpModel(*this,newname) ; }
62 virtual ~RooGExpModel();
63
64 virtual Int_t basisCode(const char* name) const ;
65 virtual Int_t getAnalyticalIntegral(RooArgSet& allVars, RooArgSet& analVars, const char* rangeName=0) const ;
66 virtual Double_t analyticalIntegral(Int_t code, const char* rangeName=0) const ;
67
68 Int_t getGenerator(const RooArgSet& directVars, RooArgSet &generateVars, Bool_t staticInitOK=kTRUE) const;
69 void generateEvent(Int_t code);
70
72
73 void advertiseAsymptoticIntegral(Bool_t flag) { _asympInt = flag ; } // added FMV,07/24/03
74
75protected:
76
77 Double_t logErfC(Double_t x) const ;
78
79 //Double_t calcDecayConv(Double_t sign, Double_t tau, Double_t sig, Double_t rtau) const ;
80 Double_t calcDecayConv(Double_t sign, Double_t tau, Double_t sig, Double_t rtau, Double_t fsign) const ;
81 // modified FMV,08/13/03
82 std::complex<Double_t> calcSinConv(Double_t sign, Double_t sig, Double_t tau, Double_t omega, Double_t rtau, Double_t fsign) const ;
83 Double_t calcSinConv(Double_t sign, Double_t sig, Double_t tau, Double_t rtau, Double_t fsign) const ;
84 std::complex<Double_t> calcSinConvNorm(Double_t sign, Double_t tau, Double_t omega,
85 Double_t sig, Double_t rtau, Double_t fsign, const char* rangeName) const ; // modified FMV,07/24/03
87 Double_t sig, Double_t rtau, Double_t fsign, const char* rangeName) const ; // added FMV,08/18/03
88 //Double_t calcSinhConv(Double_t sign, Double_t sign1, Double_t sign2, Double_t tau, Double_t dgamma, Double_t sig, Double_t rtau, Double_t fsign) const ;
89 //Double_t calcCoshConv(Double_t sign, Double_t tau, Double_t dgamma, Double_t sig, Double_t rtau, Double_t fsign) const ;
90 virtual Double_t evaluate() const ;
91 static std::complex<Double_t> evalCerfApprox(Double_t swt, Double_t u, Double_t c);
92
93 // Calculate exp(-u^2) cwerf(swt*c + i(u+c)), taking care of numerical instabilities
94 static inline std::complex<Double_t> evalCerf(Double_t swt, Double_t u, Double_t c)
95 {
96 std::complex<Double_t> z(swt*c,u+c);
97 return (z.imag()>-4.0) ? RooMath::faddeeva_fast(z)*std::exp(-u*u) : evalCerfApprox(swt,u,c) ;
98 }
99
100 // Calculate Re(exp(-u^2) cwerf(i(u+c)))
101 // added FMV, 08/17/03
103 Double_t expArg = u*2*c+c*c ;
104 if (expArg<300) {
105 return exp(expArg) * RooMath::erfc(u+c);
106 } else {
107 return exp(expArg+logErfC(u+c));
108 }
109 }
110
111 // Calculate common normalization factors
112 // added FMV,07/24/03
113 std::complex<Double_t> evalCerfInt(Double_t sign, Double_t wt, Double_t tau, Double_t umin, Double_t umax, Double_t c) const ;
114 Double_t evalCerfInt(Double_t sign, Double_t tau, Double_t umin, Double_t umax, Double_t c) const ;
115
123 Bool_t _asympInt ; // added FMV,07/24/03
124
125 ClassDef(RooGExpModel,1) // Gauss (x) Exponential resolution model
126};
127
128#endif
#define c(i)
Definition: RSha256.hxx:101
int Int_t
Definition: RtypesCore.h:41
const Bool_t kFALSE
Definition: RtypesCore.h:88
bool Bool_t
Definition: RtypesCore.h:59
double Double_t
Definition: RtypesCore.h:55
const Bool_t kTRUE
Definition: RtypesCore.h:87
#define ClassDef(name, id)
Definition: Rtypes.h:326
char name[80]
Definition: TGX11.cxx:109
int type
Definition: TGX11.cxx:120
double exp(double)
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:59
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:28
Class RooGExpModel is a RooResolutionModel implementation that models a resolution function that is t...
Definition: RooGExpModel.h:27
Double_t logErfC(Double_t x) const
Approximation of the log of the complex error function.
RooRealProxy ssf
Definition: RooGExpModel.h:118
static std::complex< Double_t > evalCerf(Double_t swt, Double_t u, Double_t c)
Definition: RooGExpModel.h:94
virtual Int_t basisCode(const char *name) const
void advertiseFlatScaleFactorIntegral(Bool_t flag)
Definition: RooGExpModel.h:71
virtual TObject * clone(const char *newname) const
Definition: RooGExpModel.h:61
std::complex< Double_t > calcSinConvNorm(Double_t sign, Double_t tau, Double_t omega, Double_t sig, Double_t rtau, Double_t fsign, const char *rangeName) const
old code (asymptotic normalization only) std::complex<Double_t> z(1/tau,sign*omega); return z*2/(omeg...
Bool_t _flatSFInt
Definition: RooGExpModel.h:122
virtual ~RooGExpModel()
Destructor.
RooRealProxy rlife
Definition: RooGExpModel.h:117
static std::complex< Double_t > evalCerfApprox(Double_t swt, Double_t u, Double_t c)
use the approximation: erf(z) = exp(-z*z)/(sqrt(pi)*z) to explicitly cancel the divergent exp(y*y) be...
Double_t evalCerfRe(Double_t u, Double_t c) const
Definition: RooGExpModel.h:102
RooRealProxy sigma
Definition: RooGExpModel.h:116
void advertiseAsymptoticIntegral(Bool_t flag)
Definition: RooGExpModel.h:73
virtual Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=0) const
Interface function getAnalyticalIntergral advertises the analytical integrals that are supported.
virtual Double_t analyticalIntegral(Int_t code, const char *rangeName=0) const
Implements the actual analytical integral(s) advertised by getAnalyticalIntegral.
std::complex< Double_t > evalCerfInt(Double_t sign, Double_t wt, Double_t tau, Double_t umin, Double_t umax, Double_t c) const
RooRealProxy rsf
Definition: RooGExpModel.h:119
void generateEvent(Int_t code)
Interface for generation of an event using the algorithm corresponding to the specified code.
Int_t getGenerator(const RooArgSet &directVars, RooArgSet &generateVars, Bool_t staticInitOK=kTRUE) const
Load generatedVars with the subset of directVars that we can generate events for, and return a code t...
virtual Double_t evaluate() const
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
Bool_t _asympInt
Definition: RooGExpModel.h:123
Double_t calcDecayConv(Double_t sign, Double_t tau, Double_t sig, Double_t rtau, Double_t fsign) const
std::complex< Double_t > calcSinConv(Double_t sign, Double_t sig, Double_t tau, Double_t omega, Double_t rtau, Double_t fsign) const
static std::complex< double > erfc(const std::complex< double > z)
complex erfc function
Definition: RooMath.cxx:556
static std::complex< double > faddeeva_fast(std::complex< double > z)
evaluate Faddeeva function for complex argument (fast version)
Definition: RooMath.cxx:549
RooRealVar represents a variable that can be changed from the outside.
Definition: RooRealVar.h:35
RooResolutionModel is the base class for PDFs that represent a resolution model that can be convolute...
Mother of all ROOT objects.
Definition: TObject.h:37