int main() { float min_logL1 = 5986.94; float min_logL0 = 5987.16; string filepath="FINAL_RESULT_AB.root_RESULT__RESULT"; filepath="/shome/buchmann/KillerKoala/CBAF/Development/exchange/RooFit__WorkSpace__Exchange_201417_175622__RNSG_46692.4.root__RESULT__RESULT"; // final MCwS filepath="/shome/buchmann/KillerKoala/CBAF/Development/exchange/RooFit__WorkSpace__Exchange_201417_175622__RNSG_46692.4.root__RESULT__RESULT"; filepath="/shome/buchmann/KillerKoala/CBAF/Development/exchange/RooFit__WorkSpace__Exchange_201417_141126__RNSG_97048.1.root__RESULT__RESULT"; // ************************************************************************************* setlumi(PlottingSetup::luminosity); setessentialcut(PlottingSetup::essential); // this sets the essential cut; this one is used in the draw command so it is AUTOMATICALLY applied everywhere. IMPORTANT: Do NOT store weights here! stringstream resultsummary; // write_analysis_type(PlottingSetup::RestrictToMassPeak,PlottingSetup::DoBTag); do_png(true); do_pdf(true); do_eps(false); do_C(true); do_root(false); PlottingSetup::directoryname = "pValuePlot"; gROOT->SetStyle("Plain"); bool do_fat_line = false; // if you want to have HistLineWidth=1 and FuncWidth=1 as it was before instead of 2 setTDRStyle(do_fat_line); gStyle->SetTextFont(42); bool showList = true; set_directory(PlottingSetup::directoryname); // Indicate the directory name where you'd like to save the output files in Setup.C set_treename("events"); // you can set the treename here to be used; options are "events" (for reco) for "PFevents" (for particle flow) TFile *f = new TFile(filepath.c_str()); if(f->IsZombie()) { cout << "Seems to be a zombie. goodbye." << endl; return -1; } RooWorkspace *wa = (RooWorkspace*)f->Get("transferSpace"); RooPlot *plot = (RooPlot*) wa->obj("frame_mlledge_109fde50"); // cout << plot << endl; wa->Print("v"); TCanvas *can = new TCanvas("can","can"); cout << "Address of plot : " << plot << endl; // plot->Draw(); float pVal_mllmin=35; float pVal_mllmax=90; int is_data=PlottingSetup::data; vector < std::pair < float, float> > loglikelihoods; string function=""; for(int i=0; i< plot->numItems();i++){ string name = plot->getObject(i)->GetName(); if (plot->getObject(i)->IsA()->InheritsFrom( "RooCurve" ))function=name; } RooCurve* curve = (RooCurve*) plot->findObject(function.c_str(),RooCurve::Class()) ; if (!curve) { dout << "RooPlot::residHist(" << plot->GetName() << ") cannot find curve" << endl ; return 0 ; } int iMinimum=0; float min=1e7; for(int i=0;i<curve->GetN();i++) { double x,y; curve->GetPoint(i,x,y); if(y<min & y>=0) { min=y; iMinimum=i; } } double x,y; curve->GetPoint(iMinimum,x,y); cout << "Minimum is at " << x << " : " << y << endl; loglikelihoods.push_back(make_pair(x,y+min_logL1)); //move right starting from the minimum for(int i=iMinimum+1;i<curve->GetN();i++) { float yold=y; curve->GetPoint(i,x,y); //if(abs((y-yold)/yold)>0.5) continue; loglikelihoods.push_back(make_pair(x,y+min_logL1)); } /* for(int i=0;i<curve->GetN();i++) { double x,y; curve->GetPoint(i,x,y); loglikelihoods.push_back(make_pair(x,y+min_logL1)); }*/ cout << "The whole thing contains " << loglikelihoods.size() << " points " << endl; ProduceSignificancePlots(min_logL0, loglikelihoods, pVal_mllmin, pVal_mllmax, is_data, "", ""); can->SaveAs("Crap.png"); delete can; delete plot; delete wa; f->Close(); return 0; }