ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/cbrown/Development/Plotting/Modules/EdgeModules/RooSUSYCompleteBkgPdf.cxx
Revision: 1.2
Committed: Wed Jun 26 11:10:03 2013 UTC (11 years, 10 months ago) by buchmann
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +34 -9 lines
Error occurred while calculating annotation data.
Log Message:
Added complete background model

File Contents

# Content
1 /*****************************************************************************
2 * Project: RooFit *
3 * *
4 * This code was autogenerated by RooClassFactory *
5 *****************************************************************************/
6
7 // Your description goes here...
8
9 #include "Riostream.h"
10 #include "RooSUSYCompleteBkgPdf.h"
11 #include "RooAbsReal.h"
12 #include "RooAbsCategory.h"
13 #include "TMath.h"
14 #include "RooRealVar.h"
15 #include "RooComplex.h"
16 #include "RooMath.h"
17 //ClassImp(RooSUSYBkgPdf)
18
19 //RooSUSYCompleteBkgPdf FullModel("FullModel","FullModel",mll, fttbaree, fttbarmm, par1ttbarOF, par2ttbarOF, par3ttbarOF, par4ttbarOF, meanz,widthz, sigmazee, sigmazmm, fzee, fzmm, par1signal, fsignalee, fsignalmm);
20 RooSUSYCompleteBkgPdf::RooSUSYCompleteBkgPdf(const char *name, const char *title,
21 RooAbsReal& _mll,
22 RooAbsReal& _te,
23 RooAbsReal& _tm,
24 RooAbsReal& _t1,
25 RooAbsReal& _t2,
26 RooAbsReal& _t3,
27 RooAbsReal& _t4,
28 RooAbsReal& _meanz,
29 RooAbsReal& _widthz,
30 RooAbsReal& _sigmazee,
31 RooAbsReal& _sigmazmm,
32 RooAbsReal& _fzee,
33 RooAbsReal& _fzmm,
34 RooAbsReal& _s1,
35 RooAbsReal& _s3,
36 RooAbsReal& _sn) :
37 RooAbsPdf(name,title),
38 mll("mll","mll",this,_mll),
39 te("te","te",this,_te),
40 tm("tm","tm",this,_tm),
41 t1("t1","t1",this,_t1),
42 t2("t2","t2",this,_t2),
43 t3("t3","t3",this,_t3),
44 t4("t4","t4",this,_t4),
45 meanz("meanz","meanz",this,_meanz),
46 widthz("widthz","widthz",this,_widthz),
47 sigmazee("sigmazee","sigmazee",this,_sigmazee),
48 sigmazmm("sigmazmm","sigmazmm",this,_sigmazmm),
49 fzee("fzee","fzee",this,_fzee),
50 fzmm("fzmm","fzmm",this,_fzmm),
51 s1("s1","s1",this,_s1),
52 s3("s3","s3",this,_s3),
53 sn("sn","sn",this,_sn)
54 {
55 }
56
57
58 RooSUSYCompleteBkgPdf::RooSUSYCompleteBkgPdf(const RooSUSYCompleteBkgPdf& other, const char* name) :
59 RooAbsPdf(other,name),
60 mll("mll",this,other.mll),
61 te("te",this,other.te),
62 tm("tm",this,other.tm),
63 t1("t1",this,other.t1),
64 t2("t2",this,other.t2),
65 t3("t3",this,other.t3),
66 t4("t4",this,other.t4),
67 meanz("meanz",this,other.meanz),
68 widthz("widthz",this,other.widthz),
69 sigmazee("sigmazee",this,other.sigmazee),
70 sigmazmm("sigmazmm",this,other.sigmazmm),
71 fzee("fzee",this,other.fzee),
72 fzmm("fzmm",this,other.fzmm),
73 s1("s1",this,other.s1),
74 s3("s3",this,other.s3),
75 sn("sn",this,other.sn)
76 {
77 }
78
79
80 Double_t RooSUSYCompleteBkgPdf::Voigtian(float x, float sigma,float width,float mean) const
81 {
82 Double_t s = (sigma>0) ? sigma : -sigma ;
83 Double_t w = (width>0) ? width : -width ;
84
85 Double_t coef= -0.5/(s*s);
86 Double_t arg = x - mean;
87
88 // return constant for zero width and sigma
89 if (s==0. && w==0.) return 1.;
90
91 // Breit-Wigner for zero sigma
92 if (s==0.) return (1./(arg*arg+0.25*w*w));
93
94 // Gauss for zero width
95 if (w==0.) return exp(coef*arg*arg);
96
97 // actual Voigtian for non-trivial width and sigma
98 Double_t c = 1./(sqrt(2.)*s);
99 Double_t a = 0.5*c*w;
100 Double_t u = c*arg;
101 RooComplex z(u,a) ;
102 RooComplex v(0.) ;
103
104 v = RooMath::ComplexErrFunc(z);
105
106 double _invRootPi=_invRootPi= 1./sqrt(atan2(0.,-1.));
107 return c*_invRootPi*v.re();
108 }
109
110 Double_t RooSUSYCompleteBkgPdf::GetSignal(float c, float s, float m0) const
111 {
112 float value = c*(TMath::Sqrt(2)*s*(TMath::Exp(-mll*mll/(2*s*s))-TMath::Exp(-(m0-mll)*(m0-mll)/(2*s*s)))+mll*TMath::Sqrt(TMath::Pi())*(TMath::Erf(mll/(TMath::Sqrt(2)*s))+TMath::Erf((m0-mll)/(TMath::Sqrt(2)*s))));
113 if(value>0) return value;
114 else return 0.;
115 }
116
117 Double_t RooSUSYCompleteBkgPdf::TTNormalization() const
118 {
119 Double_t sum=0.0;
120 for(float a=20.0;a<=300;a+=0.1) {
121 sum+=TMath::Power(a,t1)*TMath::Exp(-t3*a);
122 }
123 return sum;
124 }
125
126
127 Double_t RooSUSYCompleteBkgPdf::DYNormalization(Double_t sigma) const
128 {
129 Double_t sum=0.0;
130 for(float a=20.0;a<=300;a+=0.1) {
131 sum+=RooSUSYCompleteBkgPdf::Voigtian(a,sigma,widthz,meanz);
132 }
133 return sum;
134 }
135
136 Double_t RooSUSYCompleteBkgPdf::evaluate() const
137 {
138 // ENTER EXPRESSION IN TERMS OF VARIABLE ARGUMENTS HERE
139
140 // float TTNormalization=1.0/(-pow(300.0,t1)*expint(t1,300.0*t3)+pow(20.0,t1)*expint(t1,20.0*t3)); // 300 and 20 are the limits within which we want to have ttbar normalized!
141 float TTNormalization=1.0/RooSUSYCompleteBkgPdf::TTNormalization();
142
143 float eeVoigtianNormalization=1.0/RooSUSYCompleteBkgPdf::DYNormalization(sigmazee);
144 float mmVoigtianNormalization=1.0/RooSUSYCompleteBkgPdf::DYNormalization(sigmazmm);
145
146
147 float ttbaree=te*TTNormalization*TMath::Power(mll,t1)*TMath::Exp(-t3*mll);
148 float ttbarmm=tm*TTNormalization*TMath::Power(mll,t1)*TMath::Exp(-t3*mll);
149
150 float DYee = fzee*eeVoigtianNormalization*RooSUSYCompleteBkgPdf::Voigtian(mll,sigmazee,widthz,meanz);
151 float DYmm = fzmm*mmVoigtianNormalization*RooSUSYCompleteBkgPdf::Voigtian(mll,sigmazmm,widthz,meanz);
152
153 float sig_e = GetSignal(s1,sigmazee,s3);
154 float sig_m = GetSignal(s1,sigmazmm,s3);
155
156 float sig = sn * ( (te/(te+tm)) * sig_e + (tm/(te+tm)) * sig_m );
157
158 if(mll>90&&mll<92) {
159 // cout << "TTbar normalization : " << TTNormalization << endl;
160 // cout << "t: " << te << " ; " << tm << " ; " << t1 << " ; " << t2 << " ; " << t3 << " ; " << t4 << endl;
161 // cout << "dy: " << meanz << " ; " << widthz << " ; " << sigmazee << " ; " << sigmazmm << " ; " << fzee << " ; " << fzmm << endl;
162 // cout << "s : " << s1 << " ; " << s3 << " ; " << sn << endl;
163 cout << " CONTRIBUTIONS : (mll=" << mll << endl;
164 cout << " ttbaree : " << ttbaree << endl;
165 cout << " ttbarmm : " << ttbarmm << endl;
166 cout << " dy ee : " << DYee << endl;
167 cout << " dy mm : " << DYmm << endl;
168 cout << " sig ee : " << sig_e << endl;
169 cout << " sig mm : " << sig_m << endl;
170 cout << " -> sig : " << sig << endl;
171 cout << " full : " << ttbaree+ttbarmm+DYee+DYmm+sig << endl;
172 }
173
174 return ttbaree+ttbarmm+DYee+DYmm+sig;
175 }
176
177
178