TLimit : a ROOT add-on to compute 95% CL limits using likelihood ratio


The aim of this add-on is to perform an easy computation of 95% CL limits with ROOT. Is consists of 3 classes, that have to be integrated or loaded in ROOT. The primary input is a set of TH1D (histograms) and the output an set of values (CLs, CLb, CLs+b, -2lnQ, ...).

The algorithm is the one originaly written by Tom Junk (mclimit.f) in fortran.

It as been completely re-written in C++, using a natural class description of the inputs, outputs and algorithms.

The classes are

  • TLimitDataSource
    It takes the signal, background and data histograms to form a channel. More channels can be added using AddChannel(), as well as different systematics sources.
  • TLimit
    It is the actual algorithm. Is takes a TLimitDataSource as input and run a set of MC experiments in order to compute the limits. If needed, the inputs are fluctuated according to the systematics. The output is a TConfidenceLevel
  • TConfidenceLevel
    It is the final result of the algorithm. It is created just after the time-consuming part and can be stored in a TFile for further processing. It contains light methods to return CLs, CLb and other interesting quantities.

Download and install

  • The last version is now part of the official ROOT distribution.
  • Supposing that there is a plotfile.root file containing 3 histograms (signal, background and data), you can imagine doing things like:

    TFile* infile=new TFile("plotfile.root","READ");
    TH1D* sh=(TH1F*)infile->Get("signal");
    TH1D* bh=(TH1F*)infile->Get("background");
    TH1D* dh=(TH1F*)infile->Get("data");
    TLimitDataSource* mydatasource = new TLimitDataSource(sh,bh,dh);
    TConfidenceLevel *myconfidence = TLimit::ComputeLimit(mydatasource,50000);
    cout << "  CLs    : " << myconfidence->CLs()  << endl;
    cout << "  CLsb   : " << myconfidence->CLsb() << endl;
    cout << "  CLb    : " << myconfidence->CLb()  << endl;
    cout << "< CLs >  : " << myconfidence->GetExpectedCLs_b()  << endl;
    cout << "< CLsb > : " << myconfidence->GetExpectedCLsb_b() << endl;
    cout << "< CLb >  : " << myconfidence->GetExpectedCLb_b()  << endl;
    delete myconfidence;
    delete mydatasource;

    TLimit is now documented on the ROOT reference guide. There is also a new tutorial (limit.C).

    Here is a first presentation about TLimit...

    A more complete (complex?) example combining several channels found in different files.

    To add systematics, you must provide 2 additionnal arguments to AddChannel: a TH1D and a TCloneArray< TString >. Each bin of the TH1D is supposed to contain the relative error due to one systematics source, whose name is the corresponding entry in the TCloneArray.

    Last modified on Sep 23 2005 by C.Delaere