#include #include #include #include #include #include #include #include using namespace RooFit ; // Binning() calls void plot() { TFile f("higgsCombine_TEST.GenerateOnly.mH120.123456.root","READ"); TDirectoryFile *toys = dynamic_cast(f.Get("toys")); RooDataSet* rds = (RooDataSet*)toys->Get("toy_1"); // set up boundary arrays for the variable binnings in Y const Double_t y_bins_low[10] = {900,1000,1100,1200,1300,1400,1500,1700,2000,3500}; const Double_t y_bins_sig[10] = {900,1000,1100,1200,1300,1400,1500,1700,2000,3500}; const Double_t y_bins_high[10] = {900,1000,1100,1200,1300,1400,1500,1700,2000,3500}; Int_t nBins_y = 9; // set up binning object for Y // https://root.cern.ch/doc/v614/classRooBinning.html#a6711625008f039fa78c7960530a928d4 RooBinning rb_y_low(nBins_y, *y_bins_low, "y_low"); RooBinning rb_y_sig(nBins_y, *y_bins_sig, "y_sig"); RooBinning rb_y_high(nBins_y, *y_bins_high, "y_high"); // set up boundary arrays for the variable binnings in X const Double_t x_bins_low[4] = {60,80,100,120}; const Double_t x_bins_sig[3] = {120,140,160}; const Double_t x_bins_high[7] = {160,180,200,220,260,300,560}; Int_t nBins_x_low = 3; Int_t nBins_x_sig = 2; Int_t nBins_x_high = 6; // set up binning objects for X RooBinning rb_x_low(nBins_x_low, *x_bins_low, "x_low"); RooBinning rb_x_sig(nBins_x_sig, *x_bins_sig, "x_sig"); RooBinning rb_x_high(nBins_x_high, *x_bins_high, "x_high"); // reduce the RooDataSets RooAbsData *low = (RooAbsData*)rds->reduce("CMS_channel==CMS_channel::SR_pass_LOW"); RooAbsData *sig = (RooAbsData*)rds->reduce("CMS_channel==CMS_channel::SR_pass_SIG"); RooAbsData *high = (RooAbsData*)rds->reduce("CMS_channel==CMS_channel::SR_pass_HIGH"); // make a histogram from one as a test TH2F* h_low = dynamic_cast(low->createHistogram("jetmass_LOW_default,resmass_default",Binning(rb_x_low),Binning(rb_y_low))); }