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
00033 #include "RooBreitWigner.h"
00034 #include "RooAbsReal.h"
00035 #include "RooRealVar.h"
00036
00037
00038 ClassImp(RooBreitWigner)
00039
00040
00041
00042 RooBreitWigner::RooBreitWigner(const char *name, const char *title,
00043 RooAbsReal& _x, RooAbsReal& _mean,
00044 RooAbsReal& _width) :
00045 RooAbsPdf(name,title),
00046 x("x","Dependent",this,_x),
00047 mean("mean","Mean",this,_mean),
00048 width("width","Width",this,_width)
00049 {
00050 }
00051
00052
00053
00054
00055 RooBreitWigner::RooBreitWigner(const RooBreitWigner& other, const char* name) :
00056 RooAbsPdf(other,name), x("x",this,other.x), mean("mean",this,other.mean),
00057 width("width",this,other.width)
00058 {
00059 }
00060
00061
00062
00063
00064 Double_t RooBreitWigner::evaluate() const
00065 {
00066 Double_t arg= x - mean;
00067 return 1. / (arg*arg + 0.25*width*width);
00068 }
00069
00070
00071
00072
00073 Int_t RooBreitWigner::getAnalyticalIntegral(RooArgSet& allVars, RooArgSet& analVars, const char* ) const
00074 {
00075 if (matchArgs(allVars,analVars,x)) return 1 ;
00076 return 0 ;
00077 }
00078
00079
00080
00081
00082 Double_t RooBreitWigner::analyticalIntegral(Int_t code, const char* rangeName) const
00083 {
00084 switch(code) {
00085 case 1:
00086 {
00087 Double_t c = 2./width;
00088 return c*(atan(c*(x.max(rangeName)-mean)) - atan(c*(x.min(rangeName)-mean)));
00089 }
00090 }
00091
00092 assert(0) ;
00093 return 0 ;
00094 }
00095