Beispiel #1
0
int main(int argc, char *argv[])
{
    printSizeOfTypes();
    printLimits();
    pointersFunction();
    printPointersToFunction();

    return 0;
}
Beispiel #2
0
QString MultiModelPrinter::print(QTextDocument * document)
{
  if (document) document->clear();

  QString str = "<table border='1' cellspacing='0' cellpadding='3' width='100%' style='font-family: monospace;'>";
  str += printSetup();
  if (firmware->getCapability(FlightModes))
    str += printFlightModes();
  str += printInputs();
  str += printMixers();
  str += printLimits();
  str += printCurves(document);
  if (firmware->getCapability(Gvars) && !firmware->getCapability(GvarsFlightModes))
    str += printGvars();
  str += printLogicalSwitches();
  str += printCustomFunctions();
  str += printTelemetry();
  str += "</table>";
  return str;
}
Beispiel #3
0
printDialog::printDialog(QWidget *parent, EEGeneral *gg, SKYModelData *gm) :
    QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
    ui(new Ui::printDialog)
{
    ui->setupUi(this);
    g_model = gm;
    g_eeGeneral = gg;
    te = ui->textEdit;

    setWindowTitle(tr("Setup for: ") + getModelName());
    ui->textEdit->clear();

    printTitle();

    printSetup();
    printExpo();
    printMixes();
    printLimits();
    printCurves();
    printSwitches();
    printSafetySwitches();

    te->scrollToAnchor("1");
}
Beispiel #4
0
void plotLimit(string outputDir="./", TString inputs="", TString inputs_blinded="", TString inputXSec="", bool strengthLimit=true, bool blind=false, double energy=7, double luminosity=5.035, TString legendName="ee and #mu#mu channels")
{
   setTDRStyle();  
   gStyle->SetPadTopMargin   (0.05);
   gStyle->SetPadBottomMargin(0.12);
   gStyle->SetPadRightMargin (0.16);
   gStyle->SetPadLeftMargin  (0.14);
   gStyle->SetTitleSize(0.04, "XYZ");
   gStyle->SetTitleXOffset(1.1);
   gStyle->SetTitleYOffset(1.45);
   gStyle->SetPalette(1);
   gStyle->SetNdivisions(505);
  
  //get the limits from the tree
  TFile* file = TFile::Open(inputs);
  printf("Looping on %s\n",inputs.Data());
  if(!file) return;
  if(file->IsZombie()) return;
  TFile* file_blinded = TFile::Open(inputs_blinded);
  printf("Looping on %s\n",inputs_blinded.Data());
  if(!file_blinded) return;
  if(file_blinded->IsZombie()) return;
  TTree* tree_blinded = (TTree*)file_blinded->Get("limit");
  tree_blinded->GetBranch("mh"              )->SetAddress(&Tmh      );
  tree_blinded->GetBranch("limit"           )->SetAddress(&Tlimit   );
  tree_blinded->GetBranch("limitErr"        )->SetAddress(&TlimitErr);
  tree_blinded->GetBranch("quantileExpected")->SetAddress(&TquantExp);
  TGraph* ExpLimitm2 = getLimitGraph(tree_blinded,0.025);
  TGraph* ExpLimitm1 = getLimitGraph(tree_blinded,0.160);
  TGraph* ExpLimit   = getLimitGraph(tree_blinded,0.500);
  TGraph* ExpLimitp1 = getLimitGraph(tree_blinded,0.840);
  TGraph* ExpLimitp2 = getLimitGraph(tree_blinded,0.975);
  file_blinded->Close(); 
  TTree* tree = (TTree*)file->Get("limit");
  tree->GetBranch("mh"              )->SetAddress(&Tmh      );
  tree->GetBranch("limit"           )->SetAddress(&Tlimit   );
  tree->GetBranch("limitErr"        )->SetAddress(&TlimitErr);
  tree->GetBranch("quantileExpected")->SetAddress(&TquantExp);
  TGraph* ObsLimit   = getLimitGraph(tree,-1   ); 
  file->Close(); 

  FILE* pFileSStrenght = fopen((outputDir+"SignalStrenght").c_str(),"w");
  std::cout << "Printing Signal Strenght" << std::endl;
  for(int i=0;i<ExpLimit->GetN();i++){
     double M = ExpLimit->GetX()[i];
     std::cout << "Mass: " << M << "; ExpLimit: " << ExpLimit->Eval(M) << std::endl; 
     printf("$%8.6E$ & $%8.6E$ & $[%8.6E,%8.6E]$ & $[%8.6E,%8.6E]$ \\\\\\hline\n",M, ExpLimit->Eval(M), ExpLimitm1->Eval(M), ExpLimitp1->Eval(M), ExpLimitm2->Eval(M),  ExpLimitp2->Eval(M));
     fprintf(pFileSStrenght, "$%8.6E$ & $%8.6E$ & $[%8.6E,%8.6E]$ & $[%8.6E,%8.6E]$ & $%8.6E$ \\\\\\hline\n",M, ExpLimit->Eval(M), ExpLimitm1->Eval(M), ExpLimitp1->Eval(M), ExpLimitm2->Eval(M),  ExpLimitp2->Eval(M), ObsLimit->Eval(M));
    if(int(ExpLimit->GetX()[i])%50!=0)continue; //printf("%f ",ObsLimit->Eval(M));
  }printf("\n");
  fclose(pFileSStrenght); 
 

  //get the pValue
  inputs = inputs.ReplaceAll("/LimitTree", "/PValueTree");
  file = TFile::Open(inputs);
  
  printf("Looping on %s\n",inputs.Data());
  if(!file) return;
  if(file->IsZombie()) return;
  
  tree = (TTree*)file->Get("limit");
  
  tree->GetBranch("limit"           )->SetAddress(&Tlimit   );
  
  TGraph* pValue     = getLimitGraph(tree,-1);
  
  file->Close();

  
  //make TH Cross-sections
   string suffix = outputDir;
   TGraph* THXSec   = Hxswg::utils::getXSec(outputDir); 
   scaleGraph(THXSec, 1000);  //convert cross-section to fb
   double cprime=1.0; double  brnew=0.0;
   double XSecScaleFactor = 1.0;
   if(suffix.find("_cp")!=string::npos){
     sscanf(suffix.c_str()+suffix.find("_cp"), "_cp%lf_brn%lf", &cprime, &brnew);
     XSecScaleFactor = pow(cprime,2) * (1-brnew);
   }
  //XSecScaleFactor = 0.001; //pb to fb
  scaleGraph(THXSec, XSecScaleFactor);


  string prod = "pp_SM";
  if(outputDir.find("ggH")!=std::string::npos)prod="gg";
  if(outputDir.find("qqH")!=std::string::npos)prod="qq";
  if(outputDir.find("ppH")!=std::string::npos)prod="pp";

  
  strengthLimit = false;
  if(prod=="pp_SM")strengthLimit=true;
 
  //TGraph *XSecMELA = Hxswg::utils::getXSecMELA(cprime);

  //Hxswg::utils::multiplyGraph(   ObsLimit, XSecMELA);
  //Hxswg::utils::multiplyGraph( ExpLimitm2, XSecMELA);
  //Hxswg::utils::multiplyGraph( ExpLimitm1, XSecMELA);
  //Hxswg::utils::multiplyGraph(   ExpLimit, XSecMELA);
  //Hxswg::utils::multiplyGraph( ExpLimitp1, XSecMELA);
  //Hxswg::utils::multiplyGraph( ExpLimitp2, XSecMELA);
 
  //Scale exclusion XSec in fb
  scaleGraph(ObsLimit  , 0.001); //pb to fb
  scaleGraph(ExpLimitm2, 0.001); //pb to fb
  scaleGraph(ExpLimitm1, 0.001); //pb to fb
  scaleGraph(ExpLimit  , 0.001); //pb to fb
  scaleGraph(ExpLimitp1, 0.001); //pb to fb
  scaleGraph(ExpLimitp2, 0.001); //pb to fb

  //scal eTH cross-section and limits according to scale factor 
  //this only apply to NarrowResonnance case
  if(strengthLimit){
     Hxswg::utils::divideGraph(ObsLimit   , THXSec);
     Hxswg::utils::divideGraph(ExpLimitm2 , THXSec);
     Hxswg::utils::divideGraph(ExpLimitm1 , THXSec);
     Hxswg::utils::divideGraph(ExpLimit   , THXSec);
     Hxswg::utils::divideGraph(ExpLimitp1 , THXSec);
     Hxswg::utils::divideGraph(ExpLimitp2 , THXSec);
     Hxswg::utils::divideGraph(THXSec     , THXSec);
  }


  //limits in terms of signal strength
  TCanvas* c = new TCanvas("c", "c",800,800);
  c->SetGridx();
  c->SetGridy();
  TH1F* framework = new TH1F("Graph","Graph",1,strengthLimit?199:199,2500); //3000);
  framework->SetStats(false);
  framework->SetTitle("");
  framework->GetXaxis()->SetTitle("M_{H} [GeV]");
  framework->GetYaxis()->SetTitleOffset(1.70);
  if(strengthLimit){
  framework->GetYaxis()->SetTitle("#mu = #sigma_{95%} / #sigma_{th}");
  framework->GetYaxis()->SetRangeUser(1E-4,1E3);
  c->SetLogy(true);
  }else{
  framework->GetYaxis()->SetTitle((string("#sigma_{95%} (") + prod +" #rightarrow H #rightarrow ZZ) (pb)").c_str());
  framework->GetYaxis()->SetRangeUser(1E-3,1E3);
  c->SetLogy(true);
  }
  framework->GetXaxis()->SetLabelOffset(0.007);
  framework->GetXaxis()->SetLabelSize(0.03);
  framework->GetXaxis()->SetTitleOffset(1.0);
  framework->GetXaxis()->SetTitleFont(42);
  framework->GetXaxis()->SetTitleSize(0.035);
  framework->GetYaxis()->SetLabelFont(42);
  framework->GetYaxis()->SetLabelOffset(0.007);
  framework->GetYaxis()->SetLabelSize(0.03);
  framework->GetYaxis()->SetTitleOffset(1.3);
  framework->GetYaxis()->SetTitleFont(42);
  framework->GetYaxis()->SetTitleSize(0.035);
  framework->Draw();

  
  TGraph* TGObsLimit   = ObsLimit;  TGObsLimit->SetLineWidth(2);
  TGraph* TGExpLimit   = ExpLimit;  TGExpLimit->SetLineWidth(2); TGExpLimit->SetLineStyle(2);
  TCutG* TGExpLimit1S  = GetErrorBand("1S", ExpLimitm1, ExpLimitp1);  
  TCutG* TGExpLimit2S  = GetErrorBand("2S", ExpLimitm2, ExpLimitp2);  TGExpLimit2S->SetFillColor(5);
  THXSec->SetLineWidth(2); THXSec->SetLineStyle(1); THXSec->SetLineColor(4);

  TGExpLimit->SetLineColor(1);  TGExpLimit->SetLineStyle(2);
  TGObsLimit->SetLineWidth(2);  TGObsLimit->SetMarkerStyle(20);
  TGExpLimit2S->Draw("fc same");
  TGExpLimit1S->Draw("fc same");
  if(!blind) TGObsLimit->Draw("same P");
  TGExpLimit->Draw("same c");

  
  /*if(strengthLimit){
     TLine* SMLine = new TLine(framework->GetXaxis()->GetXmin(),1.0,framework->GetXaxis()->GetXmax(),1.0);
     SMLine->SetLineWidth(2); SMLine->SetLineStyle(1); SMLine->SetLineColor(4);      
     SMLine->Draw("same C");
  }else{
     THXSec->Draw("same C");
  }*/

  utils::root::DrawPreliminary(luminosity, energy, c);

  
  TLegend* LEG = new TLegend(0.55,0.75,0.85,0.95);
  LEG->SetHeader("");
  LEG->SetFillColor(0);
  LEG->SetFillStyle(0);
  LEG->SetTextFont(42);
  LEG->SetBorderSize(0);
  //LEG->AddEntry(THXSec  , "Th prediction"  ,"L");
  LEG->AddEntry(TGExpLimit  , "median expected"  ,"L");
  LEG->AddEntry(TGExpLimit1S  , "expected #pm 1#sigma"  ,"F");
  LEG->AddEntry(TGExpLimit2S  , "expected #pm 2#sigma"  ,"F");
  if(!blind) LEG->AddEntry(TGObsLimit  , "observed"  ,"LP");
  LEG->Draw();
  c->RedrawAxis();
  c->SaveAs((outputDir+"Limit.png").c_str());
  c->SaveAs((outputDir+"Limit.C").c_str());
  c->SaveAs((outputDir+"Limit.pdf").c_str()); 

  
  //save a summary of the limits
  FILE* pFileSum = fopen((outputDir+"LimitSummary").c_str(),"w");
  for(int i=0;i<TGExpLimit->GetN();i++){
     double M = ExpLimit->GetX()[i];
     fprintf(pFileSum, "$%8.6E$ & $%8.6E$ & $[%8.6E,%8.6E]$ & $[%8.6E,%8.6E]$ & $%8.6E$ & Th=$%8.6E$ & pValue=$%8.6E$\\\\\\hline\n",M, ExpLimit->Eval(M), ExpLimitm1->Eval(M), ExpLimitp1->Eval(M), ExpLimitm2->Eval(M),  ExpLimitp2->Eval(M), ObsLimit->Eval(M), (THXSec!=NULL)?THXSec->Eval(M):-1, pValue->Eval(M));
    if(int(ExpLimit->GetX()[i])%50!=0)continue; printf("%f ",ObsLimit->Eval(M));
  }printf("\n");
  fclose(pFileSum);

  pFileSum = fopen((outputDir+"LimitRange").c_str(),"w");
  fprintf(pFileSum, "EXPECTED LIMIT --> ");                   printLimits(pFileSum,TGExpLimit, TGExpLimit->GetX()[0], TGExpLimit->GetX()[TGExpLimit->GetN()-1]);
  if(!blind) fprintf(pFileSum, "OBSERVED LIMIT --> ");        printLimits(pFileSum,TGObsLimit, TGObsLimit->GetX()[0], TGObsLimit->GetX()[TGObsLimit->GetN()-1]);
  fprintf(pFileSum, "Exp Limits for Model are: ");              for(int i=0;i<TGExpLimit->GetN();i++){if(int(TGExpLimit->GetX()[i])%50==0) fprintf(pFileSum, "%f+-%f ",TGExpLimit->GetY()[i], (ExpLimitp1->GetY()[i]-ExpLimitm1->GetY()[i])/2.0);}fprintf(pFileSum,"\n");
  if(!blind) { fprintf(pFileSum, "Obs Limits for Model are: "); for(int i=0;i<TGObsLimit->GetN();i++){if(int(TGObsLimit->GetX()[i])%50==0) fprintf(pFileSum, "%f ",TGObsLimit->GetY()[i]);}fprintf(pFileSum,"\n"); }
  fclose(pFileSum); 
}
Beispiel #5
0
void plotLimit(TString outputDir="./", TString inputs="", TString inputXSec="", bool strengthLimit=true, bool blind=false, double energy=7, double luminosity=5.035, TString legendName="ee and #mu#mu channels")
{
  //style options
  gStyle->SetCanvasBorderMode(0);
  gStyle->SetCanvasColor(kWhite);
  gStyle->SetFrameBorderMode(0);
  gStyle->SetFrameBorderSize(1);
  gStyle->SetFrameFillColor(0);
  gStyle->SetFrameFillStyle(0);
  gStyle->SetFrameLineColor(1);
  gStyle->SetFrameLineStyle(1);
  gStyle->SetFrameLineWidth(1);
  gStyle->SetOptFit(1);
  gStyle->SetFitFormat("5.4g");
  gStyle->SetFuncColor(2);
  gStyle->SetOptFile(0);
  //gStyle->SetOptStat(0);
  gStyle->SetOptStat("mr");
  gStyle->SetStatColor(kWhite);
  gStyle->SetStatFont(42);
  gStyle->SetStatFontSize(0.04);
  gStyle->SetStatTextColor(1);
  gStyle->SetStatFormat("6.4g");
  gStyle->SetStatBorderSize(1);
  gStyle->SetStatH(0.1);
  gStyle->SetStatW(0.2);
  gStyle->SetPadTopMargin(0.05);
  gStyle->SetPadBottomMargin(0.13);
  gStyle->SetPadLeftMargin(0.16);
  gStyle->SetPadRightMargin(0.02);
  gStyle->SetOptTitle(0);
  gStyle->SetTitleFont(42);
  gStyle->SetTitleColor(1);
  gStyle->SetTitleTextColor(1);
  gStyle->SetTitleFillColor(10);
  gStyle->SetTitleFontSize(0.05);
  gStyle->SetAxisColor(1, "XYZ");
  gStyle->SetStripDecimals(kTRUE);
  gStyle->SetTickLength(0.03, "XYZ");
  gStyle->SetNdivisions(510, "XYZ");
  gStyle->SetPadTickX(1);  // To get tick marks on the opposite side of the frame
  gStyle->SetPadTickY(1);
  gStyle->SetEndErrorSize(2);
  gStyle->SetErrorX(0.);
  gStyle->SetMarkerStyle(20); 
  gROOT->ForceStyle();
  gStyle->SetPadTopMargin   (0.06);
  gStyle->SetPadBottomMargin(0.12);
  gStyle->SetPadRightMargin (0.06);
  gStyle->SetPadLeftMargin  (0.14);
  gStyle->SetTitleSize(0.04, "XYZ");
  gStyle->SetTitleXOffset(1.1);
  gStyle->SetTitleYOffset(1.45);
  gStyle->SetPalette(1);
  gStyle->SetNdivisions(505);


  string suffix = string(outputDir.Data());
  double cprime=1.0; double  brnew=0.0;
  double XSecScaleFactor = 1.0;
  if(suffix.find("_cp")!=string::npos){
     sscanf(suffix.c_str()+suffix.find("_cp"), "_cp%lf_brn%lf", &cprime, &brnew);
     XSecScaleFactor = pow(cprime,2) * (1-brnew);
  }
 
  //get xsec * br from summary file
  getXSecXBR(inputXSec); 
  //get the limits from the tree
  TFile* file = TFile::Open(inputs);
  printf("Looping on %s\n",inputs.Data());
  if(!file) return;
  if(file->IsZombie()) return;
  TTree* tree = (TTree*)file->Get("limit");
  tree->GetBranch("mh"              )->SetAddress(&Tmh      );
  tree->GetBranch("limit"           )->SetAddress(&Tlimit   );
  tree->GetBranch("limitErr"        )->SetAddress(&TlimitErr);
  tree->GetBranch("quantileExpected")->SetAddress(&TquantExp);
  int N = tree->GetEntriesFast() / 6 ;// 6Limits per mass point (observed, meand , +-1sigma, +-2sigma)
  double* MassAxis   = new double[N];
  double* ObsLimit   = new double[N];  fillLimitArray(tree,-1   ,ObsLimit,MassAxis);  if(!strengthLimit)scaleLimitsByXSecXBR(N, MassAxis, ObsLimit);
  double* ExpLimitm2 = new double[N];  fillLimitArray(tree,0.025,ExpLimitm2);         if(!strengthLimit)scaleLimitsByXSecXBR(N, MassAxis, ExpLimitm2);
  double* ExpLimitm1 = new double[N];  fillLimitArray(tree,0.160,ExpLimitm1);         if(!strengthLimit)scaleLimitsByXSecXBR(N, MassAxis, ExpLimitm1);
  double* ExpLimit   = new double[N];  fillLimitArray(tree,0.500,ExpLimit  );         if(!strengthLimit)scaleLimitsByXSecXBR(N, MassAxis, ExpLimit);
  double* ExpLimitp1 = new double[N];  fillLimitArray(tree,0.840,ExpLimitp1);         if(!strengthLimit)scaleLimitsByXSecXBR(N, MassAxis, ExpLimitp1);
  double* ExpLimitp2 = new double[N];  fillLimitArray(tree,0.975,ExpLimitp2);         if(!strengthLimit)scaleLimitsByXSecXBR(N, MassAxis, ExpLimitp2);
  file->Close();

  //make TH Cross-sections
  double* ThXSec   = new double[N]; for(unsigned int i=0;i<N;i++){ThXSec[i] = xsecXbr[MassAxis[i]];} 

  //scale TH cross-section and limits according to scale factor 
  //this only apply to NarrowResonnance case
  for(unsigned int i=0;i<N;i++){
    if(strengthLimit){
    ObsLimit[i]  /= XSecScaleFactor;
    ExpLimitm2[i]/= XSecScaleFactor;
    ExpLimitm1[i]/= XSecScaleFactor;
    ExpLimit  [i]/= XSecScaleFactor;
    ExpLimitp1[i]/= XSecScaleFactor;
    ExpLimitp2[i]/= XSecScaleFactor;
    }
    ThXSec[i]    *= XSecScaleFactor;
  }

    
  //limits in terms of signal strength
  TCanvas* c = new TCanvas("c", "c",600,600);
  TH1F* framework = new TH1F("Graph","Graph",1,15,70);
  framework->SetStats(false);
  framework->SetTitle("");
  framework->GetXaxis()->SetTitle("A boson mass [GeV]");
  framework->GetYaxis()->SetTitleOffset(1.70);
  if(strengthLimit){
  framework->GetYaxis()->SetTitle("#mu = #sigma_{95%} / #sigma_{th}");
  framework->GetYaxis()->SetRangeUser(5E-2,5E1);
  c->SetLogy(true);
  }else{
  framework->GetYaxis()->SetTitle("#sigma_{95%} (fb)");
  framework->GetYaxis()->SetRangeUser(1E-1,1E3);
  c->SetLogy(true);
  }
  framework->Draw();

  TGraph* TGObsLimit   = new TGraph(N,MassAxis,ObsLimit);  TGObsLimit->SetLineWidth(2);
  TGraph* TGExpLimit   = new TGraph(N,MassAxis,ExpLimit);  TGExpLimit->SetLineWidth(2); TGExpLimit->SetLineStyle(2);
  TCutG* TGExpLimit1S  = GetErrorBand("1S", N, MassAxis, ExpLimitm1, ExpLimitp1);  
  TCutG* TGExpLimit2S  = GetErrorBand("2S", N, MassAxis, ExpLimitm2, ExpLimitp2);  TGExpLimit2S->SetFillColor(5);
  TGraph* THXSec        = new TGraph(N,MassAxis,ThXSec); THXSec->SetLineWidth(2); THXSec->SetLineStyle(1); THXSec->SetLineColor(4);


  TGExpLimit->SetLineColor(2);  TGExpLimit->SetLineStyle(1);
  TGObsLimit->SetLineWidth(2);  TGObsLimit->SetMarkerStyle(20);
  TGExpLimit2S->Draw("fc same");
  TGExpLimit1S->Draw("fc same");
  if(!blind) TGObsLimit->Draw("same CP");
  TGExpLimit->Draw("same C");

  if(strengthLimit){
     TLine* SMLine = new TLine(framework->GetXaxis()->GetXmin(),1.0,framework->GetXaxis()->GetXmax(),1.0);
     SMLine->SetLineWidth(2); SMLine->SetLineStyle(1); SMLine->SetLineColor(4);      
     SMLine->Draw("same C");
  }else{
     THXSec->Draw("same C");
  }


  TPaveText *pave = new TPaveText(0.1,0.96,0.99,0.99,"NDC");
  char LumiLabel[1024];
  if(energy<9){  sprintf(LumiLabel,"CMS preliminary,  #sqrt{s}=%.0f TeV, #scale[0.5]{#int} L=%6.1ffb^{-1} - %20s",energy, luminosity,legendName.Data());
  }else{         sprintf(LumiLabel,"CMS preliminary,  #sqrt{s}=%.0f TeV #scale[0.5]{#int} L=%6.1ffb^{-1}, #sqrt{s}=%.0f TeV #scale[0.5]{#int} L=%6.1ffb^{-1}",7.0,5.0,8.0,19.7);
  }
  pave->SetBorderSize(0);
  pave->SetFillStyle(0);
  pave->SetTextFont(42);
  TObjArray* tokens = (TString(LumiLabel)).Tokenize("\\\\");
  int nt = tokens->GetEntries();
  for(int it=0; it<nt; ++it){
    TObjString * t = (TObjString *)tokens->At(it);
    pave->AddText(t->GetString());
  }
  pave->Draw("same");


  TLegend* LEG = new TLegend(0.55,0.75,0.85,0.95);
  LEG->SetHeader("Signal XSec x 1000");
  LEG->SetFillColor(0);
  LEG->SetFillStyle(0);
  LEG->SetTextFont(42);
  LEG->SetBorderSize(0);
  LEG->AddEntry(THXSec  , "TH prediction"  ,"L");
  LEG->AddEntry(TGExpLimit  , "median expected"  ,"L");
  LEG->AddEntry(TGExpLimit1S  , "expected #pm 1#sigma"  ,"F");
  LEG->AddEntry(TGExpLimit2S  , "expected #pm 2#sigma"  ,"F");
  if(!blind) LEG->AddEntry(TGObsLimit  , "observed"  ,"LP");
  LEG->Draw();
  c->RedrawAxis();
  c->SaveAs(outputDir+"Limit.png");
  c->SaveAs(outputDir+"Limit.C");
  c->SaveAs(outputDir+"Limit.pdf"); 


  //save a summary of the limits
  FILE* pFileSum = fopen((outputDir+"LimitSummary").Data(),"w");
  for(int i=0;i<N;i++){
    fprintf(pFileSum, "$%8.6E$ & $%8.6E$ & $[%8.6E,%8.6E]$ & $[%8.6E,%8.6E]$ & $%8.6E$ & Th=$%8.6E$\\\\\\hline\n",MassAxis[i], ExpLimit[i], ExpLimitm1[i], ExpLimitp1[i], ExpLimitm2[i],  ExpLimitp2[i], ObsLimit[i], ThXSec[i]);
    if(int(MassAxis[i])%50!=0)continue; printf("%f ",ObsLimit[i]);
  }printf("\n");
  fclose(pFileSum);

  pFileSum = fopen((outputDir+"LimitRange").Data(),"w");
  fprintf(pFileSum, "EXPECTED LIMIT --> ");                   printLimits(pFileSum,TGExpLimit, MassAxis[0], MassAxis[N-1]);
  if(!blind) fprintf(pFileSum, "OBSERVED LIMIT --> ");        printLimits(pFileSum,TGObsLimit, MassAxis[0], MassAxis[N-1]);
  fprintf(pFileSum, "Exp Limits for Model are: ");              for(int i=0;i<N;i++){if(int(MassAxis[i])%50!=0)continue; fprintf(pFileSum, "%f+-%f ",ExpLimit[i], (ExpLimitp1[i]-ExpLimitm1[i]))/2.0;}fprintf(pFileSum,"\n");
  if(!blind) { fprintf(pFileSum, "Obs Limits for Model are: "); for(int i=0;i<N;i++){if(int(MassAxis[i])%50!=0)continue; fprintf(pFileSum, "%f ",ObsLimit[i]);}fprintf(pFileSum,"\n"); }
  fclose(pFileSum);
}