From $ROOTSYS/tutorials/math/Rolke.C

// Example of the usage of the TRolke class 
#include "TROOT.h"
#include "TSystem.h"
#include "TRolke.h"
#include "Riostream.h"
      
void Rolke()
{
//////////////////////////////////////////////////////////
//
// The TRolke class computes the profile likelihood
// confidence limits for 7 different model assumptions
// on systematic/statistical uncertainties
//
// Author : Jan Conrad (CERN) <jan.conrad@cern.ch> 2004
//          Johan Lundberg (CERN) <johan.lundberg@cern.ch> 2009
//  
// Please read TRolke.cxx and TRolke.h for more docs.
//             ----------     --------
//
//////////////////////////////////////////////////////


   /* variables used throughout the example */
   Double_t bm;
   Double_t tau;
   Int_t mid;
   Int_t m;
   Int_t z;
   Int_t y;
   Int_t x;
   Double_t e;
   Double_t em;
   Double_t sde;
   Double_t sdb;
   Double_t b;

   Double_t alpha; //Confidence Level

   // make TRolke objects
   TRolke tr;   //

   Double_t ul ; // upper limit 
   Double_t ll ; // lower limit


/////////////////////////////////////////////////////////////
// Model 1 assumes:
//
// Poisson uncertainty in the background estimate
// Binomial uncertainty in the efficiency estimate
//
   cout << endl<<" ======================================================== " <<endl;
   mid =1;
   x = 5;     // events in the signal region
   y = 10;    // events observed in the background region
   tau = 2.5; // ratio between size of signal/background region
   m = 100;   // MC events have been produced  (signal)
   z = 50;    // MC events have been observed (signal)          

   alpha=0.9; //Confidence Level

   tr.SetCL(alpha);  

   tr.SetPoissonBkgBinomEff(x,y,z,tau,m); 
   tr.GetLimits(ll,ul);
 
   cout << "For model 1: Poisson / Binomial" << endl; 
   cout << "the Profile Likelihood interval is :" << endl;
   cout << "[" << ll << "," << ul << "]" << endl;

 
/////////////////////////////////////////////////////////////
// Model 2 assumes:
//
// Poisson uncertainty in the background estimate
// Gaussian  uncertainty in the efficiency estimate
//
   cout << endl<<" ======================================================== " <<endl;
   mid =2;
   y = 3 ;      // events observed in the background region
   x = 10 ;     // events in the signal region
   tau = 2.5;   // ratio between size of signal/background region
   em = 0.9;    // measured efficiency
   sde = 0.05;  // standard deviation of efficiency
   alpha =0.95; // Confidence L evel

   tr.SetCL(alpha);

   tr.SetPoissonBkgGaussEff(x,y,em,tau,sde);
   tr.GetLimits(ll,ul);
 
   cout << "For model 2 : Poisson / Gaussian" << endl; 
   cout << "the Profile Likelihood interval is :" << endl;
   cout << "[" << ll << "," << ul << "]" << endl;

  

/////////////////////////////////////////////////////////////
// Model 3 assumes:
//
// Gaussian uncertainty in the background estimate
// Gaussian  uncertainty in the efficiency estimate
//
   cout << endl<<" ======================================================== " <<endl;
   mid =3;
   bm = 5;      // expected background
   x = 10;      // events in the signal region
   sdb = 0.5;   // standard deviation in background estimate
   em = 0.9;    //  measured efficiency
   sde = 0.05;  // standard deviation of efficiency
   alpha =0.99; // Confidence Level

   tr.SetCL(alpha);

   tr.SetGaussBkgGaussEff(x,bm,em,sde,sdb); 
   tr.GetLimits(ll,ul);
   cout << "For model 3 : Gaussian / Gaussian" << endl; 
   cout << "the Profile Likelihood interval is :" << endl;
   cout << "[" << ll << "," << ul << "]" << endl;


 
   cout << "***************************************" << endl;
   cout << "* some more example's for gauss/gauss *" << endl;
   cout << "*                                     *" << endl;
   Double_t slow,shigh;
   tr.GetSensitivity(slow,shigh);
   cout << "sensitivity:" << endl;
   cout << "[" << slow << "," << shigh << "]" << endl; 

   int outx;
   tr.GetLimitsQuantile(slow,shigh,outx,0.5);
   cout << "median limit:" << endl;
   cout << "[" << slow << "," << shigh << "] @ x =" << outx <<endl; 

   tr.GetLimitsML(slow,shigh,outx);
   cout << "ML limit:" << endl;
   cout << "[" << slow << "," << shigh << "] @ x =" << outx <<endl; 

   tr.GetSensitivity(slow,shigh);
   cout << "sensitivity:" << endl;
   cout << "[" << slow << "," << shigh << "]" << endl; 

   tr.GetLimits(ll,ul);
   cout << "the Profile Likelihood interval is :" << endl;
   cout << "[" << ll << "," << ul << "]" << endl;

   Int_t ncrt;

   tr.GetCriticalNumber(ncrt);
   cout << "critical number: " << ncrt << endl;

   tr.SetCLSigmas(5);
   tr.GetCriticalNumber(ncrt);
   cout << "critical number for 5 sigma: " << ncrt << endl;

   cout << "***************************************" << endl;


/////////////////////////////////////////////////////////////
// Model 4 assumes:
//
// Poisson uncertainty in the background estimate
// known efficiency
//
   cout << endl<<" ======================================================== " <<endl;
   mid =4;
   y = 7;       // events observed in the background region
   x = 1;       // events in the signal region
   tau = 5;     // ratio between size of signal/background region
   e = 0.25;    // efficiency 

   alpha =0.68; // Confidence L evel

   tr.SetCL(alpha);

   tr.SetPoissonBkgKnownEff(x,y,tau,e);
   tr.GetLimits(ll,ul);
 
   cout << "For model 4 : Poissonian / Known" << endl; 
   cout <<  "the Profile Likelihood interval is :" << endl;
   cout << "[" << ll << "," << ul << "]" << endl;

   
////////////////////////////////////////////////////////
// Model 5 assumes:
//
// Gaussian uncertainty in the background estimate
// Known efficiency
//
   cout << endl<<" ======================================================== " <<endl;
   mid =5;
   bm = 0;          // measured background expectation
   x = 1 ;          // events in the signal region
   e = 0.65;        // known eff
   sdb = 1.0;       // standard deviation of background estimate
   alpha =0.799999; // Confidence Level

   tr.SetCL(alpha);

   tr.SetGaussBkgKnownEff(x,bm,sdb,e);
   tr.GetLimits(ll,ul);
 
   cout << "For model 5 : Gaussian / Known" << endl; 
   cout <<  "the Profile Likelihood interval is :" << endl;
   cout << "[" << ll << "," << ul << "]" << endl;

 

////////////////////////////////////////////////////////
// Model 6 assumes:
//
// Known background 
// Binomial uncertainty in the efficiency estimate
//
   cout << endl<<" ======================================================== " <<endl;
   mid =6;
   b = 10;      // known background
   x = 25;      // events in the signal region
   z = 500;     // Number of observed signal MC events
   m = 750;     // Number of produced MC signal events
   alpha =0.9;  // Confidence L evel

   tr.SetCL(alpha);

   tr.SetKnownBkgBinomEff(x, z,m,b);
   tr.GetLimits(ll,ul);
 
   cout << "For model 6 : Known / Binomial" << endl; 
   cout <<  "the Profile Likelihood interval is :" << endl;
   cout << "[" << ll << "," << ul << "]" << endl;

  
////////////////////////////////////////////////////////
// Model 7 assumes:
//
// Known Background
// Gaussian  uncertainty in the efficiency estimate
//
   cout << endl<<" ======================================================== " <<endl;
   mid =7;
   x = 15;      // events in the signal region
   em = 0.77;   // measured efficiency
   sde = 0.15;  // standard deviation of efficiency estimate
   b = 10;      // known background
   alpha =0.95; // Confidence L evel

   y = 1;

   tr.SetCL(alpha);

   tr.SetKnownBkgGaussEff(x,em,sde,b);
   tr.GetLimits(ll,ul);
  
   cout << "For model 7 : Known / Gaussian " << endl; 
   cout <<  "the Profile Likelihood interval is :" << endl;
   cout << "[" << ll << "," << ul << "]" << endl;


////////////////////////////////////////////////////////
// Example of bounded and unbounded likelihood
// Example for Model 1
///////////////////////////////////////////////////////

   bm = 0.0;
   tau = 5;
   mid = 1;
   m = 100;
   z = 90;
   y = 15;
   x = 0;
   alpha = 0.90;
   
   tr.SetCL(alpha);
   tr.SetPoissonBkgBinomEff(x,y,z,tau,m); 
   tr.SetBounding(true); //bounded
   tr.GetLimits(ll,ul);   
   
   cout << "Example of the effect of bounded vs unbounded, For model 1" << endl; 
   cout <<  "the BOUNDED Profile Likelihood interval is :" << endl;
   cout << "[" << ll << "," << ul << "]" << endl;


   tr.SetBounding(false); //unbounded
   tr.GetLimits(ll,ul);   
   
   cout <<  "the UNBOUNDED Profile Likelihood interval is :" << endl;
   cout << "[" << ll << "," << ul << "]" << endl;
  
}

 Rolke.C:1
 Rolke.C:2
 Rolke.C:3
 Rolke.C:4
 Rolke.C:5
 Rolke.C:6
 Rolke.C:7
 Rolke.C:8
 Rolke.C:9
 Rolke.C:10
 Rolke.C:11
 Rolke.C:12
 Rolke.C:13
 Rolke.C:14
 Rolke.C:15
 Rolke.C:16
 Rolke.C:17
 Rolke.C:18
 Rolke.C:19
 Rolke.C:20
 Rolke.C:21
 Rolke.C:22
 Rolke.C:23
 Rolke.C:24
 Rolke.C:25
 Rolke.C:26
 Rolke.C:27
 Rolke.C:28
 Rolke.C:29
 Rolke.C:30
 Rolke.C:31
 Rolke.C:32
 Rolke.C:33
 Rolke.C:34
 Rolke.C:35
 Rolke.C:36
 Rolke.C:37
 Rolke.C:38
 Rolke.C:39
 Rolke.C:40
 Rolke.C:41
 Rolke.C:42
 Rolke.C:43
 Rolke.C:44
 Rolke.C:45
 Rolke.C:46
 Rolke.C:47
 Rolke.C:48
 Rolke.C:49
 Rolke.C:50
 Rolke.C:51
 Rolke.C:52
 Rolke.C:53
 Rolke.C:54
 Rolke.C:55
 Rolke.C:56
 Rolke.C:57
 Rolke.C:58
 Rolke.C:59
 Rolke.C:60
 Rolke.C:61
 Rolke.C:62
 Rolke.C:63
 Rolke.C:64
 Rolke.C:65
 Rolke.C:66
 Rolke.C:67
 Rolke.C:68
 Rolke.C:69
 Rolke.C:70
 Rolke.C:71
 Rolke.C:72
 Rolke.C:73
 Rolke.C:74
 Rolke.C:75
 Rolke.C:76
 Rolke.C:77
 Rolke.C:78
 Rolke.C:79
 Rolke.C:80
 Rolke.C:81
 Rolke.C:82
 Rolke.C:83
 Rolke.C:84
 Rolke.C:85
 Rolke.C:86
 Rolke.C:87
 Rolke.C:88
 Rolke.C:89
 Rolke.C:90
 Rolke.C:91
 Rolke.C:92
 Rolke.C:93
 Rolke.C:94
 Rolke.C:95
 Rolke.C:96
 Rolke.C:97
 Rolke.C:98
 Rolke.C:99
 Rolke.C:100
 Rolke.C:101
 Rolke.C:102
 Rolke.C:103
 Rolke.C:104
 Rolke.C:105
 Rolke.C:106
 Rolke.C:107
 Rolke.C:108
 Rolke.C:109
 Rolke.C:110
 Rolke.C:111
 Rolke.C:112
 Rolke.C:113
 Rolke.C:114
 Rolke.C:115
 Rolke.C:116
 Rolke.C:117
 Rolke.C:118
 Rolke.C:119
 Rolke.C:120
 Rolke.C:121
 Rolke.C:122
 Rolke.C:123
 Rolke.C:124
 Rolke.C:125
 Rolke.C:126
 Rolke.C:127
 Rolke.C:128
 Rolke.C:129
 Rolke.C:130
 Rolke.C:131
 Rolke.C:132
 Rolke.C:133
 Rolke.C:134
 Rolke.C:135
 Rolke.C:136
 Rolke.C:137
 Rolke.C:138
 Rolke.C:139
 Rolke.C:140
 Rolke.C:141
 Rolke.C:142
 Rolke.C:143
 Rolke.C:144
 Rolke.C:145
 Rolke.C:146
 Rolke.C:147
 Rolke.C:148
 Rolke.C:149
 Rolke.C:150
 Rolke.C:151
 Rolke.C:152
 Rolke.C:153
 Rolke.C:154
 Rolke.C:155
 Rolke.C:156
 Rolke.C:157
 Rolke.C:158
 Rolke.C:159
 Rolke.C:160
 Rolke.C:161
 Rolke.C:162
 Rolke.C:163
 Rolke.C:164
 Rolke.C:165
 Rolke.C:166
 Rolke.C:167
 Rolke.C:168
 Rolke.C:169
 Rolke.C:170
 Rolke.C:171
 Rolke.C:172
 Rolke.C:173
 Rolke.C:174
 Rolke.C:175
 Rolke.C:176
 Rolke.C:177
 Rolke.C:178
 Rolke.C:179
 Rolke.C:180
 Rolke.C:181
 Rolke.C:182
 Rolke.C:183
 Rolke.C:184
 Rolke.C:185
 Rolke.C:186
 Rolke.C:187
 Rolke.C:188
 Rolke.C:189
 Rolke.C:190
 Rolke.C:191
 Rolke.C:192
 Rolke.C:193
 Rolke.C:194
 Rolke.C:195
 Rolke.C:196
 Rolke.C:197
 Rolke.C:198
 Rolke.C:199
 Rolke.C:200
 Rolke.C:201
 Rolke.C:202
 Rolke.C:203
 Rolke.C:204
 Rolke.C:205
 Rolke.C:206
 Rolke.C:207
 Rolke.C:208
 Rolke.C:209
 Rolke.C:210
 Rolke.C:211
 Rolke.C:212
 Rolke.C:213
 Rolke.C:214
 Rolke.C:215
 Rolke.C:216
 Rolke.C:217
 Rolke.C:218
 Rolke.C:219
 Rolke.C:220
 Rolke.C:221
 Rolke.C:222
 Rolke.C:223
 Rolke.C:224
 Rolke.C:225
 Rolke.C:226
 Rolke.C:227
 Rolke.C:228
 Rolke.C:229
 Rolke.C:230
 Rolke.C:231
 Rolke.C:232
 Rolke.C:233
 Rolke.C:234
 Rolke.C:235
 Rolke.C:236
 Rolke.C:237
 Rolke.C:238
 Rolke.C:239
 Rolke.C:240
 Rolke.C:241
 Rolke.C:242
 Rolke.C:243
 Rolke.C:244
 Rolke.C:245
 Rolke.C:246
 Rolke.C:247
 Rolke.C:248
 Rolke.C:249
 Rolke.C:250
 Rolke.C:251
 Rolke.C:252
 Rolke.C:253
 Rolke.C:254
 Rolke.C:255
 Rolke.C:256
 Rolke.C:257
 Rolke.C:258
 Rolke.C:259
 Rolke.C:260
 Rolke.C:261
 Rolke.C:262
 Rolke.C:263
 Rolke.C:264
 Rolke.C:265
 Rolke.C:266
 Rolke.C:267
 Rolke.C:268
 Rolke.C:269
 Rolke.C:270
 Rolke.C:271
 Rolke.C:272
 Rolke.C:273
 Rolke.C:274
 Rolke.C:275
 Rolke.C:276
 Rolke.C:277
 Rolke.C:278
 Rolke.C:279
 Rolke.C:280
 Rolke.C:281
 Rolke.C:282
 Rolke.C:283
 Rolke.C:284
 Rolke.C:285
 Rolke.C:286
 Rolke.C:287
 Rolke.C:288
 Rolke.C:289
 Rolke.C:290
 Rolke.C:291
 Rolke.C:292
 Rolke.C:293