00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "RooFit.h"
00028
00029 #include "Riostream.h"
00030 #include "Riostream.h"
00031 #include <math.h>
00032 #include "TMath.h"
00033
00034 #include "RooDstD0BG.h"
00035 #include "RooAbsReal.h"
00036 #include "RooRealVar.h"
00037 #include "RooIntegrator1D.h"
00038 #include "RooAbsFunc.h"
00039
00040 ClassImp(RooDstD0BG)
00041
00042 static const char rcsid[] =
00043 "$Id: RooDstD0BG.cxx 24286 2008-06-16 15:47:04Z wouter $";
00044
00045
00046
00047 RooDstD0BG::RooDstD0BG(const char *name, const char *title,
00048 RooAbsReal& _dm, RooAbsReal& _dm0,
00049 RooAbsReal& _c, RooAbsReal& _a, RooAbsReal& _b) :
00050 RooAbsPdf(name,title),
00051 dm("dm","Dstar-D0 Mass Diff",this, _dm),
00052 dm0("dm0","Threshold",this, _dm0),
00053 C("C","Shape Parameter",this, _c),
00054 A("A","Shape Parameter 2",this, _a),
00055 B("B","Shape Parameter 3",this, _b)
00056 {
00057 }
00058
00059
00060
00061 RooDstD0BG::RooDstD0BG(const RooDstD0BG& other, const char *name) :
00062 RooAbsPdf(other,name), dm("dm",this,other.dm), dm0("dm0",this,other.dm0),
00063 C("C",this,other.C), A("A",this,other.A), B("B",this,other.B)
00064 {
00065 }
00066
00067
00068
00069 Double_t RooDstD0BG::evaluate() const
00070 {
00071 Double_t arg= dm- dm0;
00072 if (arg <= 0 ) return 0;
00073 Double_t ratio= dm/dm0;
00074 Double_t val= (1- exp(-arg/C))* TMath::Power(ratio, A) + B*(ratio-1);
00075
00076 return (val > 0 ? val : 0) ;
00077 }
00078
00079
00080
00081 Int_t RooDstD0BG::getAnalyticalIntegral(RooArgSet& , RooArgSet& , const char* ) const
00082 {
00083
00084 return 0 ;
00085 }
00086
00087
00088
00089 Double_t RooDstD0BG::analyticalIntegral(Int_t code, const char* rangeName) const
00090 {
00091 switch(code) {
00092 case 1:
00093 {
00094 Double_t min= dm.min(rangeName);
00095 Double_t max= dm.max(rangeName);
00096 if (max <= dm0 ) return 0;
00097 else if (min < dm0) min = dm0;
00098
00099 Bool_t doNumerical= kFALSE;
00100 if ( A != 0 ) doNumerical= kTRUE;
00101 else if (B < 0) {
00102
00103
00104
00105
00106
00107 if ( 1- exp(-(max-dm0)/C) + B*(max/dm0 -1) < 0) doNumerical= kTRUE;
00108 }
00109 if ( ! doNumerical ) {
00110 return (max-min)+ C* exp(dm0/C)* (exp(-max/C)- exp(-min/C)) +
00111 B * (0.5* (max*max - min*min)/dm0 - (max- min));
00112 } else {
00113
00114
00115
00116
00117
00118 RooArgSet vset(dm.arg(),"vset");
00119 RooAbsFunc *func= bindVars(vset);
00120 RooIntegrator1D integrator(*func,min,max);
00121 return integrator.integral();
00122 }
00123 }
00124 }
00125
00126 assert(0) ;
00127 return 0 ;
00128 }