00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "RooRarFit/rarVersion.hh"
00013
00014 #include "Riostream.h"
00015 #include "TMath.h"
00016
00017 #include "RooRarFit/RooBallack.hh"
00018 #include "RooFitCore/RooRealVar.hh"
00019 #include "RooFitCore/RooRealConstant.hh"
00020
00021 ClassImp(RooBallack)
00022
00023 RooBallack::RooBallack(const char *name, const char *title,
00024 RooAbsReal& _x, RooAbsReal& _mean,
00025 RooAbsReal& _width, RooAbsReal& _tail,
00026 RooAbsReal& _alpha, RooAbsReal& _n)
00027 :
00028 RooAbsPdf(name, title),
00029 x("x", "x", this, _x),
00030 mean("mean", "mean", this, _mean),
00031 width("width", "width", this, _width),
00032 tail("tail", "tail", this, _tail),
00033 alpha("alpha", "alpha", this, _alpha),
00034 n("n", "n", this, _n)
00035 {
00036 }
00037
00038 RooBallack::RooBallack(const RooBallack& other, const char* name) :
00039 RooAbsPdf(other, name),
00040 x("x", this, other.x),
00041 mean("mean", this, other.mean),
00042 width("width", this, other.width),
00043 tail("tail", this, other.tail),
00044 alpha("alpha", this, other.alpha),
00045 n("n", this, other.n)
00046 {
00047 }
00048
00049 Double_t RooBallack::evaluate() const
00050 {
00051
00052
00053 double qa=0,qb=0,qc=0,qx=0,qy=0;
00054
00055 double A=0,B=0,C=0,a=0,c1=0,c2=0;
00056 double sigTail=0, sigMean=0;
00057
00058 a = sqrt(log(4.));
00059
00060 const Double_t lowlimit = 1.0e-7;
00061
00062
00063 if(x<0) {
00064 sigTail = -tail;
00065 sigMean = -mean;
00066 }
00067 else {
00068 sigTail = tail;
00069 sigMean = mean;
00070 }
00071
00072 if(TMath::Abs(tail) < lowlimit) {
00073 qc = 0.5*TMath::Power(((x-sigMean)/width),2);
00074 A = 1.e7;
00075 }
00076 else {
00077 qa = sigTail*a;
00078 qb = sinh(qa)/qa;
00079 qx = (x-sigMean)/width*qb;
00080 qy = 1.+sigTail*qx;
00081
00082
00083 if( qy > lowlimit) {
00084 qc = 0.5*(TMath::Power((log(qy)/sigTail),2) + sigTail*sigTail);
00085 }
00086 else {
00087 qc = 15.0;
00088 }
00089
00090
00091 A = alpha*width*a/sinh(sigTail*a);
00092 }
00093
00094
00095 if( x>=sigMean-fabs(A) && sigTail<0 ) {
00096 return exp(-qc);
00097 }
00098 if( x<=sigMean+fabs(A) && sigTail>0 ) {
00099 return exp(-qc);
00100 }
00101 else {
00102 if( (1+alpha) > lowlimit ) {
00103 B = -0.5*(TMath::Power( (log(1+alpha)/sigTail), 2 ) + sigTail*sigTail);
00104 }
00105 else {
00106 B = -15.0;
00107 }
00108
00109 C = n*A*sigTail*sigTail*(1+alpha)*(TMath::Power( (sigMean+A), n-1. ));
00110 c2 = - alpha*log(1+alpha)*exp(B)/C;
00111 c1 = exp(B) - c2*(TMath::Power( (sigMean+A), n));
00112
00113 return c1 + c2*(TMath::Power(x,n));
00114 }
00115
00116 }