File indexing completed on 2024-04-06 12:24:13
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include "Riostream.h"
0016
0017 #include "RooCBExGaussShape.h"
0018 #include "RooAbsReal.h"
0019 #include "RooAbsCategory.h"
0020
0021 ClassImp(RooCBExGaussShape);
0022
0023 RooCBExGaussShape::RooCBExGaussShape(const char *name, const char *title,
0024 RooAbsReal& _m,
0025 RooAbsReal& _m0,
0026 RooAbsReal& _sigma,
0027 RooAbsReal& _alpha,
0028 RooAbsReal& _n,
0029 RooAbsReal& _sigma_2,
0030 RooAbsReal& _frac
0031 ) :
0032 RooAbsPdf(name,title),
0033 m("m","m",this,_m),
0034 m0(" m0"," m0",this,_m0),
0035 sigma(" sigma"," sigma",this,_sigma),
0036 alpha(" alpha"," alpha",this,_alpha),
0037 n(" n"," n",this,_n),
0038 sigma_2(" sigma_2"," sigma_2",this,_sigma_2),
0039 frac(" frac"," frac",this,_frac)
0040 {
0041 }
0042
0043
0044 RooCBExGaussShape::RooCBExGaussShape(const RooCBExGaussShape& other, const char* name) :
0045 RooAbsPdf(other,name),
0046 m("m",this,other.m),
0047 m0(" m0",this,other. m0),
0048 sigma(" sigma",this,other. sigma),
0049 alpha(" alpha",this,other. alpha),
0050 n(" n",this,other. n),
0051 sigma_2(" sigma_2",this,other. sigma_2),
0052 frac(" frac",this,other. frac)
0053 {
0054 }
0055
0056
0057
0058 Double_t RooCBExGaussShape::evaluate() const
0059 {
0060
0061
0062
0063 Double_t t = (m-m0)/sigma;
0064 Double_t t0 = (m-m0)/sigma_2;
0065 if (alpha < 0){
0066 t = -t;
0067 t0 = -t0;
0068 }
0069
0070 Double_t absAlpha = fabs((Double_t)alpha);
0071
0072 if (t >= -absAlpha) {
0073
0074 return frac*exp(-0.5*t*t) + (1.0-frac)*exp(-0.5*t0*t0);
0075
0076 }
0077 else {
0078 Double_t a = TMath::Power(n/absAlpha,n)*exp(-0.5*absAlpha*absAlpha);
0079 Double_t b= n/absAlpha - absAlpha;
0080
0081 return a/TMath::Power(b - t, n);
0082
0083 }
0084
0085
0086
0087
0088
0089 }
0090
0091
0092