#include #include #include #include #include #include #include "TStyle.h" #include "TROOT.h" #include "TPluginManager.h" #include "TSystem.h" #include "TFile.h" #include "TGaxis.h" #include "TCanvas.h" #include "TH1.h" #include "TF1.h" #include "TLine.h" #include "TSpline.h" #include "RooAbsData.h" #include "RooDataHist.h" #include "RooCategory.h" #include "RooDataSet.h" #include "RooRealVar.h" #include "RooAbsPdf.h" #include "RooSimultaneous.h" #include "RooProdPdf.h" #include "RooNLLVar.h" #include "RooProfileLL.h" #include "RooFitResult.h" #include "RooPlot.h" #include "RooRandom.h" #include "RooMinuit.h" #include "TRandom3.h" #include "RooWorkspace.h" #include "RooStats/RooStatsUtils.h" #include "RooStats/ModelConfig.h" #include "RooStats/ProfileLikelihoodCalculator.h" #include "RooStats/LikelihoodInterval.h" #include "RooStats/LikelihoodIntervalPlot.h" #include "TStopwatch.h" #include "RooRandom.h" #include "RooWorkspace.h" #include "RooArgList.h" #include "RooDataHist.h" #include "RooPlot.h" #include "RooFitResult.h" #include "RooStats/BayesianCalculator.h" #include "RooStats/ModelConfig.h" #include "RooStats/SimpleInterval.h" #include "RooStats/MCMCCalculator.h" #include "RooStats/MCMCInterval.h" #include "RooStats/MCMCIntervalPlot.h" #include "RooStats/ProposalHelper.h" #include "RooStats/TestStatistic.h" #include "RooStats/ProfileLikelihoodTestStat.h" #include "RooStats/ToyMCSampler.h" #include "RooStats/FrequentistCalculator.h" #include "RooStats/HypoTestResult.h" #include "RooStats/HistFactory/LinInterpVar.h" // using namespace std; using namespace RooFit; using namespace RooStats; int main(){ // Access the inputs. // Open the ROOT workspace file. TString myInputFileName = "./results/3Gsusy_combined_StopAnalysis_model.root"; cout << "Opening file " << myInputFileName << "..." << endl; TFile *_file0 = TFile::Open(myInputFileName); // Access the workspace. cout << "Accessing workspace..." << endl; RooWorkspace* myWorkspace = (RooWorkspace*) _file0->Get("combined"); // Access the ModelConfig cout << "Accessing ModelConfig..." << endl; ModelConfig* myModelConfig = (ModelConfig*) myWorkspace->obj("ModelConfig"); // Access the data. cout << "Accessing data..." << endl; RooAbsData* myData = myWorkspace->data("obsData"); // Use the ProfileLikelihoodCalculator to calculate the 95% confidence interval on the parameter of interest as specified in the ModelConfig. cout << "Calculating profile likelihood...\n" << endl; ProfileLikelihoodCalculator myProfileLikelihood(*myData, *myModelConfig); myProfileLikelihood.SetConfidenceLevel(0.95); LikelihoodInterval* myConfidenceInterval = myProfileLikelihood.GetInterval(); // Access the confidence interval on the parameter of interest (POI). RooRealVar* myPOI = (RooRealVar*) myModelConfig->GetParametersOfInterest()->first(); myPOI->setConstant(false); //RooRealVar* myPOI = (RooRealVar*) myModelConfig->GetParametersOfInterest()->first(); //double _limitt = mcInt->UpperLimit(*myPOI); double _limit = myConfidenceInterval->UpperLimit(*myPOI); // Print the results. cout << "Printing results..." <GetName()<<" "<GetName()<<": ["<< myConfidenceInterval->LowerLimit(*myPOI) << ", "<< myConfidenceInterval->UpperLimit(*myPOI) <<"]\n"<