00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "RooFit.h"
00025
00026 #include "Riostream.h"
00027 #include "Riostream.h"
00028 #include <math.h>
00029
00030 #include "RooExponential.h"
00031 #include "RooRealVar.h"
00032
00033 ClassImp(RooExponential)
00034
00035
00036
00037 RooExponential::RooExponential(const char *name, const char *title,
00038 RooAbsReal& _x, RooAbsReal& _c) :
00039 RooAbsPdf(name, title),
00040 x("x","Dependent",this,_x),
00041 c("c","Exponent",this,_c)
00042 {
00043 }
00044
00045
00046
00047 RooExponential::RooExponential(const RooExponential& other, const char* name) :
00048 RooAbsPdf(other, name), x("x",this,other.x), c("c",this,other.c)
00049 {
00050 }
00051
00052
00053
00054 Double_t RooExponential::evaluate() const{
00055
00056 return exp(c*x);
00057 }
00058
00059
00060
00061 Int_t RooExponential::getAnalyticalIntegral(RooArgSet& allVars, RooArgSet& analVars, const char* ) const
00062 {
00063 if (matchArgs(allVars,analVars,x)) return 1 ;
00064 return 0 ;
00065 }
00066
00067
00068
00069 Double_t RooExponential::analyticalIntegral(Int_t code, const char* rangeName) const
00070 {
00071 switch(code) {
00072 case 1:
00073 {
00074 Double_t ret(0) ;
00075 if(c == 0.0) {
00076 ret = (x.max(rangeName) - x.min(rangeName));
00077 } else {
00078 ret = ( exp( c*x.max(rangeName) ) - exp( c*x.min(rangeName) ) )/c;
00079 }
00080
00081
00082 return ret ;
00083 }
00084 }
00085
00086 assert(0) ;
00087 return 0 ;
00088 }
00089