
This twiki page describes how to perform a likelihoodbased version of the ABCD background estimation technique, using the TRooABCD application of the TRooFit toolkit (an extension for the RooFit modelbuilding framework).
To set up for use of TRooABCD, first set up an analysis release (only needed to get ROOT), then clone the TRooFit project and compile it:
mkdir source build cd build acmSetup AthAnalysis,21.2.13 acm clone_project TRooFit will/TRooFit TRooFitABCD0.2.0 acm find_packages acm compile
If all works, you should be able to open the ROOT prompt and create a TRooABCD
object like this:
root [0] TRooABCD abcd("abcd","abcd");
To use TRooABCD you must create histograms of your input data. Then the general idea is that you:
AddData(region, histogram)
method. To blind the signal region, simply do not provide the tool with a histogram for that region (if you are unblinded and have zero data in the signal region, then give the tool an empty histogram). abcd.PrintParameters()
to list the available parameters)
Fit
method.
What is TRooABCD doing? It is a simple tool that will take histograms and other numbers (scale factors or uncertainties) and construct a TRooFit
likelihood model that can be fit to the data. The fit can be performed by the tool and the pre and postfit distributions will be displayed, along with diagnostic information to help assess the goodness of the fit and give a final background estimate in the signal region.
The minimum input required for the TRooABCD tool is a set of histograms corresponding to data present in the control regions (region B, C, and D). In the most basic of example, these would all be singlebin histograms, i.e. simply the event count in each region. When doing a singlebin ABCD backgroundestimation, you can only use the uniform transfer factor model (modelType=0), since there are not enough measurements to use the linear model. To use the linear model you need at least two bins for the region C and D histograms.
//Create histograms for region B, C, and D, and fill with data ... TH1D* h_b = new TH1D("h_b","region B data",1,0,1); TH1D* h_c = new TH1D("h_c","region C data",1,0,1); TH1D* h_d = new TH1D("h_d","region D data",1,0,1); h_b>Fill(0.5, 55); h_c>Fill(0.5, 7); h_d>Fill(0.5, 103); //with these numbers, the signal region prediction should come out as: 55*7/103 = 3.7 TRooABCD abcd("abcd","my abcd"); abcd.AddData(1,h_b); //region 1 = region B abcd.AddData(2,h_c); abcd.AddData(3,h_d); TRooFitResult* result = abcd.Fit(); //result object can be used, for example, to inspect correlation matrix of fit: TCanvas newCanvas; result>Draw("cor"); //draw the correlation matrix
The above example should perform a fit in region B, C, and D, using the basic ABCD uniform model. In this model, the assumption is that:
where is the transfer factor. The three degrees of freedom are , which are fit to the data.
The following examples use the histograms found in the demo file inside the package. This file contains histograms for the data and the signal shape in the four regions illustrated in the figure below: 
You can give histograms to TRooABCD
that have multiple bins in them, and each bin of region B and D will be given its own degree of freedom. You should ensure the binning is consistent between regions A (C) and B (D). The example below will perform the standard ABCD method on 5bin histograms:
///Load the histograms TFile f1("$SourceArea/TRooFit/demo/ABCD/abcdInputHistograms.root"); TH1* h_data[4]; const char* regions[4] = {"A","B","C","D"}; for(int i=0;i<4;i++) { h_data[i] = (TH1*)f1.Get(Form("data_%s",regions[i])); h_data[i]>Rebin(20); //rebin to 5 bins (100 bins initial, group 20 bins into one) } TRooABCD abcd("abcd","my abcd"); ///add regions B, C, and D only for(int i=1;i<4;i++) { abcd.AddData(i,h_data[i]); } TRooFitResult* result = abcd.Fit();
The output of this fit is shown in the image below:
As can be seen from the fit, the standard ABCD model appears to be inappropriate for this data (the transfer factor is not uniform in the x variable).
From the postfit results, the example appears to favour a transfer factor with an approximately linear dependence on the x variable. This linear ABCD model is given by:
Note that the additional degree of freedom () means that this model cannot be used in a singlebin fit where the signal region is blinded  in this singlebin blinded scenario there would only be three data points (), but four degrees of freedom ().
With TRooABCD
, you can activate this model by changing the const status of the "m1" parameter before running the fit:
abcd.GetParameter("m1")>setConstant(false); //effectively activates the linear model TRooFitResult* result = abcd.Fit();
The output of this fit is shown below:
This model appears to be much more appropriate for this data, and the background prediction in the signal region is now much larger than the one obtained from the (inappropriate) uniform model.
The likelihoodbased ABCD method can account for signal contamination, even when the strength of the signal is unknown (which is often the case in exotic physics searches). Signal histograms can be added to the tool using the AddSignal
method. For this example we will also only add the signal contamination for regions A and C (i.e. assume no signal contamination in region B and D), because it leads to interesting results in this example.
//load signal TH1* h_signal[4]; for(int i=0;i<4;i++) { h_signal[i] = (TH1*)f1.Get(Form("sig_%s",regions[i])); h_signal[i]>Rebin(20); //rebin to 5 bins (100 bins initial, group 20 bins into one) } //add signal for only region A and C for(int i=0;i<4;i++) { if(i==1i==3) continue; //skip region B and D for this demo abcd.AddSignal(i,h_signal[i]); }
The result of the fit is shown in the image below:
When you provide any signal histograms to TRooABCD, signal terms will be added to the model, with a free parameter representing the signal strength:
The nominal background prediction is obtained after running a fit with the signal strength parameter floating. TRooABCD chooses the initial value for the signal strength such that the total signal yield across the unblinded regions is equal to the data in those regions  in this way, the initial assumption is that all of the data is in fact signal rather than background. The postfit result shows that the fit favours a small amount of signal contamination in region B, leading to a large signal prediction in region A (the red histogram).
Uncertainty due to signal strength
Since the signal strength is actually an unknown, TRooABCD will also rerun the fit with the signal strength fixed at 0 (i.e. neglecting all signal contributions). The difference between the resulting background prediction and the nominal prediction is taken as a systematic uncertainty, and is labelled " syst." on the postfit results page.
By performing this fit with and without signal (where signal is allowed to be sufficiently large to cover the data), any issue with signal having the same shape as the background (data) will manifest itself in a large uncertainty on the background prediction.
It is important that you perform a validation of your ABCD background prediction by rerunning your setup with a validation region in place of your signal region. When you do this, you might find nonclosure, in which case an additional systematic uncertainty should be added to the background prediction. To add an uncertainty to the background prediction in region A, you can use the following method:
abcd.AddBkgScaleFactor(0, 1.0, 0.04); //0 = region A, 1.0 = sf value, 0.04 = sf uncert
The above will effectively add a 4% uncertainty onto the background prediction in region A.
As the name suggests, you can also use this method to add scale factors too. This method can therefore effectively be used to incorporate the parameter of the roostats fourbin instructional. Effectively just add it as a scale factor to either region A or B.
All scale factors will be constrained in the likelihood by a gaussian with appropriate mean (= sf value) and standard deviation (=sf uncert).
The 'signal region' (region A, or region 0) has two special features in the tool. Data can be added to this region in three ways:
The model can be inspected and even saved by importing it into a RooWorkspace. Just use the GetModel
method of TRooABCD to obtain the RooSimultaneous object that represents the complete model, and import it into a workspace:
RooWorkspace w("w","w"); w.import( *abcd.GetModel() ); w.Print(); //inspect the workspace
The type of objects you will find in here are (only listing important objects):
pdfs:
w.pdf("bkg0")>Draw()
for example.
functions:
((TRooHF1D*)w.function("transfer1"))>Draw("e3005",result)
(you must pass the result object, which contains the covariance matrix required to calculate the errors correctly).
 WillButtinger  20171223
I  Attachment  History  Action  Size  Date  Who  Comment 

ABCDGuide_draft18Oct18.pdf  r1  manage  530.2 K  20181017  14:58  WillButtinger  
png  abcd_logo.png  r1  manage  5.4 K  20171224  01:17  WillButtinger  
png  figure1.png  r1  manage  18.0 K  20180102  21:17  WillButtinger  
png  trooabcd_example.png  r1  manage  19.8 K  20171223  20:45  WillButtinger  
png  tutorial1.png  r1  manage  17.9 K  20180102  21:18  WillButtinger  
png  tutorial2.png  r1  manage  18.5 K  20180102  21:51  WillButtinger  
png  tutorial3.png  r1  manage  19.9 K  20180102  22:19  WillButtinger 
Webs
Welcome Guest