00001
00002 #include "TROOT.h"
00003 #include "TSystem.h"
00004 #include "TRolke.h"
00005 #include "Riostream.h"
00006
00007 void Rolke()
00008 {
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 gSystem->Load("libPhysics.so");
00024 gSystem->Load("libTRolke.so");
00025
00026
00027 Double_t bm;
00028 Double_t tau;
00029 Int_t mid;
00030 Int_t m;
00031 Int_t z;
00032 Int_t y;
00033 Int_t x;
00034 Double_t e;
00035 Double_t em;
00036 Double_t sde;
00037 Double_t sdb;
00038 Double_t b;
00039
00040 Double_t alpha;
00041
00042
00043 TRolke tr;
00044
00045 Double_t ul ;
00046 Double_t ll ;
00047
00048
00049
00050
00051
00052
00053
00054
00055 cout << endl<<" ======================================================== " <<endl;
00056 mid =1;
00057 x = 5;
00058 y = 10;
00059 tau = 2.5;
00060 m = 100;
00061 z = 50;
00062
00063 alpha=0.9;
00064
00065 tr.SetCL(alpha);
00066
00067 tr.SetPoissonBkgBinomEff(x,y,z,tau,m);
00068 tr.GetLimits(ll,ul);
00069
00070 cout << "For model 1: Poisson / Binomial" << endl;
00071 cout << "the Profile Likelihood interval is :" << endl;
00072 cout << "[" << ll << "," << ul << "]" << endl;
00073
00074
00075
00076
00077
00078
00079
00080
00081 cout << endl<<" ======================================================== " <<endl;
00082 mid =2;
00083 y = 3 ;
00084 x = 10 ;
00085 tau = 2.5;
00086 em = 0.9;
00087 sde = 0.05;
00088 alpha =0.95;
00089
00090 tr.SetCL(alpha);
00091
00092 tr.SetPoissonBkgGaussEff(x,y,em,tau,sde);
00093 tr.GetLimits(ll,ul);
00094
00095 cout << "For model 2 : Poisson / Gaussian" << endl;
00096 cout << "the Profile Likelihood interval is :" << endl;
00097 cout << "[" << ll << "," << ul << "]" << endl;
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107 cout << endl<<" ======================================================== " <<endl;
00108 mid =3;
00109 bm = 5;
00110 x = 10;
00111 sdb = 0.5;
00112 em = 0.9;
00113 sde = 0.05;
00114 alpha =0.99;
00115
00116 tr.SetCL(alpha);
00117
00118 tr.SetGaussBkgGaussEff(x,bm,em,sde,sdb);
00119 tr.GetLimits(ll,ul);
00120 cout << "For model 3 : Gaussian / Gaussian" << endl;
00121 cout << "the Profile Likelihood interval is :" << endl;
00122 cout << "[" << ll << "," << ul << "]" << endl;
00123
00124
00125
00126 cout << "***************************************" << endl;
00127 cout << "* some more example's for gauss/gauss *" << endl;
00128 cout << "* *" << endl;
00129 Double_t slow,shigh;
00130 tr.GetSensitivity(slow,shigh);
00131 cout << "sensitivity:" << endl;
00132 cout << "[" << slow << "," << shigh << "]" << endl;
00133
00134 int outx;
00135 tr.GetLimitsQuantile(slow,shigh,outx,0.5);
00136 cout << "median limit:" << endl;
00137 cout << "[" << slow << "," << shigh << "] @ x =" << outx <<endl;
00138
00139 tr.GetLimitsML(slow,shigh,outx);
00140 cout << "ML limit:" << endl;
00141 cout << "[" << slow << "," << shigh << "] @ x =" << outx <<endl;
00142
00143 tr.GetSensitivity(slow,shigh);
00144 cout << "sensitivity:" << endl;
00145 cout << "[" << slow << "," << shigh << "]" << endl;
00146
00147 tr.GetLimits(ll,ul);
00148 cout << "the Profile Likelihood interval is :" << endl;
00149 cout << "[" << ll << "," << ul << "]" << endl;
00150
00151 Int_t ncrt;
00152
00153 tr.GetCriticalNumber(ncrt);
00154 cout << "critical number: " << ncrt << endl;
00155
00156 tr.SetCLSigmas(5);
00157 tr.GetCriticalNumber(ncrt);
00158 cout << "critical number for 5 sigma: " << ncrt << endl;
00159
00160 cout << "***************************************" << endl;
00161
00162
00163
00164
00165
00166
00167
00168
00169 cout << endl<<" ======================================================== " <<endl;
00170 mid =4;
00171 y = 7;
00172 x = 1;
00173 tau = 5;
00174 e = 0.25;
00175
00176 alpha =0.68;
00177
00178 tr.SetCL(alpha);
00179
00180 tr.SetPoissonBkgKnownEff(x,y,tau,e);
00181 tr.GetLimits(ll,ul);
00182
00183 cout << "For model 4 : Poissonian / Known" << endl;
00184 cout << "the Profile Likelihood interval is :" << endl;
00185 cout << "[" << ll << "," << ul << "]" << endl;
00186
00187
00188
00189
00190
00191
00192
00193
00194 cout << endl<<" ======================================================== " <<endl;
00195 mid =5;
00196 bm = 0;
00197 x = 1 ;
00198 e = 0.65;
00199 sdb = 1.0;
00200 alpha =0.799999;
00201
00202 tr.SetCL(alpha);
00203
00204 tr.SetGaussBkgKnownEff(x,bm,sdb,e);
00205 tr.GetLimits(ll,ul);
00206
00207 cout << "For model 5 : Gaussian / Known" << endl;
00208 cout << "the Profile Likelihood interval is :" << endl;
00209 cout << "[" << ll << "," << ul << "]" << endl;
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219 cout << endl<<" ======================================================== " <<endl;
00220 mid =6;
00221 b = 10;
00222 x = 25;
00223 z = 500;
00224 m = 750;
00225 alpha =0.9;
00226
00227 tr.SetCL(alpha);
00228
00229 tr.SetKnownBkgBinomEff(x, z,m,b);
00230 tr.GetLimits(ll,ul);
00231
00232 cout << "For model 6 : Known / Binomial" << endl;
00233 cout << "the Profile Likelihood interval is :" << endl;
00234 cout << "[" << ll << "," << ul << "]" << endl;
00235
00236
00237
00238
00239
00240
00241
00242
00243 cout << endl<<" ======================================================== " <<endl;
00244 mid =7;
00245 x = 15;
00246 em = 0.77;
00247 sde = 0.15;
00248 b = 10;
00249 alpha =0.95;
00250
00251 y = 1;
00252
00253 tr.SetCL(alpha);
00254
00255 tr.SetKnownBkgGaussEff(x,em,sde,b);
00256 tr.GetLimits(ll,ul);
00257
00258 cout << "For model 7 : Known / Gaussian " << endl;
00259 cout << "the Profile Likelihood interval is :" << endl;
00260 cout << "[" << ll << "," << ul << "]" << endl;
00261
00262
00263
00264
00265
00266
00267
00268 bm = 0.0;
00269 tau = 5;
00270 mid = 1;
00271 m = 100;
00272 z = 90;
00273 y = 15;
00274 x = 0;
00275 alpha = 0.90;
00276
00277 tr.SetCL(alpha);
00278 tr.SetPoissonBkgBinomEff(x,y,z,tau,m);
00279 tr.SetBounding(true);
00280 tr.GetLimits(ll,ul);
00281
00282 cout << "Example of the effect of bounded vs unbounded, For model 1" << endl;
00283 cout << "the BOUNDED Profile Likelihood interval is :" << endl;
00284 cout << "[" << ll << "," << ul << "]" << endl;
00285
00286
00287 tr.SetBounding(false);
00288 tr.GetLimits(ll,ul);
00289
00290 cout << "the UNBOUNDED Profile Likelihood interval is :" << endl;
00291 cout << "[" << ll << "," << ul << "]" << endl;
00292
00293 }
00294