Logo ROOT   6.08/07
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 
28 public:
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,
48  Bool_t nlo=kFALSE, Type type=Normal) ;
49 
50  RooGExpModel(const char *name, const char *title, RooRealVar& x,
51  RooAbsReal& sigma, RooAbsReal& rlife,
52  RooAbsReal& srSF,
53  Bool_t nlo=kFALSE, Type type=Normal) ;
54 
55  RooGExpModel(const char *name, const char *title, RooRealVar& x,
56  RooAbsReal& sigma, RooAbsReal& rlife,
57  RooAbsReal& sigmaSF, RooAbsReal& rlifeSF,
58  Bool_t nlo=kFALSE, Type type=Normal) ;
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 
75 protected:
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
102  inline Double_t evalCerfRe(Double_t u, Double_t c) const {
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) Expontial resolution model
126 };
127 
128 #endif
129 
130 
131 
132 
133 
Double_t logErfC(Double_t x) const
Approximation of the log of the complex error function.
return c
void generateEvent(Int_t code)
Interface for generation of anan event using the algorithm corresponding to the specified code...
virtual Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=0) const
Interface function getAnalyticalIntergral advertises the analytical integrals that are supported...
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
virtual Int_t basisCode(const char *name) const
void advertiseFlatScaleFactorIntegral(Bool_t flag)
Definition: RooGExpModel.h:71
#define ClassDef(name, id)
Definition: Rtypes.h:254
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...
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t tau
Definition: TRolke.cxx:630
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
RooRealVar represents a fundamental (non-derived) real valued object.
Definition: RooRealVar.h:37
RooRealProxy rsf
Definition: RooGExpModel.h:119
static std::complex< double > faddeeva_fast(std::complex< double > z)
evaluate Faddeeva function for complex argument (fast version)
Definition: RooMath.cxx:553
RooRealProxy ssf
Definition: RooGExpModel.h:118
Double_t calcDecayConv(Double_t sign, Double_t tau, Double_t sig, Double_t rtau, Double_t fsign) const
static std::complex< double > erfc(const std::complex< double > z)
complex erfc function
Definition: RooMath.cxx:560
Bool_t _flatSFInt
Definition: RooGExpModel.h:122
static std::complex< Double_t > evalCerf(Double_t swt, Double_t u, Double_t c)
Definition: RooGExpModel.h:94
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_t evalCerfRe(Double_t u, Double_t c) const
Definition: RooGExpModel.h:102
Bool_t _asympInt
Definition: RooGExpModel.h:123
virtual ~RooGExpModel()
Destructor.
int type
Definition: TGX11.cxx:120
virtual TObject * clone(const char *newname) const
Definition: RooGExpModel.h:61
RooRealProxy rlife
Definition: RooGExpModel.h:117
std::complex< Double_t > evalCerfInt(Double_t sign, Double_t wt, Double_t tau, Double_t umin, Double_t umax, Double_t c) const
Mother of all ROOT objects.
Definition: TObject.h:37
you should not use this method at all Int_t Int_t z
Definition: TRolke.cxx:630
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 > 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...
Class RooGExpModel is a RooResolutionModel implementation that models a resolution function that is t...
Definition: RooGExpModel.h:27
RooRealProxy is the concrete proxy for RooAbsReal objects A RooRealProxy is the general mechanism to ...
Definition: RooRealProxy.h:23
double exp(double)
const Bool_t kTRUE
Definition: Rtypes.h:91
void advertiseAsymptoticIntegral(Bool_t flag)
Definition: RooGExpModel.h:73
char name[80]
Definition: TGX11.cxx:109
RooRealProxy sigma
Definition: RooGExpModel.h:116
std::complex< Double_t > calcSinConv(Double_t sign, Double_t sig, Double_t tau, Double_t omega, Double_t rtau, Double_t fsign) const