Logo ROOT   6.10/09
Reference Guide
FeldmanCousins.C
Go to the documentation of this file.
1 /// \file
2 /// \ingroup tutorial_math
3 /// \notebook -nodraw
4 /// Example macro of using the TFeldmanCousins class in root.
5 ///
6 /// get a FeldmanCousins calculation object with the default limits
7 /// of calculating a 90% CL with the minimum signal value scanned
8 /// = 0.0 and the maximum signal value scanned of 50.0
9 ///
10 /// \macro_output
11 /// \macro_code
12 ///
13 /// \author Adrian John Bevan <bevan@SLAC.Stanford.EDU>
14 
15 void FeldmanCousins()
16 {
17  if (!gROOT->GetClass("TFeldmanCousins")) gSystem->Load("libPhysics");
18 
20 
21  // calculate either the upper or lower limit for 10 observed
22  // events with an estimated background of 3. The calculation of
23  // either upper or lower limit will return that limit and fill
24  // data members with both the upper and lower limit for you.
25  Double_t Nobserved = 10.0;
26  Double_t Nbackground = 3.0;
27 
28  Double_t ul = f.CalculateUpperLimit(Nobserved, Nbackground);
29  Double_t ll = f.GetLowerLimit();
30 
31  cout << "For " << Nobserved << " data observed with and estimated background"<<endl;
32  cout << "of " << Nbackground << " candidates, the Feldman-Cousins method of "<<endl;
33  cout << "calculating confidence limits gives:"<<endl;
34  cout << "\tUpper Limit = " << ul << endl;
35  cout << "\tLower Limit = " << ll << endl;
36  cout << "at the 90% CL"<< endl;
37 }
38 
#define gROOT
Definition: TROOT.h:375
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
Definition: TSystem.cxx:1825
R__EXTERN TSystem * gSystem
Definition: TSystem.h:539
Double_t GetLowerLimit(void) const
double f(double x)
double Double_t
Definition: RtypesCore.h:55
Class to calculate the CL upper limit using the Feldman-Cousins method as described in PRD V57 #7...
Double_t CalculateUpperLimit(Double_t Nobserved, Double_t Nbackground)
given Nobserved and Nbackground, try different values of mu that give upper limits that are consisten...