00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "RooStats/HybridResult.h"
00017
00018
00019 #include "RooStats/HypoTestInverterPlot.h"
00020 #include "RooStats/HypoTestInverterResult.h"
00021
00022 #include "TGraphErrors.h"
00023
00024 ClassImp(RooStats::HypoTestInverterPlot)
00025
00026 using namespace RooStats;
00027
00028
00029
00030 HypoTestInverterPlot::HypoTestInverterPlot( const char* name,
00031 const char* title,
00032 HypoTestInverterResult* results ) :
00033 TNamed( TString(name), TString(title) ),
00034 fResults(results)
00035 {
00036
00037 }
00038
00039
00040 TGraphErrors* HypoTestInverterPlot::MakePlot()
00041 {
00042 const int nEntries = fResults->ArraySize();
00043
00044 std::vector<Double_t> xArray(nEntries);
00045 std::vector<Double_t> yArray(nEntries);
00046 std::vector<Double_t> yErrArray(nEntries);
00047 for (int i=0; i<nEntries; i++) {
00048 xArray[i] = fResults->GetXValue(i);
00049 yArray[i] = fResults->GetYValue(i);
00050 yErrArray[i] = fResults->GetYError(i);
00051 }
00052
00053
00054 if (nEntries>1) {
00055 int i=1;
00056 int j=2;
00057 while ( i<nEntries ) {
00058 if ( i==0 || xArray[i-1] <= xArray[i] ) {
00059 i=j;
00060 j++;
00061 } else {
00062 double tmp = xArray[i-1];
00063 xArray[i-1] = xArray[i];
00064 xArray[i] = tmp;
00065 tmp = yArray[i-1];
00066 yArray[i-1] = yArray[i];
00067 yArray[i] = tmp;
00068 tmp = yErrArray[i-1];
00069 yErrArray[i-1] = yErrArray[i];
00070 yErrArray[i] = tmp;
00071 i--;
00072 }
00073 }
00074 }
00075
00076 TGraphErrors* graph = new TGraphErrors(nEntries,&xArray.front(),&yArray.front(),0,&yErrArray.front());
00077 graph->SetMarkerStyle(kFullDotMedium);
00078 return graph;
00079 }
00080
00081 HypoTestInverterPlot::~HypoTestInverterPlot()
00082 {
00083
00084 }