Logo ROOT  
Reference Guide
RooGaussModel.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitModels *
4  * File: $Id: RooGaussModel.h,v 1.21 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_GAUSS_MODEL
17 #define ROO_GAUSS_MODEL
18 
19 #include "RooResolutionModel.h"
20 #include "RooRealProxy.h"
21 #include "RooMath.h"
22 
23 #include <cmath>
24 #include <complex>
25 
27 public:
28 
38  enum BasisSign { Both=0, Plus=+1, Minus=-1 } ;
39 
40  // Constructors, assignment etc
42  RooGaussModel(const char *name, const char *title, RooAbsRealLValue& x,
44  RooGaussModel(const char *name, const char *title, RooAbsRealLValue& x,
46  RooGaussModel(const char *name, const char *title, RooAbsRealLValue& x,
47  RooAbsReal& mean, RooAbsReal& sigma, RooAbsReal& meanSF, RooAbsReal& sigmaSF) ;
48  RooGaussModel(const RooGaussModel& other, const char* name=0);
49  virtual TObject* clone(const char* newname) const { return new RooGaussModel(*this,newname) ; }
50  virtual ~RooGaussModel();
51 
52  virtual Int_t basisCode(const char* name) const ;
53  virtual Int_t getAnalyticalIntegral(RooArgSet& allVars, RooArgSet& analVars, const char* rangeName=0) const ;
54  virtual Double_t analyticalIntegral(Int_t code, const char* rangeName) const ;
55 
56  Int_t getGenerator(const RooArgSet& directVars, RooArgSet &generateVars, Bool_t staticInitOK=kTRUE) const;
57  void generateEvent(Int_t code);
58 
60 
61  void advertiseAymptoticIntegral(Bool_t flag) { _asympInt = flag ; } // added FMV,07/24/03
62 
63 protected:
64 
65  virtual Double_t evaluate() const ;
66  static std::complex<Double_t> evalCerfApprox(Double_t swt, Double_t u, Double_t c);
67 
68  // Calculate exp(-u^2) cwerf(swt*c + i(u+c)), taking care of numerical instabilities
69  static inline std::complex<Double_t> evalCerf(Double_t swt, Double_t u, Double_t c)
70  {
71  std::complex<Double_t> z(swt*c,u+c);
72  return (z.imag()>-4.0) ? (std::exp(-u*u)*RooMath::faddeeva_fast(z)) : evalCerfApprox(swt,u,c);
73  }
74 
75  // Calculate common normalization factors
76  std::complex<Double_t> evalCerfInt(Double_t sign, Double_t wt, Double_t tau, Double_t umin, Double_t umax, Double_t c) const;
77 
79 
80  Bool_t _asympInt ; // added FMV,07/24/03
81 
86 
87  ClassDef(RooGaussModel,1) // Gaussian Resolution Model
88 };
89 
90 #endif
c
#define c(i)
Definition: RSha256.hxx:101
RooMath::faddeeva_fast
static std::complex< double > faddeeva_fast(std::complex< double > z)
evaluate Faddeeva function for complex argument (fast version)
Definition: RooMath.cxx:549
RooGaussModel::linBasis
@ linBasis
Definition: RooGaussModel.h:37
RooGaussModel::_asympInt
Bool_t _asympInt
Definition: RooGaussModel.h:80
RooGaussModel::getAnalyticalIntegral
virtual Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=0) const
Interface function getAnalyticalIntergral advertises the analytical integrals that are supported.
Definition: RooGaussModel.cxx:237
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
RooGaussModel::Minus
@ Minus
Definition: RooGaussModel.h:38
RooGaussModel::~RooGaussModel
virtual ~RooGaussModel()
Destructor.
Definition: RooGaussModel.cxx:99
RooGaussModel::sinBasisPlus
@ sinBasisPlus
Definition: RooGaussModel.h:30
RooGaussModel::noBasis
@ noBasis
Definition: RooGaussModel.h:29
RooGaussModel::ssf
RooRealProxy ssf
Definition: RooGaussModel.h:85
exp
double exp(double)
RooResolutionModel.h
RooGaussModel::expBasisMinus
@ expBasisMinus
Definition: RooGaussModel.h:29
RooGaussModel::cosBasisSum
@ cosBasisSum
Definition: RooGaussModel.h:31
RooGaussModel::getGenerator
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...
Definition: RooGaussModel.cxx:479
RooAbsReal
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:61
RooGaussModel::sinhBasisSum
@ sinhBasisSum
Definition: RooGaussModel.h:35
RooGaussModel::sinBasisMinus
@ sinBasisMinus
Definition: RooGaussModel.h:30
RooGaussModel::sinhBasisPlus
@ sinhBasisPlus
Definition: RooGaussModel.h:35
RooGaussModel::sinBasisSum
@ sinBasisSum
Definition: RooGaussModel.h:30
RooGaussModel::evaluate
virtual Double_t evaluate() const
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
Definition: RooGaussModel.cxx:129
bool
RooGaussModel::evalCerf
static std::complex< Double_t > evalCerf(Double_t swt, Double_t u, Double_t c)
Definition: RooGaussModel.h:69
RooGaussModel::generateEvent
void generateEvent(Int_t code)
Interface for generation of an event using the algorithm corresponding to the specified code.
Definition: RooGaussModel.cxx:487
RooGaussModel::linBasisPlus
@ linBasisPlus
Definition: RooGaussModel.h:32
RooGaussModel::evalCerfApprox
static std::complex< Double_t > evalCerfApprox(Double_t swt, Double_t u, Double_t c)
use the approximation: erf(z) = exp(-z*z)/(std::sqrt(pi)*z) to explicitly cancel the divergent exp(y*...
Definition: RooGaussModel.cxx:447
RooGaussModel::Plus
@ Plus
Definition: RooGaussModel.h:38
RooGaussModel::evalCerfInt
std::complex< Double_t > evalCerfInt(Double_t sign, Double_t wt, Double_t tau, Double_t umin, Double_t umax, Double_t c) const
Definition: RooGaussModel.cxx:463
RooGaussModel::_flatSFInt
Bool_t _flatSFInt
Definition: RooGaussModel.h:78
RooGaussModel::coshBasisMinus
@ coshBasisMinus
Definition: RooGaussModel.h:34
RooGaussModel::coshBasis
@ coshBasis
Definition: RooGaussModel.h:37
RooGaussModel::expBasisPlus
@ expBasisPlus
Definition: RooGaussModel.h:29
RooGaussModel::advertiseAymptoticIntegral
void advertiseAymptoticIntegral(Bool_t flag)
Definition: RooGaussModel.h:61
RooResolutionModel::x
RooTemplateProxy< RooAbsRealLValue > x
Definition: RooResolutionModel.h:65
RooGaussModel::analyticalIntegral
virtual Double_t analyticalIntegral(Int_t code, const char *rangeName) const
Implements the actual analytical integral(s) advertised by getAnalyticalIntegral.
Definition: RooGaussModel.cxx:288
RooResolutionModel
RooResolutionModel is the base class for PDFs that represent a resolution model that can be convolute...
Definition: RooResolutionModel.h:26
RooGaussModel::sinBasis
@ sinBasis
Definition: RooGaussModel.h:36
RooGaussModel::BasisSign
BasisSign
Definition: RooGaussModel.h:38
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
RooGaussModel::none
@ none
Definition: RooGaussModel.h:36
RooGaussModel::msf
RooRealProxy msf
Definition: RooGaussModel.h:84
RooRealProxy.h
RooGaussModel::cosBasisPlus
@ cosBasisPlus
Definition: RooGaussModel.h:31
RooGaussModel::expBasis
@ expBasis
Definition: RooGaussModel.h:36
RooGaussModel::sinhBasis
@ sinhBasis
Definition: RooGaussModel.h:37
RooGaussModel::clone
virtual TObject * clone(const char *newname) const
Definition: RooGaussModel.h:49
RooGaussModel::cosBasis
@ cosBasis
Definition: RooGaussModel.h:36
RooGaussModel::basisCode
virtual Int_t basisCode(const char *name) const
Definition: RooGaussModel.cxx:105
RooTemplateProxy< RooAbsReal >
RooGaussModel::BasisType
BasisType
Definition: RooGaussModel.h:36
Double_t
double Double_t
Definition: RtypesCore.h:59
RooGaussModel::quadBasisPlus
@ quadBasisPlus
Definition: RooGaussModel.h:33
RooGaussModel::RooGaussModel
RooGaussModel()
Definition: RooGaussModel.h:41
RooGaussModel::quadBasis
@ quadBasis
Definition: RooGaussModel.h:37
RooGaussModel::expBasisSum
@ expBasisSum
Definition: RooGaussModel.h:29
RooGaussModel::Both
@ Both
Definition: RooGaussModel.h:38
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
name
char name[80]
Definition: TGX11.cxx:110
RooGaussModel::mean
RooRealProxy mean
Definition: RooGaussModel.h:82
RooGaussModel::advertiseFlatScaleFactorIntegral
void advertiseFlatScaleFactorIntegral(Bool_t flag)
Definition: RooGaussModel.h:59
RooGaussModel
Class RooGaussModel implements a RooResolutionModel that models a Gaussian distribution.
Definition: RooGaussModel.h:26
RooAbsRealLValue
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
Definition: RooAbsRealLValue.h:31
RooGaussModel::sinhBasisMinus
@ sinhBasisMinus
Definition: RooGaussModel.h:35
RooMath.h
RooGaussModel::RooGaussBasis
RooGaussBasis
Definition: RooGaussModel.h:29
RooGaussModel::sigma
RooRealProxy sigma
Definition: RooGaussModel.h:83
RooGaussModel::coshBasisPlus
@ coshBasisPlus
Definition: RooGaussModel.h:34
RooGaussModel::cosBasisMinus
@ cosBasisMinus
Definition: RooGaussModel.h:31
RooArgSet
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:29
RooGaussModel::coshBasisSum
@ coshBasisSum
Definition: RooGaussModel.h:34
int