Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TLimit.cxx
Go to the documentation of this file.
1// @(#)root/hist:$Id$
2// Author: Christophe.Delaere@cern.ch 21/08/2002
3
4///////////////////////////////////////////////////////////////////////////
5//
6// TLimit
7//
8// Class to compute 95% CL limits
9//
10// adapted from the mclimit code from Tom Junk (CLs method)
11// see http://root.cern/root/doc/TomJunk.pdf
12// see http://cern.ch/thomasj/searchlimits/ecl.html
13// see: Tom Junk,NIM A434, p. 435-443, 1999
14//
15// see also the following interesting references:
16// Alex Read, "Presentation of search results: the CLs technique"
17// Journal of Physics G: Nucl. Part. Phys. 28 2693-2704 (2002).
18// http://www.iop.org/EJ/abstract/0954-3899/28/10/313/
19//
20// A nice article is also available in the CERN yellow report with the proceeding
21// of the 2000 CERN workshop on confidence intervals.
22//
23// Alex Read, "Modified Frequentist Analysis of Search Results (The CLs Method)"
24// CERN 2000-005 (30 May 2000)
25//
26///////////////////////////////////////////////////////////////////////////
27
28/** \class TLimit
29 \legacy{TLimit, Consider switching to RooStats.}
30 \ingroup Hist
31 Algorithm to compute 95% CL limits using the Likelihood ratio semi-bayesian method.
32
33 Implemented by C. Delaere from the mclimit code written by Tom Junk [HEP-EX/9902006].
34 See [http://cern.ch/thomasj/searchlimits/ecl.html](http://cern.ch/thomasj/searchlimits/ecl.html) for more details.
35
36 It takes signal, background and data histograms wrapped in a
37 TLimitDataSource as input and runs a set of Monte Carlo experiments in
38 order to compute the limits. If needed, inputs are fluctuated according
39 to systematics. The output is a TConfidenceLevel.
40
41 The class TLimitDataSource takes the signal, background and data histograms as well as different
42 systematics sources to form the TLimit input.
43
44 The class TConfidenceLevel represents the final result of the TLimit algorithm. It is created just after the
45 time-consuming part and can be stored in a TFile for further processing.
46 It contains light methods to return CLs, CLb and other interesting
47 quantities.
48
49 The actual algorithm...
50
51 From an input (TLimitDataSource) it produces an output TConfidenceLevel.
52 For this, nmc Monte Carlo experiments are performed.
53 As usual, the larger this number, the longer the compute time,
54 but the better the result.
55
56 Supposing that there is a plotfile.root file containing 3 histograms
57 (signal, background and data), you can imagine doing things like:
58
59~~~{.cpp}
60 TFile* infile=new TFile("plotfile.root","READ");
61 infile->cd();
62 TH1* sh=(TH1*)infile->Get("signal");
63 TH1* bh=(TH1*)infile->Get("background");
64 TH1* dh=(TH1*)infile->Get("data");
65 TLimitDataSource* mydatasource = new TLimitDataSource(sh,bh,dh);
66 TConfidenceLevel *myconfidence = TLimit::ComputeLimit(mydatasource,50000);
67 std::cout << " CLs : " << myconfidence->CLs() << std::endl;
68 std::cout << " CLsb : " << myconfidence->CLsb() << std::endl;
69 std::cout << " CLb : " << myconfidence->CLb() << std::endl;
70 std::cout << "< CLs > : " << myconfidence->GetExpectedCLs_b() << std::endl;
71 std::cout << "< CLsb > : " << myconfidence->GetExpectedCLsb_b() << std::endl;
72 std::cout << "< CLb > : " << myconfidence->GetExpectedCLb_b() << std::endl;
73 delete myconfidence;
74 delete mydatasource;
75 infile->Close();
76~~~
77 More information can still be found on [this page](http://cern.ch/aleph-proj-alphapp/doc/tlimit.html)
78 \see https://doi.org/10.1088/0954-3899/28/10/313, https://cds.cern.ch/record/451614/files/open-2000-205.pdf
79 \note see note about: "Should I use TRolke, TFeldmanCousins, TLimit?" in the TRolke class description.
80 */
81
82#include "TLimit.h"
83#include "TArrayD.h"
84#include "TVectorD.h"
85#include "TOrdCollection.h"
86#include "TConfidenceLevel.h"
87#include "TLimitDataSource.h"
88#include "TRandom3.h"
89#include "TH1.h"
90#include "TObjArray.h"
91#include "TMath.h"
92#include "TIterator.h"
93#include "TObjString.h"
94#include "TClassTable.h"
95#include "Riostream.h"
96
98