Rolke.C

Go to the documentation of this file.
00001 // Example of the usage of the TRolke class 
00002 #include "TROOT.h"
00003 #include "TSystem.h"
00004 #include "TRolke.h"
00005 #include "Riostream.h"
00006       
00007 void Rolke()
00008 {
00009 //////////////////////////////////////////////////////////
00010 //
00011 // The TRolke class computes the profile likelihood
00012 // confidence limits for 7 different model assumptions
00013 // on systematic/statistical uncertainties
00014 //
00015 // Author : Jan Conrad (CERN) <jan.conrad@cern.ch> 2004
00016 //          Johan Lundberg (CERN) <johan.lundberg@cern.ch> 2009
00017 //  
00018 // Please read TRolke.cxx and TRolke.h for more docs.
00019 //             ----------     --------
00020 //
00021 //////////////////////////////////////////////////////
00022 
00023    gSystem->Load("libPhysics.so");
00024    gSystem->Load("libTRolke.so");
00025 
00026    /* variables used throughout the example */
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; //Confidence Level
00041 
00042    // make TRolke objects
00043    TRolke tr;   //
00044 
00045    Double_t ul ; // upper limit 
00046    Double_t ll ; // lower limit
00047 
00048 
00049 /////////////////////////////////////////////////////////////
00050 // Model 1 assumes:
00051 //
00052 // Poisson uncertainty in the background estimate
00053 // Binomial uncertainty in the efficiency estimate
00054 //
00055    cout << endl<<" ======================================================== " <<endl;
00056    mid =1;
00057    x = 5;     // events in the signal region
00058    y = 10;    // events observed in the background region
00059    tau = 2.5; // ratio between size of signal/background region
00060    m = 100;   // MC events have been produced  (signal)
00061    z = 50;    // MC events have been observed (signal)          
00062 
00063    alpha=0.9; //Confidence Level
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 // Model 2 assumes:
00077 //
00078 // Poisson uncertainty in the background estimate
00079 // Gaussian  uncertainty in the efficiency estimate
00080 //
00081    cout << endl<<" ======================================================== " <<endl;
00082    mid =2;
00083    y = 3 ;      // events observed in the background region
00084    x = 10 ;     // events in the signal region
00085    tau = 2.5;   // ratio between size of signal/background region
00086    em = 0.9;    // measured efficiency
00087    sde = 0.05;  // standard deviation of efficiency
00088    alpha =0.95; // Confidence L evel
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 // Model 3 assumes:
00103 //
00104 // Gaussian uncertainty in the background estimate
00105 // Gaussian  uncertainty in the efficiency estimate
00106 //
00107    cout << endl<<" ======================================================== " <<endl;
00108    mid =3;
00109    bm = 5;      // expected background
00110    x = 10;      // events in the signal region
00111    sdb = 0.5;   // standard deviation in background estimate
00112    em = 0.9;    //  measured efficiency
00113    sde = 0.05;  // standard deviation of efficiency
00114    alpha =0.99; // Confidence Level
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 // Model 4 assumes:
00165 //
00166 // Poisson uncertainty in the background estimate
00167 // known efficiency
00168 //
00169    cout << endl<<" ======================================================== " <<endl;
00170    mid =4;
00171    y = 7;       // events observed in the background region
00172    x = 1;       // events in the signal region
00173    tau = 5;     // ratio between size of signal/background region
00174    e = 0.25;    // efficiency 
00175 
00176    alpha =0.68; // Confidence L evel
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 // Model 5 assumes:
00190 //
00191 // Gaussian uncertainty in the background estimate
00192 // Known efficiency
00193 //
00194    cout << endl<<" ======================================================== " <<endl;
00195    mid =5;
00196    bm = 0;          // measured background expectation
00197    x = 1 ;          // events in the signal region
00198    e = 0.65;        // known eff
00199    sdb = 1.0;       // standard deviation of background estimate
00200    alpha =0.799999; // Confidence Level
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 // Model 6 assumes:
00215 //
00216 // Known background 
00217 // Binomial uncertainty in the efficiency estimate
00218 //
00219    cout << endl<<" ======================================================== " <<endl;
00220    mid =6;
00221    b = 10;      // known background
00222    x = 25;      // events in the signal region
00223    z = 500;     // Number of observed signal MC events
00224    m = 750;     // Number of produced MC signal events
00225    alpha =0.9;  // Confidence L evel
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 // Model 7 assumes:
00239 //
00240 // Known Background
00241 // Gaussian  uncertainty in the efficiency estimate
00242 //
00243    cout << endl<<" ======================================================== " <<endl;
00244    mid =7;
00245    x = 15;      // events in the signal region
00246    em = 0.77;   // measured efficiency
00247    sde = 0.15;  // standard deviation of efficiency estimate
00248    b = 10;      // known background
00249    alpha =0.95; // Confidence L evel
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 // Example of bounded and unbounded likelihood
00265 // Example for Model 1
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); //bounded
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); //unbounded
00288    tr.GetLimits(ll,ul);   
00289    
00290    cout <<  "the UNBOUNDED Profile Likelihood interval is :" << endl;
00291    cout << "[" << ll << "," << ul << "]" << endl;
00292   
00293 }
00294 

Generated on Tue Jul 5 15:44:50 2011 for ROOT_528-00b_version by  doxygen 1.5.1