Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
Changed: | ||||||||
< < | -- ![]() | |||||||
> > | -- ![]() | |||||||
Line: 1281 to 1281 | ||||||||
Run some code such as the following. For fun, we will create a simulated data signal at about 126 GeV at about three times the number of events of that which was expected. | ||||||||
Changed: | ||||||||
< < | example file: make_test_histograms.c | |||||||
> > | example file: make_test_histograms.cxx | |||||||
| ||||||||
Changed: | ||||||||
< < | { | |||||||
> > | #include | |||||||
// Create the expected signal histogram. | ||||||||
Added: | ||||||||
> > | ||||||||
// Create the function used to describe the signal shape (a simple Gaussian shape). TF1 mySignalFunction("mySignalFunction", "(1/sqrt(2*pi*0.5^2))*2.718^(-(x-126)^2/(2*0.5^2))", 120, 130); // Create the histogram with 100 bins between 120 and 130 GeV. | ||||||||
Line: 1299 to 1346 | ||||||||
TH1F myBackground("myBackground", "myBackground", 100, 120, 130); // Fill the histogram using the background function. myBackground.FillRandom("myBackgroundFunction", 100000000000); | ||||||||
Added: | ||||||||
> > | ||||||||
// Create the (simulated) data histogram. This histogram represents what one might have as real data. | ||||||||
Added: | ||||||||
> > | ||||||||
// Create the histogram using by combining the signal histogram multiplied by 3 with the background histogram. TH1F myData=3*mySignal+myBackground; // Set the name of the histogram. | ||||||||
Changed: | ||||||||
< < | myData->SetName("myData"); | |||||||
> > | myData.SetName("myData"); | |||||||
// Save the histograms created to a ROOT file. TFile myFile("test_histograms.root", "RECREATE"); | ||||||||
Changed: | ||||||||
< < | mySignal->Write(); myBackground->Write(); myData->Write(); | |||||||
> > | mySignal.Write(); myBackground.Write(); myData.Write(); | |||||||
myFile.Close(); | ||||||||
Added: | ||||||||
> > | return 0; | |||||||
} %ENDCODE% | ||||||||
Line: 1339 to 1390 | ||||||||
<-- workspace output file prefix --> | ||||||||
Changed: | ||||||||
< < | ||||||||
> > | ||||||||
<-- channel XML file(s) -->./config/test_channel.xml | ||||||||
Line: 1400 to 1451 | ||||||||
Create a C++ program such as the following: | ||||||||
Changed: | ||||||||
< < | example file: ProfileLikeliHoodCalculator_confidence_level.cpp | |||||||
> > | example file: ProfileLikeliHoodCalculator_confidence_level.cxx | |||||||
| ||||||||
Line: 1447 to 1498 | ||||||||
using namespace RooStats; int main(){ | ||||||||
Changed: | ||||||||
< < | // Access the inputs. | |||||||
> > | ||||||||
// Open the ROOT workspace file. TString myInputFileName = "workspaces/test_workspace_combined_datastat_model.root"; | ||||||||
Changed: | ||||||||
< < | cout << "Opening file " << myInputFileName << "..." << endl; | |||||||
> > | cout << "open file " << myInputFileName << endl; | |||||||
TFile *_file0 = TFile::Open(myInputFileName); // Access the workspace. | ||||||||
Changed: | ||||||||
< < | cout << "Accessing workspace..." << endl; | |||||||
> > | cout << "access workspace" << endl; | |||||||
RooWorkspace* myWorkspace = (RooWorkspace*) _file0->Get("combined"); | ||||||||
Changed: | ||||||||
< < | // Access the ModelConfig cout << "Accessing ModelConfig..." << endl; | |||||||
> > | // Access the ModelConfig. cout << "access ModelConfig..." << endl; | |||||||
ModelConfig* myModelConfig = (ModelConfig*) myWorkspace->obj("ModelConfig"); // Access the data. | ||||||||
Changed: | ||||||||
< < | cout << "Accessing data..." << endl; | |||||||
> > | cout << "accessing data" << endl; | |||||||
RooAbsData* myData = myWorkspace->data("obsData"); | ||||||||
Changed: | ||||||||
< < | // 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; | |||||||
> > | // Use the ProfileLikelihoodCalculator to calculate the 95% confidence // interval on the parameter of interest as specified in the ModelConfig. cout << "calculate profile likelihood" << 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(); | ||||||||
Changed: | ||||||||
< < | // Print the results. cout << "Printing results..." << endl; | |||||||
> > | // Print results. cout << "print results" << endl; | |||||||
// Print the confidence interval on the POI. | ||||||||
Changed: | ||||||||
< < | cout << "\n95% confidence interval on the point of interest " << myPOI->GetName()<<": ["<< | |||||||
> > | cout << "\n95% confidence interval on the point of interest " << myPOI->GetName()<<": ["<< | |||||||
myConfidenceInterval->LowerLimit(*myPOI) << ", "<< myConfidenceInterval->UpperLimit(*myPOI) <<"]\n"<<endl; return 0; | ||||||||
Line: 1485 to 1539 | ||||||||
example file: Makefile | ||||||||
Changed: | ||||||||
< < | ProfileLikeliHoodCalculator_confidence_level.cpp : ProfileLikeliHoodCalculator_confidence_level.cpp g++ -g -O2 -fPIC -Wno-deprecated -o ProfileLikeliHoodCalculator_confidence_level.cpp ProfileLikeliHoodCalculator_confidence_level.cpp `root-config --cflags --libs --ldflags` -lHistFactory -lXMLParser -lRooStats -lRooFit -lRooFitCore -lThread -lMinuit -lFoam -lHtml -lMathMore -I$ROOTSYS/include -L$ROOTSYS/lib | |||||||
> > | ProfileLikeliHoodCalculator_confidence_level : ProfileLikeliHoodCalculator_confidence_level.cxx g++ -g -O2 -fPIC -Wno-deprecated -o ProfileLikeliHoodCalculator_confidence_level ProfileLikeliHoodCalculator_confidence_level.cxx `root-config --cflags --libs --ldflags` -lHistFactory -lXMLParser -lRooStats -lRooFit -lRooFitCore -lThread -lMinuit -lFoam -lHtml -lMathMore | |||||||
%ENDCODE% Compile the code. |