Example #1
0
TMultiGraph *time_series( TGraph *g[], TString legend[], TString ptitle, TString ytitle, Int_t nsensor ) {
  TMultiGraph *mg = new TMultiGraph( "mg", "mg" );
  TLegend *leg = new TLegend(0.8680651,0.7870257,0.9982345,0.9987,NULL,"brNDC");
  
  Int_t icolor = 1;
  
  for ( Int_t i = 0; i < nsensor; i++ ) {
    g[i]->SetMarkerColor( icolor );
    g[i]->SetLineColor( icolor++ );
    leg->AddEntry( g[i], legend[i], "L" );
    mg->Add( g[i], "p" );
  }
  
  mg->Draw("a");
   
  // Make changes to axis after drawing, otherwise they don't exist
  mg->SetTitle( ptitle );
  mg->GetYaxis()->SetTitle( ytitle );

  mg->GetXaxis()->SetTimeDisplay(1);
  mg->GetXaxis()->SetNdivisions(-504); 
  mg->GetXaxis()->SetTitleOffset( 0.4 );
  mg->GetXaxis()->SetLabelOffset( 0.05 );
  mg->GetXaxis()->SetTimeFormat("#splitline{%m/%d/%y}{%H:%M:%S}");
  mg->GetXaxis()->SetTimeOffset(0); 
  leg->SetFillColor(0);
  leg->Draw();
  
  return mg;
}
Example #2
0
TMultiGraph *entry(const char *y_vs_x="help", TCut case1="", TCut case2="", TCut common="", Int_t entryNo=0
      , Int_t marker=7, Int_t color1=2, Int_t color2=4)
{
   if (strcmp(y_vs_x,"help")==0) {
      cout<< "Draws:    y vs x for tree with name \"t\" for conditions case1 and case2" <<endl;
      cout<< "Usage:    entry(y_vs_x, TCut case1, TCut case2, TCut common, Int_t entryNo, Int_t marker=7, Int_t color1=2, Int_t color2=4)" <<endl;
      cout<< "Example:  entry(\"y:x\", \"ch==1\", \"ch==2\", \"x>0&&x<20\", 9)" <<endl;
      return 0;
   }

   TTree *t = (TTree*) gDirectory->Get("t");
   if (!t) {
      cout<< "No tree \"t\" found" <<endl;
      return 0;
   }

   Long64_t nselected = 0;
   nselected = t->Draw(y_vs_x, common+case1, "", 1, entryNo);
   if (nselected == 0) {
      cout<< "--> case1 " << case1.GetTitle() << ": nselected == 0" <<endl;
      return 0;
   }
   TGraph* gr1 = gtempClone("gr1");
   gr1->SetMarkerStyle(marker);
   gr1->SetMarkerColor(color1);
   gr1->SetLineColor(color1);

   nselected = t->Draw(y_vs_x, common+case2, "", 1, entryNo);
   if (nselected == 0) {
      cout<< "--> case2 " << case2.GetTitle() << ": nselected == 0" <<endl;
      return 0;
   }
   TGraph* gr2 = gtempClone("gr2");
   gr2->SetMarkerStyle(marker);
   gr2->SetMarkerColor(color2);
   gr2->SetLineColor(color2);

   if (gROOT->GetListOfCanvases()->Last()) gPad->Clear();
   TMultiGraph* mg = new TMultiGraph();
   mg->SetTitle(Form("entry %d for %s and %s   %s",entryNo,case1.GetTitle(),case2.GetTitle(),common.GetTitle()));
   mg->Add(gr1,"pl");
   mg->Add(gr2,"pl");
   mg->Draw("aw");

   gPad->Modified();
   gPad->Update();

   return mg;
}
Example #3
0
TCanvas *exclusiongraph() {
   // Draw three graphs with an exclusion zone.
   //Author: Olivier Couet
   
   TCanvas *c1 = new TCanvas("c1","Exclusion graphs examples",200,10,600,400);
   c1->SetGrid();

   TMultiGraph *mg = new TMultiGraph();
   mg->SetTitle("Exclusion graphs");

   const Int_t n = 35;
   Double_t x1[n], x2[n], x3[n], y1[n], y2[n], y3[n];
   for (Int_t i=0;i<n;i++) {
     x1[i]  = i*0.1;
     x2[i]  = x1[i];
     x3[i]  = x1[i]+.5;
     y1[i] = 10*sin(x1[i]);
     y2[i] = 10*cos(x1[i]);
     y3[i] = 10*sin(x1[i])-2;
   }

   TGraph *gr1 = new TGraph(n,x1,y1);
   gr1->SetLineColor(2);
   gr1->SetLineWidth(1504);
   gr1->SetFillStyle(3005);

   TGraph *gr2 = new TGraph(n,x2,y2);
   gr2->SetLineColor(4);
   gr2->SetLineWidth(-2002);
   gr2->SetFillStyle(3004);
   gr2->SetFillColor(9);

   TGraph *gr3 = new TGraph(n,x3,y3);
   gr3->SetLineColor(5);
   gr3->SetLineWidth(-802);
   gr3->SetFillStyle(3002);
   gr3->SetFillColor(2);

   mg->Add(gr1);
   mg->Add(gr2);
   mg->Add(gr3);
   mg->Draw("AC");

   return c1;
}
// make graphs for the project
void graph_project(plot_args args, bool adjust_time) {

  // declare canvas, graphs, multigraph, legend
  TCanvas *c1 = new TCanvas("c1", "Thermal Profile", 200, 10, 700, 500);
  TGraph *graphs[args.num_channels];
  TMultiGraph *mg = new TMultiGraph();
  string mg_title = args.title + ";" + "Time elapsed (min); Temperature (C)";
  mg->SetTitle(mg_title.c_str());

  // make legend
  TLegend *leg = make_legend();

  // make graphs and add to multigraph
  string directory = "./THERM_TESTS/" + args.projects[0] + "/" + args.projects[0] + "_ch";
  for(int i=0; i<args.num_channels; i++) {

    // file to open: time_adjusted or raw
    string file;
    if (args.time_shifts[0]==0 && args.time_cut==0) {
      file = directory + to_string(i) + ".txt";
      cout << file << endl;
    }
    else {
      file = "./THERM_TESTS/TEMP/temp_ch" + to_string(i) + ".txt";
    }
    // make graph from the obtained file
    graphs[i] = new TGraph(file.c_str());
    graphs[i]->SetLineWidth(2);
    graphs[i]->SetMarkerColorAlpha(i+1, 0);
    graphs[i]->SetLineColor(i+1);
    graphs[i]->SetFillColor(0);

    //add to multigraph and legend
    mg->Add(graphs[i]);
    leg->AddEntry(graphs[i], (args.leg_labels[i]).c_str()); 
  }

  // draw multigraph and legend; return.
  mg->Draw("ACP");
  leg->Draw();
  return;
}
Example #5
0
void ExpManager::DrawMap(TString NameTitle, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax) {

    TMultiGraph *mg = new TMultiGraph();
    
    //Draw a cross
    TGraphErrors *frame = new TGraphErrors(); //= new TGraph2DErrors(np, x_array, y_array, bz_array, ex, ey, ez);
    frame->SetPoint(0,+0,+100);
    frame->SetPoint(1,+0,-100);
    frame->SetPoint(2,0,0); 
    frame->SetPoint(3,-100,0); 
    frame->SetPoint(4,+100,0);
    frame->SetPoint(5,+0,+0); 
    frame->SetPoint(6,+0,-100);
    frame->SetMarkerColor(kWhite);
    frame->SetDrawOption("ap");
    
    //Draw the map 
    TGraphErrors *fGraph = new TGraphErrors(); //= new TGraph2DErrors(np, x_array, y_array, bz_array, ex, ey, ez);
    fGraph->SetMarkerSize(1.2);
    fGraph->SetMarkerStyle(20);
    fGraph->SetMarkerColor(kBlue);
    fGraph->SetLineColor(kBlue);
    fGraph->SetLineWidth(1);
    //fGraph->SetDrawOption("ap");
    
    int graph_counter = 0 ; 
   for (unsigned i=0; i< fExpY.size(); i++)   {
        if( (fExpX.at(i) >= xmin && fExpX.at(i) <= xmax) && (fExpY.at(i) >= ymin && fExpY.at(i) <= ymax) && (fExpZ.at(i) >= zmin && fExpZ.at(i) <= zmax) ) {
            fGraph->SetPoint(graph_counter,fExpX.at(i),fExpY.at(i));    
            fGraph->SetPointError(graph_counter,fExpXErr.at(i),fExpYErr.at(i)); 
            graph_counter++;
        } 
   }

    //fGraph->Write();
    mg->SetTitle(NameTitle+Form(" Map : %.2f < X < %.2f mm    %.2f < Y < %.2f mm    %.2f < Z < %.2f mm;X (mm);Y (mm)",xmin,xmax,ymin,ymax,zmin,zmax));
    mg->SetName(NameTitle+Form("_Map__X_%.2f_%.2fmm__Y_%.2f_%.2fmm__Z_%.2f_%.2fmm",xmin,xmax,ymin,ymax,zmin,zmax));
    mg->Add(frame); 
    mg->Add(fGraph);
    mg->Write();
}
void drawZShiftsOmega(){
  TCanvas* c1 = new TCanvas("c1","c1",600,600);

  TMultiGraph* mgr = new TMultiGraph();
  mgr->SetTitle("Omega: dz_{0}");

  TGraphErrors* gr_dz0_sig = new TGraphErrors("ZShiftSigOmega.txt","%lg %*lg %lg %lg");
  gr_dz0_sig->SetMarkerStyle(21);
  gr_dz0_sig->SetMarkerColor(kBlue);
  mgr->Add(gr_dz0_sig);

  TGraphErrors* gr_dz0_asc = new TGraphErrors("ZShiftAscOmega.txt","%lg %*lg %lg %lg");
  gr_dz0_asc->SetMarkerStyle(21);
  gr_dz0_asc->SetMarkerColor(kRed);
  mgr->Add(gr_dz0_asc);

  mgr->Draw("ASP");

  c1->Update();
  c1->Print("c1.png");
  c1->Print("c1.root");

  return;
}
Example #7
0
int main(int argc, char** argv)
{

  std::string plot_type = argv[1];
    //"HVScan";
  //    std::string plot_type = "AngScanHigh";
  //  std::string plot_type = "scanX0_HVLow_50";
  //  std::string plot_type = "scanX0_HVLow_20";
  std::cout<<plot_type<<std::endl;

  TFile* inF_GaAsEm;
  //TFile* inF_GaAsEm_OFF;
  TFile* inF_MultiAlkEm;
  //TFile* inF_MultiAlkEm_OFF;
  TFile* inF_Double9090;
  TFile* inF_Double9040;
  TFile* inF_Double9090b;
  TFile* inF_Double9040b;

  TMultiGraph *mg = new TMultiGraph();

  TLegend *legC;

  if(plot_type == "HV12"){
    legC = new TLegend(0.12,0.62,0.30,0.87,NULL,"brNDC");

	//plot name MCPName_ScanType_HVScanScanType_MCPName
    inF_MultiAlkEm = TFile::Open("plots/efficiency_studies/MultiAlkEm_HV12_HVScan12_MultiAlkEm.root");
    inF_GaAsEm = TFile::Open("plots/efficiency_studies/GaAsEm_HV12_HVScan12_GaAsEm.root");
    //inF_GaAsEm_OFF = TFile::Open("plots/efficiency_studies/GaAsEm_HV_HVScan7.root");
    inF_Double9090 = TFile::Open("plots/efficiency_studies/Double9090_HV12_HVScan12_Double9090.root");
    inF_Double9040 = TFile::Open("plots/efficiency_studies/Double9040_HV12_HVScan12_Double9040.root");    
    TGraphErrors* eff_GaAsEm = (TGraphErrors*)inF_GaAsEm->Get("eff");
    TGraphErrors* eff_MultiAlkEm = (TGraphErrors*)inF_MultiAlkEm->Get("eff");
    TGraphErrors* eff_Double9040 = (TGraphErrors*)inF_Double9040->Get("eff");
    TGraphErrors* eff_Double9090 = (TGraphErrors*)inF_Double9090->Get("eff");

    //settings
    eff_GaAsEm->SetMarkerColor(kGreen+1);
    eff_GaAsEm->SetLineColor(kGreen+1);
    //eff_GaAsEm_OFF->SetMarkerColor(kGreen+1);
    //eff_GaAsEm_OFF->SetLineColor(kGreen+1);
    eff_Double9040->SetMarkerColor(kBlue);
    eff_Double9040->SetLineColor(kBlue);
    eff_Double9090->SetMarkerColor(kRed);
    eff_Double9090->SetLineColor(kRed);
    eff_MultiAlkEm->SetMarkerColor(1);
    eff_MultiAlkEm->SetLineColor(1);
  //
    eff_GaAsEm->SetMarkerStyle(20);
    eff_GaAsEm->SetLineWidth(2);
    eff_GaAsEm->SetMarkerSize(0.9);
//    eff_GaAsEm_OFF->SetMarkerStyle(22);
//    eff_GaAsEm_OFF->SetLineWidth(2);
    eff_Double9040->SetMarkerStyle(20);
    eff_Double9040->SetLineWidth(2);
    eff_Double9040->SetMarkerSize(0.9);
    eff_Double9090->SetMarkerStyle(20);
    eff_Double9090->SetLineWidth(2);
    eff_Double9090->SetMarkerSize(0.9);
    eff_MultiAlkEm->SetMarkerStyle(22);
    eff_MultiAlkEm->SetLineWidth(2);

    legC->SetTextFont(42);
    legC->SetTextSize(0.034);
    legC->SetFillColor(kWhite);
    legC->SetLineColor(kWhite);
    legC->SetShadowColor(kWhite);
    legC->AddEntry(eff_MultiAlkEm, "MultiAlk. emitt. ON: #DeltaV_{12} = 300 V", "p");
    legC->AddEntry(eff_GaAsEm, "GaAs emitt. ON: #DeltaV_{12} = 300 V", "p");
//    legC->AddEntry(eff_GaAsEm_OFF, "GaAs emitt. - iMCP mode", "p");
    legC->AddEntry(eff_Double9040, "Double9040 HV_{1} = HV_{2}", "p");
    legC->AddEntry(eff_Double9090, "Double9090 HV_{1} = HV_{2}", "p");
  
    mg->Add(eff_GaAsEm);
//    mg->Add(eff_GaAsEm_OFF);
    mg->Add(eff_Double9090);
    mg->Add(eff_Double9040);
    mg->Add(eff_MultiAlkEm);

    //    TCanvas* c = new TCanvas("cEff","cEff",400,800);
    TCanvas* c = new TCanvas();
    gPad->SetTicks();
    char plot_name[100];
    std::string command = "if [ ! -e final_plots/ ] ; then mkdir final_plots ; fi";
    system(command.c_str());
    sprintf(plot_name, "final_plots/efficiency_%s.pdf", plot_type.c_str());

    mg->Draw("APL");
    mg->SetTitle("Electron Beam 450 MeV");
    mg->GetXaxis()->SetRangeUser(1200,4000);
    mg->GetXaxis()->SetTitle("HV_{1} (V)");
    mg->GetXaxis()->SetTitleSize(0.05);
    mg->GetYaxis()->SetTitle("Efficiency");
    mg->GetYaxis()->SetTitleSize(0.05);
    mg->SetMaximum(1);
    mg->SetMinimum(0);
    mg->Draw("APL");  
    legC->Draw("same");
    banner4Plot();
    c->Update();

    c->Print(plot_name, "pdf");
    sprintf(plot_name, "final_plots/efficiency_%s.png", plot_type.c_str());
    c->Print(plot_name, "png");

    sprintf(plot_name, "final_plots/efficiency_%s.root", plot_type.c_str());
    c->SaveAs(plot_name, "root");
    sprintf(plot_name, "final_plots/efficiency_%s.C", plot_type.c_str());
    c->SaveAs(plot_name, "C");
  }

/////----------------------------------------------------------------------------//////////////

if(plot_type == "HV1"){
    legC = new TLegend(0.52,0.58,0.80,0.83,NULL,"brNDC");

	//plot name MCPName_ScanType_HVScanScanType_MCPName
    inF_GaAsEm = TFile::Open("plots/efficiency_studies/GaAsEm_HV1_HVScan1_GaAsEm.root");
    //inF_GaAsEm_OFF = TFile::Open("plots/efficiency_studies/GaAsEm_HV_HVScan7.root");
    inF_MultiAlkEm = TFile::Open("plots/efficiency_studies/MultiAlkEm_HV1_HVScan1_MultiAlkEm.root");
    inF_Double9090 = TFile::Open("plots/efficiency_studies/Double9090_HV1_HVScan1_Double9090.root");
    inF_Double9040 = TFile::Open("plots/efficiency_studies/Double9040_HV1_HVScan1_Double9040.root");    
    TGraphErrors* eff_GaAsEm = (TGraphErrors*)inF_GaAsEm->Get("eff");
    TGraphErrors* eff_Double9090 = (TGraphErrors*)inF_Double9090->Get("eff");
    TGraphErrors* eff_MultiAlkEm = (TGraphErrors*)inF_MultiAlkEm->Get("eff");
    TGraphErrors* eff_Double9040 = (TGraphErrors*)inF_Double9040->Get("eff");

    //settings
    eff_GaAsEm->SetMarkerColor(kGreen+1);
    eff_GaAsEm->SetLineColor(kGreen+1);
    //eff_GaAsEm_OFF->SetMarkerColor(kGreen+1);
    //eff_GaAsEm_OFF->SetLineColor(kGreen+1);
    eff_Double9040->SetMarkerColor(kBlue);
    eff_Double9040->SetLineColor(kBlue);
    eff_Double9090->SetMarkerColor(kRed);
    eff_Double9090->SetLineColor(kRed);
    eff_MultiAlkEm->SetMarkerColor(1);
    eff_MultiAlkEm->SetLineColor(1);
  //
    eff_GaAsEm->SetMarkerStyle(20);
    eff_GaAsEm->SetLineWidth(2);
    eff_GaAsEm->SetMarkerSize(0.9);
//    eff_GaAsEm_OFF->SetMarkerStyle(22);
//    eff_GaAsEm_OFF->SetLineWidth(2);
    eff_Double9040->SetMarkerStyle(20);
    eff_Double9040->SetLineWidth(2);
    eff_Double9040->SetMarkerSize(0.9);
    eff_Double9090->SetMarkerStyle(20);
    eff_Double9090->SetLineWidth(2);
    eff_Double9090->SetMarkerSize(0.9);
    eff_MultiAlkEm->SetMarkerStyle(22);
    eff_MultiAlkEm->SetLineWidth(2);

    legC->SetTextFont(42);
    legC->SetTextSize(0.034);
    legC->SetFillColor(kWhite);
    legC->SetLineColor(kWhite);
    legC->SetShadowColor(kWhite);
    legC->AddEntry(eff_MultiAlkEm, "MultiAlk emitt. HV_{2} = 3100 (V)", "p");
    legC->AddEntry(eff_GaAsEm, "GaAs emitt. HV_{2} = 3100 (V)", "p");
//    legC->AddEntry(eff_GaAsEm_OFF, "GaAs emitt. - iMCP mode", "p");
//    legC->AddEntry(eff_Double9040, "Double9040 HV_{2} = 2700 (V)", "p");
//    legC->AddEntry(eff_Double9090, "Double9090 HV_{2} = 2700 (V)", "p");
  
    mg->Add(eff_GaAsEm);
//    mg->Add(eff_GaAsEm_OFF);
    //  mg->Add(eff_Double9090);
    //    mg->Add(eff_Double9040);
    mg->Add(eff_MultiAlkEm);

    //    TCanvas* c = new TCanvas("cEff","cEff",400,800);
    TCanvas* c = new TCanvas();
    gPad->SetTicks();
    char plot_name[100];
    std::string command = "if [ ! -e final_plots/ ] ; then mkdir final_plots ; fi";
    system(command.c_str());
    sprintf(plot_name, "final_plots/efficiency_%s.pdf", plot_type.c_str());

    mg->Draw("APL");
    mg->SetTitle("Electron Beam 450 MeV");
    mg->GetXaxis()->SetRangeUser(1200,4000);
    mg->GetXaxis()->SetTitle("HV_{1} (V)");
    mg->GetXaxis()->SetTitleSize(0.05);
    mg->GetYaxis()->SetTitle("Efficiency");
    mg->GetYaxis()->SetTitleSize(0.05);
    mg->SetMaximum(1);
    mg->SetMinimum(0);
    mg->Draw("APL");  
    legC->Draw("same");
    banner4Plot();
    c->Update();

    c->Print(plot_name, "pdf");
    sprintf(plot_name, "final_plots/efficiency_%s.png", plot_type.c_str());
    c->Print(plot_name, "png");

    sprintf(plot_name, "final_plots/efficiency_%s.root", plot_type.c_str());
    c->SaveAs(plot_name, "root");
    sprintf(plot_name, "final_plots/efficiency_%s.C", plot_type.c_str());
    c->SaveAs(plot_name, "C");
  }

/////----------------------------------------------------------------------------//////////////

if(plot_type == "HV2"){
    legC = new TLegend(0.12,0.62,0.40,0.87,NULL,"brNDC");

	//plot name MCPName_ScanType_HVScanScanType_MCPName
    //    inF_GaAsEm = TFile::Open("plots/efficiency_studies/GaAsEm_HV1_HVScan1_GaAsEm.root");
    //inF_GaAsEm_OFF = TFile::Open("plots/efficiency_studies/GaAsEm_HV_HVScan7.root");
    //inF_MultiAlkEm = TFile::Open("plots/efficiency_studies/MultiAlkEm_HV1_HVScan1_MultiAlkEm.root");
    inF_Double9090 = TFile::Open("plots/efficiency_studies/Double9090_HV2_HVScan2_Double9090.root");
    inF_Double9040 = TFile::Open("plots/efficiency_studies/Double9040_HV2_HVScan2_Double9040.root");    
    inF_Double9090b = TFile::Open("plots/efficiency_studies/Double9090_HV1_HVScan1_Double9090.root");
    inF_Double9040b = TFile::Open("plots/efficiency_studies/Double9040_HV1_HVScan1_Double9040.root");    
    //TGraphErrors* eff_GaAsEm = (TGraphErrors*)inF_GaAsEm->Get("eff");
    TGraphErrors* eff_Double9090 = (TGraphErrors*)inF_Double9090->Get("eff");
    TGraphErrors* eff_Double9040 = (TGraphErrors*)inF_Double9040->Get("eff");
    TGraphErrors* eff_Double9090b = (TGraphErrors*)inF_Double9090b->Get("eff");
    TGraphErrors* eff_Double9040b = (TGraphErrors*)inF_Double9040b->Get("eff");

    //settings
    eff_Double9040->SetMarkerColor(kBlue);
    eff_Double9040->SetLineColor(kBlue);
    eff_Double9090->SetMarkerColor(kRed);
    eff_Double9090->SetLineColor(kRed);
  //
    eff_Double9040->SetMarkerStyle(20);
    eff_Double9040->SetLineWidth(2);
    eff_Double9040->SetMarkerSize(0.9);
    eff_Double9090->SetMarkerStyle(20);
    eff_Double9090->SetLineWidth(2);
    eff_Double9090->SetMarkerSize(0.9);


    eff_Double9040b->SetMarkerColor(kBlue);
    eff_Double9040b->SetLineColor(kBlue);
    eff_Double9090b->SetMarkerColor(kRed);
    eff_Double9090b->SetLineColor(kRed);
  //
    eff_Double9040b->SetMarkerStyle(22);
    eff_Double9040b->SetLineWidth(2);
    eff_Double9040b->SetMarkerSize(0.9);
    eff_Double9090b->SetMarkerStyle(22);
    eff_Double9090b->SetLineWidth(2);
    eff_Double9090b->SetMarkerSize(0.9);

    legC->SetTextFont(42);
    legC->SetTextSize(0.034);
    legC->SetFillColor(kWhite);
    legC->SetLineColor(kWhite);
    legC->SetShadowColor(kWhite);
    legC->AddEntry(eff_Double9040, "Double9040 HV_{1} = 2700 (V), scan on HV_{2}", "p");
    legC->AddEntry(eff_Double9090, "Double9090 HV_{1} = 2700 (V), scan on HV_{2}", "p");

    legC->AddEntry(eff_Double9040b, "Double9040 HV_{2} = 2700 (V), scan on HV_{1}", "p");
    legC->AddEntry(eff_Double9090b, "Double9090 HV_{2} = 2700 (V), scan on HV_{1}", "p");
  
    mg->Add(eff_Double9090);
    mg->Add(eff_Double9040);
    mg->Add(eff_Double9090b);
    mg->Add(eff_Double9040b);

    //    TCanvas* c = new TCanvas("cEff","cEff",400,800);
    TCanvas* c = new TCanvas();
    gPad->SetTicks();
    char plot_name[100];
    std::string command = "if [ ! -e final_plots/ ] ; then mkdir final_plots ; fi";
    system(command.c_str());
    sprintf(plot_name, "final_plots/efficiency_%s.pdf", plot_type.c_str());

    mg->Draw("APL");
    mg->SetTitle("Electron Beam 450 MeV");
    mg->GetXaxis()->SetRangeUser(1200,4000);
    mg->GetXaxis()->SetTitle("HV_{1} or HV_{2} (V)");
    mg->GetXaxis()->SetTitleSize(0.05);
    mg->GetYaxis()->SetTitle("Efficiency");
    mg->GetYaxis()->SetTitleSize(0.05);
    mg->SetMaximum(1);
    mg->SetMinimum(0);
    mg->Draw("APL");  
    legC->Draw("same");
    banner4Plot();
    c->Update();

    c->Print(plot_name, "pdf");
    sprintf(plot_name, "final_plots/efficiency_%s.png", plot_type.c_str());
    c->Print(plot_name, "png");

    sprintf(plot_name, "final_plots/efficiency_%s.root", plot_type.c_str());
    c->SaveAs(plot_name, "root");
    sprintf(plot_name, "final_plots/efficiency_%s.C", plot_type.c_str());
    c->SaveAs(plot_name, "C");
  }

/////----------------------------------------------------------------------------//////////////

if(plot_type == "Extreme"){
    legC = new TLegend(0.12,0.72,0.30,0.87,NULL,"brNDC");

	//plot name MCPName_ScanType_HVScanScanType_MCPName
    //    inF_GaAsEm = TFile::Open("plots/efficiency_studies/GaAsEm_HV1_HVScan1_GaAsEm.root");
    //inF_GaAsEm_OFF = TFile::Open("plots/efficiency_studies/GaAsEm_HV_HVScan7.root");
    //inF_MultiAlkEm = TFile::Open("plots/efficiency_studies/MultiAlkEm_HV1_HVScan1_MultiAlkEm.root");
    inF_Double9090 = TFile::Open("plots/efficiency_studies/Double9090_HV1_HVScanExt_Double9090.root");
    inF_Double9040 = TFile::Open("plots/efficiency_studies/Double9040_HV1_HVScanExt_Double9040.root");    
    //TGraphErrors* eff_GaAsEm = (TGraphErrors*)inF_GaAsEm->Get("eff");
    TGraphErrors* eff_Double9090 = (TGraphErrors*)inF_Double9090->Get("eff");
    //TGraphErrors* eff_MultiAlkEm = (TGraphErrors*)inF_MultiAlkEm->Get("eff");
    TGraphErrors* eff_Double9040 = (TGraphErrors*)inF_Double9040->Get("eff");

    //settings
    eff_Double9040->SetMarkerColor(kBlue);
    eff_Double9040->SetLineColor(kBlue);
    eff_Double9090->SetMarkerColor(kRed);
    eff_Double9090->SetLineColor(kRed);
  //
    eff_Double9040->SetMarkerStyle(20);
    eff_Double9040->SetLineWidth(2);
    eff_Double9040->SetMarkerSize(0.9);
    eff_Double9090->SetMarkerStyle(20);
    eff_Double9090->SetLineWidth(2);
    eff_Double9090->SetMarkerSize(0.9);

    legC->SetTextFont(42);
    legC->SetTextSize(0.034);
    legC->SetFillColor(kWhite);
    legC->SetLineColor(kWhite);
    legC->SetShadowColor(kWhite);
    legC->AddEntry(eff_Double9040, "Double9040 HV_{2} = 3000 (V)", "p");
    legC->AddEntry(eff_Double9090, "Double9090 HV_{2} = 3000 (V)", "p");
  
    mg->Add(eff_Double9090);
    mg->Add(eff_Double9040);

    //    TCanvas* c = new TCanvas("cEff","cEff",400,800);
    TCanvas* c = new TCanvas();
    gPad->SetTicks();
    char plot_name[100];
    std::string command = "if [ ! -e final_plots/ ] ; then mkdir final_plots ; fi";
    system(command.c_str());
    sprintf(plot_name, "final_plots/efficiency_%s.pdf", plot_type.c_str());

    mg->Draw("APL");
    mg->SetTitle("Electron Beam 450 MeV");
    mg->GetXaxis()->SetRangeUser(2200,4000);
    mg->GetXaxis()->SetTitle("HV_{1} (V)");
    mg->GetXaxis()->SetTitleSize(0.05);
    mg->GetYaxis()->SetTitle("Efficiency");
    mg->GetYaxis()->SetTitleSize(0.05);
    mg->SetMaximum(1);
    mg->SetMinimum(0);
    mg->Draw("APL");  
    legC->Draw("same");
    banner4Plot();
    c->Update();

    c->Print(plot_name, "pdf");
    sprintf(plot_name, "final_plots/efficiency_%s.png", plot_type.c_str());
    c->Print(plot_name, "png");

    sprintf(plot_name, "final_plots/efficiency_%s.root", plot_type.c_str());
    c->SaveAs(plot_name, "root");
    sprintf(plot_name, "final_plots/efficiency_%s.C", plot_type.c_str());
    c->SaveAs(plot_name, "C");
  }

/////----------------------------------------------------------------------------//////////////

if(plot_type == "Ang"){
    legC = new TLegend(0.12,0.62,0.40,0.87,NULL,"brNDC");

	//plot name MCPName_ScanType_HVScanScanType_MCPName
    inF_Double9040 = TFile::Open("plots/efficiency_studies/Double9040_Ang_AngScan_Double9040.root");    
    TGraphErrors* eff_Double9040 = (TGraphErrors*)inF_Double9040->Get("eff");

    //settings
    eff_Double9040->SetMarkerColor(kBlue);
    eff_Double9040->SetLineColor(kBlue);
  //
    eff_Double9040->SetMarkerStyle(20);
    eff_Double9040->SetLineWidth(2);
    eff_Double9040->SetMarkerSize(0.9);

    legC->SetTextFont(42);
    legC->SetTextSize(0.034);
    legC->SetFillColor(kWhite);
    legC->SetLineColor(kWhite);
    legC->SetShadowColor(kWhite);
    legC->AddEntry(eff_Double9040, "Double9040 HV_{1} = 2700 V, HV_{2} = 2700 V", "p");
  
    mg->Add(eff_Double9040);

    //    TCanvas* c = new TCanvas("cEff","cEff",400,800);
    TCanvas* c = new TCanvas();
    gPad->SetTicks();
    char plot_name[100];
    std::string command = "if [ ! -e final_plots/ ] ; then mkdir final_plots ; fi";
    system(command.c_str());
    sprintf(plot_name, "final_plots/efficiency_%s.pdf", plot_type.c_str());

    mg->Draw("APL");
    mg->SetTitle("Electron Beam 450 MeV");
    mg->GetXaxis()->SetRangeUser(-1,50);
    mg->GetXaxis()->SetTitle("Angle (degrees)");
    mg->GetXaxis()->SetTitleSize(0.05);
    mg->GetYaxis()->SetTitle("Efficiency");
    mg->GetYaxis()->SetTitleSize(0.05);
    mg->SetMaximum(0.9);
    mg->SetMinimum(0.5);
    mg->Draw("APL");  
    legC->Draw("same");
    banner4Plot();
    c->Update();

    c->Print(plot_name, "pdf");
    sprintf(plot_name, "final_plots/efficiency_%s.png", plot_type.c_str());
    c->Print(plot_name, "png");

    sprintf(plot_name, "final_plots/efficiency_%s.root", plot_type.c_str());
    c->SaveAs(plot_name, "root");
    sprintf(plot_name, "final_plots/efficiency_%s.C", plot_type.c_str());
    c->SaveAs(plot_name, "C");
  }

/////----------------------------------------------------------------------------//////////////


 if(plot_type == "X0_12"){
    legC = new TLegend(0.15,0.15,0.45,0.32,NULL,"brNDC");

    inF_GaAsEm = TFile::Open("plots/efficiency_studies/GaAsEm_X0_X0Scan12_GaAsEm.root");
    //inF_GaAsEm_OFF = TFile::Open("plots/efficiency_studies/GaAsEm_HV_HVScan7.root");
    inF_MultiAlkEm = TFile::Open("plots/efficiency_studies/MultiAlkEm_X0_X0Scan12_MultiAlkEm.root");
    inF_Double9090 = TFile::Open("plots/efficiency_studies/Double9090_X0_X0Scan12_Double9090.root");
    inF_Double9040 = TFile::Open("plots/efficiency_studies/Double9040_X0_X0Scan12_Double9040.root");    

    TGraphErrors* eff_GaAsEm;
    TGraphErrors* eff_MultiAlkEm;
    TGraphErrors* eff_Double9090;
    TGraphErrors* eff_Double9040;
    
    
    eff_GaAsEm = (TGraphErrors*)inF_GaAsEm->Get("eff");
    eff_MultiAlkEm = (TGraphErrors*)inF_MultiAlkEm->Get("eff");
    eff_Double9090 = (TGraphErrors*)inF_Double9090->Get("eff");
    eff_Double9040 = (TGraphErrors*)inF_Double9040->Get("eff");
    
    //settings
    eff_GaAsEm->SetMarkerColor(kGreen+1);
    eff_GaAsEm->SetLineColor(kGreen+1);
    eff_Double9040->SetMarkerColor(kBlue);
    eff_Double9040->SetLineColor(kBlue);
    eff_Double9090->SetMarkerColor(kRed);
    eff_Double9090->SetLineColor(kRed);
    eff_MultiAlkEm->SetMarkerColor(1);
    eff_MultiAlkEm->SetLineColor(1);
    eff_GaAsEm->SetMarkerStyle(20);
    eff_GaAsEm->SetLineWidth(2);
    eff_GaAsEm->SetMarkerSize(0.9);  
    eff_Double9040->SetMarkerStyle(20);
    eff_Double9040->SetLineWidth(2);
    eff_Double9040->SetMarkerSize(0.9);
    eff_Double9090->SetMarkerStyle(20);
    eff_Double9090->SetLineWidth(2);
    eff_Double9090->SetMarkerSize(0.9);
    eff_MultiAlkEm->SetMarkerStyle(20);
    eff_MultiAlkEm->SetLineWidth(2);
    eff_MultiAlkEm->SetMarkerSize(0.9);
    
    legC->SetTextFont(42);
    legC->SetTextSize(0.037);
    legC->SetFillColor(kWhite);
    legC->SetLineColor(kWhite);
    legC->SetShadowColor(kWhite);

    mg->Add(eff_GaAsEm);
    mg->Add(eff_Double9090);
    mg->Add(eff_MultiAlkEm);
    mg->Add(eff_Double9040);

    TCanvas* c = new TCanvas();
    gPad->SetTicks();
    char plot_name[100];
    std::string command = "if [ ! -e final_plots/ ] ; then mkdir final_plots ; fi";
    system(command.c_str());
    sprintf(plot_name, "final_plots/efficiency_%s.pdf", plot_type.c_str());

    mg->Draw("ALP");
    mg->SetTitle("Electron Beam 450 MeV");
    mg->GetXaxis()->SetRangeUser(-0.1,7.2);
    mg->GetXaxis()->SetTitle("Number of X_{0}");
    mg->GetXaxis()->SetTitleSize(0.046);
    mg->GetYaxis()->SetTitle("Efficiency");
    mg->GetYaxis()->SetTitleSize(0.046);
    mg->SetMaximum(1.05);
    mg->SetMinimum(0);
     
    legC->AddEntry(eff_MultiAlkEm, "MultiAlk emitt (ON) HV_{1} = -3800 HV_{2} = -3500 (V)", "p"); 
    legC->AddEntry(eff_GaAsEm, "GaAs emitt. (ON) HV_{1} = -3400 (V) HV_{2} = -3100 (V)", "p"); 
    //legC->AddEntry(eff_GaAsEm_OFF, "GaAs emitt. - iMCP mode", "p");
    legC->AddEntry(eff_Double9040, "Double9040 HV_{1} = -2700 (V), HV_{2} = 2700 (V)", "p");
    legC->AddEntry(eff_Double9090, "Double9090 HV_{1} = -2700 (V), HV_{2} = 2700 (V)", "p");

    mg->Draw("ALP");  
    legC->Draw("same");
    banner4Plot();
    c->Update();

    c->Print(plot_name, "pdf");
    sprintf(plot_name, "final_plots/efficiency_%s.png", plot_type.c_str());
    c->Print(plot_name, "png");

    sprintf(plot_name, "final_plots/efficiency_%s.root", plot_type.c_str());
    c->Print(plot_name, "root");
    sprintf(plot_name, "final_plots/efficiency_%s.C", plot_type.c_str());
    c->SaveAs(plot_name, "C");
 }


/////----------------------------------------------------------------------------//////////////


 if(plot_type == "X0_1"){
    legC = new TLegend(0.15,0.15,0.45,0.32,NULL,"brNDC");

    inF_GaAsEm = TFile::Open("plots/efficiency_studies/GaAsEm_X0_X0Scan1_GaAsEm.root");
    //inF_GaAsEm_OFF = TFile::Open("plots/efficiency_studies/GaAsEm_HV_HVScan7.root");
    inF_MultiAlkEm = TFile::Open("plots/efficiency_studies/MultiAlkEm_X0_X0Scan1_MultiAlkEm.root");
    inF_Double9090 = TFile::Open("plots/efficiency_studies/Double9090_X0_X0Scan1_Double9090.root");
    inF_Double9040 = TFile::Open("plots/efficiency_studies/Double9040_X0_X0Scan1_Double9040.root");    

    TGraphErrors* eff_GaAsEm;
    TGraphErrors* eff_MultiAlkEm;
    TGraphErrors* eff_Double9090;
    TGraphErrors* eff_Double9040;
    
    
    eff_GaAsEm = (TGraphErrors*)inF_GaAsEm->Get("eff");
    eff_MultiAlkEm = (TGraphErrors*)inF_MultiAlkEm->Get("eff");
    eff_Double9090 = (TGraphErrors*)inF_Double9090->Get("eff");
    eff_Double9040 = (TGraphErrors*)inF_Double9040->Get("eff");
    
    //settings
    eff_GaAsEm->SetMarkerColor(kGreen+1);
    eff_GaAsEm->SetLineColor(kGreen+1);
    eff_Double9040->SetMarkerColor(kBlue);
    eff_Double9040->SetLineColor(kBlue);
    eff_Double9090->SetMarkerColor(kRed);
    eff_Double9090->SetLineColor(kRed);
    eff_MultiAlkEm->SetMarkerColor(1);
    eff_MultiAlkEm->SetLineColor(1);
    eff_GaAsEm->SetMarkerStyle(20);
    eff_GaAsEm->SetLineWidth(2);
    eff_GaAsEm->SetMarkerSize(0.9);  
    eff_Double9040->SetMarkerStyle(20);
    eff_Double9040->SetLineWidth(2);
    eff_Double9040->SetMarkerSize(0.9);
    eff_Double9090->SetMarkerStyle(20);
    eff_Double9090->SetLineWidth(2);
    eff_Double9090->SetMarkerSize(0.9);
    eff_MultiAlkEm->SetMarkerStyle(20);
    eff_MultiAlkEm->SetLineWidth(2);
    eff_MultiAlkEm->SetMarkerSize(0.9);
    
    legC->SetTextFont(42);
    legC->SetTextSize(0.037);
    legC->SetFillColor(kWhite);
    legC->SetLineColor(kWhite);
    legC->SetShadowColor(kWhite);

    mg->Add(eff_GaAsEm);
    mg->Add(eff_Double9090);
    mg->Add(eff_MultiAlkEm);
    mg->Add(eff_Double9040);

    TCanvas* c = new TCanvas();
    gPad->SetTicks();
    char plot_name[100];
    std::string command = "if [ ! -e final_plots/ ] ; then mkdir final_plots ; fi";
    system(command.c_str());
    sprintf(plot_name, "final_plots/efficiency_%s.pdf", plot_type.c_str());

    mg->Draw("ALP");
    mg->SetTitle("Electron Beam 450 MeV");
    mg->GetXaxis()->SetRangeUser(-0.1,7.2);
    mg->GetXaxis()->SetTitle("Number of X_{0}");
    mg->GetXaxis()->SetTitleSize(0.046);
    mg->GetYaxis()->SetTitle("Efficiency");
    mg->GetYaxis()->SetTitleSize(0.046);
    mg->SetMaximum(1.05);
    mg->SetMinimum(0);
     
    legC->AddEntry(eff_MultiAlkEm, "MultiAlk emitt (OFF) HV_{1} = -3450 HV_{2} = -3500 (V)", "p"); 
    legC->AddEntry(eff_GaAsEm, "GaAs emitt. (OFF) HV_{1} = -3050 (V) HV_{2} = -3100 (V)", "p"); 
    //legC->AddEntry(eff_GaAsEm_OFF, "GaAs emitt. - iMCP mode", "p");
    legC->AddEntry(eff_Double9040, "Double9040 HV_{1} = -2400 (V), HV_{2} = 2700 (V)", "p");
    legC->AddEntry(eff_Double9090, "Double9090 HV_{1} = -2400 (V), HV_{2} = 2700 (V)", "p");

    mg->Draw("ALP");  
    legC->Draw("same");
    banner4Plot();
    c->Update();

    c->Print(plot_name, "pdf");
    sprintf(plot_name, "final_plots/efficiency_%s.png", plot_type.c_str());
    c->Print(plot_name, "png");

    sprintf(plot_name, "final_plots/efficiency_%s.root", plot_type.c_str());
    c->Print(plot_name, "root");
    sprintf(plot_name, "final_plots/efficiency_%s.C", plot_type.c_str());
    c->SaveAs(plot_name, "C");
 }


 /////----------------------------------------------------------------------------////////////// 

 if(plot_type == "multiplicity1"){
    legC = new TLegend(0.15,0.15,0.45,0.32,NULL,"brNDC");

    inF_GaAsEm = TFile::Open("plots/efficiency_studies/GaAsEm_multiplicity1_LongScan0X0_GaAsEm_1.root");
    //inF_GaAsEm_OFF = TFile::Open("plots/efficiency_studies/GaAsEm_HV_HVScan7.root");
    inF_MultiAlkEm = TFile::Open("plots/efficiency_studies/MultiAlkEm_multiplicity1_LongScan0X0_MultiAlkEm_1.root");
    inF_Double9090 = TFile::Open("plots/efficiency_studies/Double9090_multiplicity1_LongScan0X0_Double9090_1.root");
    inF_Double9040 = TFile::Open("plots/efficiency_studies/Double9040_multiplicity1_LongScan0X0_Double9040_1.root");    

    TGraphErrors* eff_GaAsEm;
    TGraphErrors* eff_MultiAlkEm;
    TGraphErrors* eff_Double9090;
    TGraphErrors* eff_Double9040;
    
    
    eff_GaAsEm = (TGraphErrors*)inF_GaAsEm->Get("eff");
    eff_MultiAlkEm = (TGraphErrors*)inF_MultiAlkEm->Get("eff");
    eff_Double9090 = (TGraphErrors*)inF_Double9090->Get("eff");
    eff_Double9040 = (TGraphErrors*)inF_Double9040->Get("eff");
    
    //settings
    eff_GaAsEm->SetMarkerColor(kGreen+1);
    eff_GaAsEm->SetLineColor(kGreen+1);
    eff_Double9040->SetMarkerColor(kBlue);
    eff_Double9040->SetLineColor(kBlue);
    eff_Double9090->SetMarkerColor(kRed);
    eff_Double9090->SetLineColor(kRed);
    eff_MultiAlkEm->SetMarkerColor(1);
    eff_MultiAlkEm->SetLineColor(1);
    eff_GaAsEm->SetMarkerStyle(20);
    eff_GaAsEm->SetLineWidth(2);
    eff_GaAsEm->SetMarkerSize(0.9);  
    eff_Double9040->SetMarkerStyle(20);
    eff_Double9040->SetLineWidth(2);
    eff_Double9040->SetMarkerSize(0.9);
    eff_Double9090->SetMarkerStyle(20);
    eff_Double9090->SetLineWidth(2);
    eff_Double9090->SetMarkerSize(0.9);
    eff_MultiAlkEm->SetMarkerStyle(20);
    eff_MultiAlkEm->SetLineWidth(2);
    eff_MultiAlkEm->SetMarkerSize(0.9);
    
    legC->SetTextFont(42);
    legC->SetTextSize(0.037);
    legC->SetFillColor(kWhite);
    legC->SetLineColor(kWhite);
    legC->SetShadowColor(kWhite);

    mg->Add(eff_GaAsEm);
    mg->Add(eff_Double9090);
    mg->Add(eff_MultiAlkEm);
    mg->Add(eff_Double9040);

    TCanvas* c = new TCanvas();
    gPad->SetTicks();
    char plot_name[100];
    std::string command = "if [ ! -e final_plots/ ] ; then mkdir final_plots ; fi";
    system(command.c_str());
    sprintf(plot_name, "final_plots/efficiency_%s.pdf", plot_type.c_str());

    mg->Draw("ALP");
    mg->SetTitle("Electron Beam 450 MeV");
    mg->GetXaxis()->SetRangeUser(-0.1,7.2);
    mg->GetXaxis()->SetTitle("multiplicity");
    mg->GetXaxis()->SetTitleSize(0.046);
    mg->GetYaxis()->SetTitle("Efficiency");
    mg->GetYaxis()->SetTitleSize(0.046);
    mg->SetMaximum(1.05);
    mg->SetMinimum(0);
     
    legC->AddEntry(eff_MultiAlkEm, "MultiAlk emitt (ON) HV_{1} = -3800 HV_{2} = -3500 (V)", "p"); 
    legC->AddEntry(eff_GaAsEm, "GaAs emitt. (ON) HV_{1} = -3400 (V) HV_{2} = -3100 (V)", "p"); 
    //legC->AddEntry(eff_GaAsEm_OFF, "GaAs emitt. - iMCP mode", "p");
    legC->AddEntry(eff_Double9040, "Double9040 HV_{1} = -2700 (V), HV_{2} = 2700 (V)", "p");
    legC->AddEntry(eff_Double9090, "Double9090 HV_{1} = -2700 (V), HV_{2} = 2700 (V)", "p");

    mg->Draw("ALP");  
    legC->Draw("same");
    banner4Plot();
    c->Update();

    c->Print(plot_name, "pdf");
    sprintf(plot_name, "final_plots/efficiency_%s.png", plot_type.c_str());
    c->Print(plot_name, "png");

    sprintf(plot_name, "final_plots/efficiency_%s.root", plot_type.c_str());
    c->Print(plot_name, "root");
    sprintf(plot_name, "final_plots/efficiency_%s.C", plot_type.c_str());
    c->SaveAs(plot_name, "C");
 }


/////----------------------------------------------------------------------------//////////////


 if(plot_type == "multiplicity2"){
    legC = new TLegend(0.15,0.15,0.45,0.32,NULL,"brNDC");

    inF_GaAsEm = TFile::Open("plots/efficiency_studies/GaAsEm_multiplicity2_LongScan0X0_GaAsEm_2.root");
    //inF_GaAsEm_OFF = TFile::Open("plots/efficiency_studies/GaAsEm_multiplicity2_HVScan7.root");
    inF_MultiAlkEm = TFile::Open("plots/efficiency_studies/MultiAlkEm_multiplicity2_LongScan0X0_MultiAlkEm_2.root");
    inF_Double9090 = TFile::Open("plots/efficiency_studies/Double9090_multiplicity2_LongScan0X0_Double9090_2.root");
    inF_Double9040 = TFile::Open("plots/efficiency_studies/Double9040_multiplicity2_LongScan0X0_Double9040_2.root");    

    TGraphErrors* eff_GaAsEm;
    TGraphErrors* eff_MultiAlkEm;
    TGraphErrors* eff_Double9090;
    TGraphErrors* eff_Double9040;
    
    
    eff_GaAsEm = (TGraphErrors*)inF_GaAsEm->Get("eff");
    eff_MultiAlkEm = (TGraphErrors*)inF_MultiAlkEm->Get("eff");
    eff_Double9090 = (TGraphErrors*)inF_Double9090->Get("eff");
    eff_Double9040 = (TGraphErrors*)inF_Double9040->Get("eff");
    
    //settings
    eff_GaAsEm->SetMarkerColor(kGreen+1);
    eff_GaAsEm->SetLineColor(kGreen+1);
    eff_Double9040->SetMarkerColor(kBlue);
    eff_Double9040->SetLineColor(kBlue);
    eff_Double9090->SetMarkerColor(kRed);
    eff_Double9090->SetLineColor(kRed);
    eff_MultiAlkEm->SetMarkerColor(1);
    eff_MultiAlkEm->SetLineColor(1);
    eff_GaAsEm->SetMarkerStyle(20);
    eff_GaAsEm->SetLineWidth(2);
    eff_GaAsEm->SetMarkerSize(0.9);  
    eff_Double9040->SetMarkerStyle(20);
    eff_Double9040->SetLineWidth(2);
    eff_Double9040->SetMarkerSize(0.9);
    eff_Double9090->SetMarkerStyle(20);
    eff_Double9090->SetLineWidth(2);
    eff_Double9090->SetMarkerSize(0.9);
    eff_MultiAlkEm->SetMarkerStyle(20);
    eff_MultiAlkEm->SetLineWidth(2);
    eff_MultiAlkEm->SetMarkerSize(0.9);
    
    legC->SetTextFont(42);
    legC->SetTextSize(0.037);
    legC->SetFillColor(kWhite);
    legC->SetLineColor(kWhite);
    legC->SetShadowColor(kWhite);

    mg->Add(eff_GaAsEm);
    mg->Add(eff_Double9090);
    mg->Add(eff_MultiAlkEm);
    mg->Add(eff_Double9040);

    TCanvas* c = new TCanvas();
    gPad->SetTicks();
    char plot_name[100];
    std::string command = "if [ ! -e final_plots/ ] ; then mkdir final_plots ; fi";
    system(command.c_str());
    sprintf(plot_name, "final_plots/efficiency_%s.pdf", plot_type.c_str());

    mg->Draw("ALP");
    mg->SetTitle("Electron Beam 450 MeV");
    mg->GetXaxis()->SetRangeUser(-0.1,7.2);
    mg->GetXaxis()->SetTitle("multiplicity");
    mg->GetXaxis()->SetTitleSize(0.046);
    mg->GetYaxis()->SetTitle("Efficiency");
    mg->GetYaxis()->SetTitleSize(0.046);
    mg->SetMaximum(1.05);
    mg->SetMinimum(0);

    legC->AddEntry(eff_MultiAlkEm, "MultiAlk emitt (OFF) HV_{1} = -3450 HV_{2} = -3500 (V)", "p"); 
    legC->AddEntry(eff_GaAsEm, "GaAs emitt. (OFF) HV_{1} = -3050 (V) HV_{2} = -3100 (V)", "p"); 
    //legC->AddEntry(eff_GaAsEm_OFF, "GaAs emitt. - iMCP mode", "p");
    legC->AddEntry(eff_Double9040, "Double9040 HV_{1} = -2400 (V), HV_{2} = 2700 (V)", "p");
    legC->AddEntry(eff_Double9090, "Double9090 HV_{1} = -2400 (V), HV_{2} = 2700 (V)", "p");

    mg->Draw("ALP");  
    legC->Draw("same");
    banner4Plot();
    c->Update();

    c->Print(plot_name, "pdf");
    sprintf(plot_name, "final_plots/efficiency_%s.png", plot_type.c_str());
    c->Print(plot_name, "png");

    sprintf(plot_name, "final_plots/efficiency_%s.root", plot_type.c_str());
    c->Print(plot_name, "root");
    sprintf(plot_name, "final_plots/efficiency_%s.C", plot_type.c_str());
    c->SaveAs(plot_name, "C");
 }


/////----------------------------------------------------------------------------//////////////
  
 if(plot_type == "LongScan2X0"){
    legC = new TLegend(0.15,0.15,0.45,0.32,NULL,"brNDC");

    inF_GaAsEm = TFile::Open("plots/efficiency_studies/GaAsEm_HV1_LongScan2X0_GaAsEm.root");
    //inF_GaAsEm_OFF = TFile::Open("plots/efficiency_studies/GaAsEm_multiplicity2_HVScan7.root");
    inF_MultiAlkEm = TFile::Open("plots/efficiency_studies/MultiAlkEm_HV1_LongScan2X0_MultiAlkEm.root");
    inF_Double9090 = TFile::Open("plots/efficiency_studies/Double9090_HV1_LongScan2X0_Double9090.root");
    inF_Double9040 = TFile::Open("plots/efficiency_studies/Double9040_HV1_LongScan2X0_Double9040.root");    

    TGraphErrors* eff_GaAsEm;
    TGraphErrors* eff_MultiAlkEm;
    TGraphErrors* eff_Double9090;
    TGraphErrors* eff_Double9040;
    
    
    eff_GaAsEm = (TGraphErrors*)inF_GaAsEm->Get("eff");
    eff_MultiAlkEm = (TGraphErrors*)inF_MultiAlkEm->Get("eff");
    eff_Double9090 = (TGraphErrors*)inF_Double9090->Get("eff");
    eff_Double9040 = (TGraphErrors*)inF_Double9040->Get("eff");
    
    //settings
    eff_GaAsEm->SetMarkerColor(kGreen+1);
    eff_GaAsEm->SetLineColor(kGreen+1);
    eff_Double9040->SetMarkerColor(kBlue);
    eff_Double9040->SetLineColor(kBlue);
    eff_Double9090->SetMarkerColor(kRed);
    eff_Double9090->SetLineColor(kRed);
    eff_MultiAlkEm->SetMarkerColor(1);
    eff_MultiAlkEm->SetLineColor(1);
    eff_GaAsEm->SetMarkerStyle(20);
    eff_GaAsEm->SetLineWidth(2);
    eff_GaAsEm->SetMarkerSize(0.9);  
    eff_Double9040->SetMarkerStyle(20);
    eff_Double9040->SetLineWidth(2);
    eff_Double9040->SetMarkerSize(0.9);
    eff_Double9090->SetMarkerStyle(20);
    eff_Double9090->SetLineWidth(2);
    eff_Double9090->SetMarkerSize(0.9);
    eff_MultiAlkEm->SetMarkerStyle(20);
    eff_MultiAlkEm->SetLineWidth(2);
    eff_MultiAlkEm->SetMarkerSize(0.9);
    
    legC->SetTextFont(42);
    legC->SetTextSize(0.037);
    legC->SetFillColor(kWhite);
    legC->SetLineColor(kWhite);
    legC->SetShadowColor(kWhite);

    mg->Add(eff_GaAsEm);
    mg->Add(eff_Double9090);
    mg->Add(eff_MultiAlkEm);
    mg->Add(eff_Double9040);

    TCanvas* c = new TCanvas();
    gPad->SetTicks();
    char plot_name[100];
    std::string command = "if [ ! -e final_plots/ ] ; then mkdir final_plots ; fi";
    system(command.c_str());
    sprintf(plot_name, "final_plots/efficiency_%s.pdf", plot_type.c_str());

    mg->Draw("ALP");
    mg->SetTitle("Electron Beam 450 MeV");
    mg->GetXaxis()->SetRangeUser(1400,3800);
    mg->GetXaxis()->SetTitle("HV_{2} (V)");
    mg->GetXaxis()->SetTitleSize(0.046);
    mg->GetYaxis()->SetTitle("Efficiency");
    mg->GetYaxis()->SetTitleSize(0.046);
    mg->SetMaximum(1.05);
    mg->SetMinimum(0);

    legC->AddEntry(eff_MultiAlkEm, "MultiAlk emitt. HV_{2} = 3500 (V)", "p");
    legC->AddEntry(eff_GaAsEm, "GaAs emitt. HV_{2} = 3100 (V)", "p");
//    legC->AddEntry(eff_GaAsEm_OFF, "GaAs emitt. - iMCP mode", "p");
    legC->AddEntry(eff_Double9040, "Double9040 HV_{2} = 2700 (V)", "p");
    legC->AddEntry(eff_Double9090, "Double9090 HV_{2} = 2700 (V)", "p");

    mg->Draw("ALP");  
    legC->Draw("same");
    banner4Plot();
    c->Update();

    c->Print(plot_name, "pdf");
    sprintf(plot_name, "final_plots/efficiency_%s.png", plot_type.c_str());
    c->Print(plot_name, "png");

    sprintf(plot_name, "final_plots/efficiency_%s.root", plot_type.c_str());
    c->Print(plot_name, "root");
    sprintf(plot_name, "final_plots/efficiency_%s.C", plot_type.c_str());
    c->SaveAs(plot_name, "C");
 }


 return 0;
}
void makePlots(vector<inputValues> b, vector<inputValues> t, vector<outputValues> o) {

    // Plot output values vs pulse width
    TMultiGraph * eLPlot   = new TMultiGraph();
    TMultiGraph * ePsiPlot = new TMultiGraph();
    TMultiGraph * vPsiPlot = new TMultiGraph();

    vector<TGraph*> eLPlots;
    vector<TGraph*> ePsiPlots;
    vector<TGraph*> vPsiPlots;

    for (int i = 0; i < b.size(); i++) {

        int pointNum = 0;

        eLPlots.push_back(new TGraph());
        ePsiPlots.push_back(new TGraph());
        vPsiPlots.push_back(new TGraph());
        eLPlots[i]->SetMarkerStyle(21);
        ePsiPlots[i]->SetMarkerStyle(21);
        vPsiPlots[i]->SetMarkerStyle(21);
        eLPlots[i]->SetMarkerColor(i+1);
        ePsiPlots[i]->SetMarkerColor(i+1);
        vPsiPlots[i]->SetMarkerColor(i+1);

        for (int j = 0; j < t.size(); j++) {
            if (t[j].cm == b[i].cm) {
                eLPlots[i]->SetPoint(pointNum, t[j].pw, o[j].eL);
                ePsiPlots[i]->SetPoint(pointNum, t[j].pw, o[j].ePsi);
                vPsiPlots[i]->SetPoint(pointNum, t[j].pw, o[j].vPsi);
                
                pointNum++;

                // Debugging
                //cout << pointNum << " " << t[j].pw << " " << o[j].eL << " " << o[j].ePsi <<  endl;
            }
	    }
        eLPlot->Add(eLPlots[i]);
        ePsiPlot->Add(ePsiPlots[i]);
        vPsiPlot->Add(vPsiPlots[i]);
    }

    eLPlot->SetTitle("Average Number of LED-induced Photoelectrons per Trigger");
    ePsiPlot->SetTitle("Single-photoelectron Response Mean in Few-PE Regime");
    vPsiPlot->SetTitle("Single-photoelectron Response Variance");


    TCanvas * eL_c = new TCanvas("eL_c", "eL Canvas", 200, 10, 700, 500);
    eLPlot->Draw("AP");
    eLPlot->GetXaxis()->SetTitle("LED Pulse Width / (ns)");
    eLPlot->GetYaxis()->SetTitle("Photoelectrons / Trigger");
    eL_leg = new TLegend(0.15, 0.67, 0.43, 0.85);
    eL_leg->SetHeader("   Integration Window: 156.25ns");
    eL_leg->AddEntry(eLPlots[0], "Normal Mode", "P");
    eL_leg->AddEntry(eLPlots[1], "Charge Mode", "P");
    eL_leg->Draw();
    gPad->Modified();


    TCanvas * ePsi_c = new TCanvas("ePsi_c", "ePsi Canvas", 200, 10, 700, 500);
    ePsiPlot->Draw("AP");
    ePsiPlot->GetXaxis()->SetTitle("LED Pulse Width / (ns)");
    ePsiPlot->GetYaxis()->SetTitle("pC");
    ePsiPlot->GetYaxis()->SetRangeUser(0.2, 1.4);
    ePsi_leg = new TLegend(0.6, 0.7, 0.88, 0.88);
    ePsi_leg->SetHeader("   Integration Window: 156.25ns");
    ePsi_leg->AddEntry(ePsiPlots[0], "Normal Mode", "P");
    ePsi_leg->AddEntry(ePsiPlots[1], "Charge Mode", "P");
    ePsi_leg->Draw();
    gPad->Modified();

    //TCanvas * vPsi_c = new TCanvas("vPsi_c", "vPsi Canvas", 200, 10, 700, 500);
    //vPsiPlot->Draw("AP");
    //vPsiPlot->GetXaxis()->SetTitle("LED Pulse Width / (ns)");
    //vPsiPlot->GetYaxis()->SetTitle("pC^2");
    //vPsiPlot->GetXaxis()->SetRangeUser(7.2, 8.4);
    //vPsi_leg = new TLegend(0.15, 0.65, 0.5, 0.85);
    //vPsi_leg->AddEntry(eLPlots[0], "PMT Voltage = 1250V", "P");
    //vPsi_leg->AddEntry(eLPlots[1], "PMT Voltage = 1300V", "P");
    //vPsi_leg->AddEntry(eLPlots[2], "PMT Voltage = 1350V", "P");
    //vPsi_leg->AddEntry(eLPlots[3], "PMT Voltage = 1400V", "P");
    //vPsi_leg->Draw();
    //gPad->Modified();

    // Plot spectra
    //TCanvas * spectra_c = new TCanvas("spectra_c", "Spectra Canvas", 200, 10, 700, 500);
    //spectra_c->SetLogy();
    //for (int i = t.size() - 1; i >= 0; i--) {
    //    //t[i].h->Sumw2();
    //    t[i].h->SetLineColor(i+1);
    //    t[i].h->Draw("SAME");
    //    t[i].h->SetStats(0);
    //    t[i].h->GetYaxis()->SetRangeUser(1.0, 500000.0);
    //    t[i].h->SetTitle("PMT Spectra of Pulsed LED w/ Varying Pulse Width");
    //    t[i].h->GetXaxis()->SetTitle("Integrated Charge / (pC)");
    //    t[i].h->GetYaxis()->SetTitle("Events");
    //}
    ////b[0].h->Sumw2();
    //b[0].h->Draw("SAME");
    //b[0].h->SetStats(0);
    //TLine * cutLine_t = new TLine(cut, 0.0, cut, 500000.0);
    //cutLine_t->SetLineWidth(2);
    //cutLine_t->Draw();

    //// Add legend
    ////TLegend * leg = new TLegend(0.1, 0.7, 0.48, 0.9);
    ////leg->SetHeader("Legend");
    ////leg->AddEntry(t[0].h, "

    //// Plot background
    //TCanvas * b_c = new TCanvas("b_c", "Background Canvas", 200, 10, 700, 500);
    //b_c->SetLogy();
    ////b[0].h->Sumw2();
    //b[0].h->Draw();
    //b[0].h->GetYaxis()->SetRangeUser(1.0, 100000.0);
    //b[0].h->SetTitle("Background PMT Spectrum");
    //b[0].h->GetXaxis()->SetTitle("Integrated Charge / (pC)");
    //b[0].h->GetYaxis()->SetTitle("Events");
    //TLine * cutLine_b = new TLine(cut, 0.0, cut, 1000000.0);
    //cutLine_b->SetLineWidth(2);
    //cutLine_b->Draw();
}
void result_JES_akPu4PF_(refpt> 75 && refpt < 120)&&(abs(refeta)<2)_Centrality()
{
//=========Macro generated from canvas: Can_result_0/
//=========  (Mon Apr 18 02:39:41 2016) by ROOT version6.02/13
   TCanvas *Can_result_0 = new TCanvas("Can_result_0", "",18,40,700,500);
   gStyle->SetOptFit(1);
   Can_result_0->Range(-18.75,0.9236134,118.75,1.043845);
   Can_result_0->SetFillColor(0);
   Can_result_0->SetBorderMode(0);
   Can_result_0->SetBorderSize(2);
   Can_result_0->SetFrameBorderMode(0);
   Can_result_0->SetFrameBorderMode(0);
   
   TMultiGraph *multigraph = new TMultiGraph();
   multigraph->SetName("name");
   multigraph->SetTitle("JES_akPu4PF");
   
   Double_t Graph_fx1001[4] = {
   5,
   20,
   40,
   75};
   Double_t Graph_fy1001[4] = {
   1.025461,
   0.982262,
   0.9644553,
   0.970611};
   Double_t Graph_fex1001[4] = {
   5,
   10,
   10,
   25};
   Double_t Graph_fey1001[4] = {
   0.001598024,
   0.0009318739,
   0.0008002418,
   0.0004502591};
   TGraphErrors *gre = new TGraphErrors(4,Graph_fx1001,Graph_fy1001,Graph_fex1001,Graph_fey1001);
   gre->SetName("Graph");
   gre->SetTitle("some title_0");
   gre->SetFillColor(1);
   gre->SetFillStyle(0);
   
   TH1F *Graph_Graph1001 = new TH1F("Graph_Graph1001","some title_0",100,0,110);
   Graph_Graph1001->SetMinimum(0.9573146);
   Graph_Graph1001->SetMaximum(1.0334);
   Graph_Graph1001->SetDirectory(0);
   Graph_Graph1001->SetStats(0);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#000099");
   Graph_Graph1001->SetLineColor(ci);
   Graph_Graph1001->GetXaxis()->SetLabelFont(42);
   Graph_Graph1001->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1001->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1001->GetXaxis()->SetTitleFont(42);
   Graph_Graph1001->GetYaxis()->SetLabelFont(42);
   Graph_Graph1001->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1001->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1001->GetYaxis()->SetTitleFont(42);
   Graph_Graph1001->GetZaxis()->SetLabelFont(42);
   Graph_Graph1001->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1001->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1001->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1001);
   
   multigraph->Add(gre,"");
   
   Double_t Graph_fx1002[4] = {
   5,
   20,
   40,
   75};
   Double_t Graph_fy1002[4] = {
   1.025808,
   0.9823451,
   0.964104,
   0.9707841};
   Double_t Graph_fex1002[4] = {
   5,
   10,
   10,
   25};
   Double_t Graph_fey1002[4] = {
   0.001641175,
   0.0009556419,
   0.0008206184,
   0.000461058};
   gre = new TGraphErrors(4,Graph_fx1002,Graph_fy1002,Graph_fex1002,Graph_fey1002);
   gre->SetName("Graph");
   gre->SetTitle("some title_1");
   gre->SetFillColor(1);
   gre->SetFillStyle(0);
   gre->SetLineColor(2);
   gre->SetMarkerColor(2);
   
   TH1F *Graph_Graph1002 = new TH1F("Graph_Graph1002","some title_1",100,0,110);
   Graph_Graph1002->SetMinimum(0.9568668);
   Graph_Graph1002->SetMaximum(1.033866);
   Graph_Graph1002->SetDirectory(0);
   Graph_Graph1002->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1002->SetLineColor(ci);
   Graph_Graph1002->GetXaxis()->SetLabelFont(42);
   Graph_Graph1002->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1002->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1002->GetXaxis()->SetTitleFont(42);
   Graph_Graph1002->GetYaxis()->SetLabelFont(42);
   Graph_Graph1002->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1002->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1002->GetYaxis()->SetTitleFont(42);
   Graph_Graph1002->GetZaxis()->SetLabelFont(42);
   Graph_Graph1002->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1002->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1002->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1002);
   
   multigraph->Add(gre,"");
   
   Double_t Graph_fx1003[4] = {
   5,
   20,
   40,
   75};
   Double_t Graph_fy1003[4] = {
   0.9944711,
   0.9453074,
   0.9619222,
   0.9556338};
   Double_t Graph_fex1003[4] = {
   5,
   10,
   10,
   25};
   Double_t Graph_fey1003[4] = {
   0.01053149,
   0.005298861,
   0.004412705,
   0.002663901};
   gre = new TGraphErrors(4,Graph_fx1003,Graph_fy1003,Graph_fex1003,Graph_fey1003);
   gre->SetName("Graph");
   gre->SetTitle("some title_2");
   gre->SetFillColor(1);
   gre->SetFillStyle(0);
   gre->SetLineColor(3);
   gre->SetMarkerColor(3);
   
   TH1F *Graph_Graph1003 = new TH1F("Graph_Graph1003","some title_2",100,0,110);
   Graph_Graph1003->SetMinimum(0.9335092);
   Graph_Graph1003->SetMaximum(1.011502);
   Graph_Graph1003->SetDirectory(0);
   Graph_Graph1003->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1003->SetLineColor(ci);
   Graph_Graph1003->GetXaxis()->SetLabelFont(42);
   Graph_Graph1003->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1003->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1003->GetXaxis()->SetTitleFont(42);
   Graph_Graph1003->GetYaxis()->SetLabelFont(42);
   Graph_Graph1003->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1003->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1003->GetYaxis()->SetTitleFont(42);
   Graph_Graph1003->GetZaxis()->SetLabelFont(42);
   Graph_Graph1003->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1003->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1003->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1003);
   
   multigraph->Add(gre,"");
   multigraph->Draw("AP");
   multigraph->GetXaxis()->SetTitle("Centrality");
   multigraph->GetXaxis()->SetLabelFont(42);
   multigraph->GetXaxis()->SetLabelSize(0.035);
   multigraph->GetXaxis()->SetTitleSize(0.035);
   multigraph->GetXaxis()->SetTitleFont(42);
   multigraph->GetYaxis()->SetTitle("#mu_{Reco./Gen.}");
   multigraph->GetYaxis()->SetLabelFont(42);
   multigraph->GetYaxis()->SetLabelSize(0.035);
   multigraph->GetYaxis()->SetTitleSize(0.035);
   multigraph->GetYaxis()->SetTitleFont(42);
   
   TLegend *leg = new TLegend(0.68,0.7,0.88,0.85,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   TLegendEntry *entry=leg->AddEntry("Graph","allJets","l");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph","lightJets","l");
   entry->SetLineColor(2);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph","bJets","l");
   entry->SetLineColor(3);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   leg->Draw();
   TLatex *   tex = new TLatex(0.25,0.7,"#bf{#color[2]{|#eta_{jet}|<2.0 &75<refpt<120}}");
tex->SetNDC();
   tex->SetTextFont(43);
   tex->SetTextSize(24);
   tex->SetLineWidth(2);
   tex->Draw();
   
   TPaveText *pt = new TPaveText(0.3750575,0.9365254,0.6249425,0.995,"blNDC");
   pt->SetName("title");
   pt->SetBorderSize(0);
   pt->SetFillColor(0);
   pt->SetFillStyle(0);
   pt->SetTextFont(42);
   AText = pt->AddText("JES_akPu4PF");
   pt->Draw();
   Can_result_0->Modified();
   Can_result_0->cd();
   Can_result_0->SetSelected(Can_result_0);
}
Example #10
0
/**
The purpose of this function is to conveniently plot an event. Each event is plotted on a TCanvas. Divided into as many pads as there are panels. Each pad is a TMultiGraph with a TLegend, and shows the channels of the digitizer connected to the lines of that panel. The grouping into pads must not necessarily be according to panels, but in any other prefered way.

@param a_channels - a vector of a vector of samples, containing all 32 channels
@ param a_channelsToPadsAssociation - a map from std::string, which is the name of the panel (or group of channels) to be assigned to each pad to a vector if integers, which is the list of channels indices corresponding to indices of channels in the paramater a_channels to associate to a pad
@param sEventTitle - a string containing the title of the event (for example, the time stamp)
*/
void RangePlotter::PlotRanges(Channels_t& a_channels, Range_t& a_channelsToPadsAssociation, std::string sEventTitle)
{	
//	printf("Plotting\n");
	//m_pCanvas->Clear();
	m_pCanvas->SetTitle(sEventTitle.c_str());
	
	
	int iPadCounter = 0;
	if(0 == m_vpMultiGraph.size())
	{
		MakePads(a_channelsToPadsAssociation.size());	
		for (auto& rangeIt: a_channelsToPadsAssociation)
		{	
			TMultiGraph* pMg = new TMultiGraph();	
			m_vpMultiGraph.push_back(std::unique_ptr<TMultiGraph>(pMg));

	//		m_pCanvas->cd(iPadCounter + 1);
			ChangePad(iPadCounter);
			int i = 0;

			auto legend = new TLegend(0.8,0.8,1,1, "Channels");
			m_vpLegends.push_back(std::unique_ptr<TLegend>(legend));
			printf("printing panel %s\n", rangeIt.first.c_str());
			for (auto& chanIt: rangeIt.second)
			{
				int iNumOfSamples = a_channels[chanIt].size();
				TGraph* pGr = new TGraph(iNumOfSamples);
				std::vector<float> vTimeSeq = CommonUtils::GenerateTimeSequence(iNumOfSamples, m_fSamplingFreqGHz);
				for (int counter = 0; counter < iNumOfSamples; counter++)
				{
					pGr->SetPoint(counter, vTimeSeq[counter], TransformToVoltage(a_channels[chanIt][counter]));
				}

				m_vpGraph[chanIt] = pGr;
				pGr->SetLineColor(m_colors[i%(sizeof(m_colors)/sizeof(int))]);
				pGr->SetName((m_sInstanceName + std::string("Pan_") + rangeIt.first + std::string("chan_") + std::to_string(chanIt)).c_str());
				std::string sGraphTitle = std::string("Channel ") + std::to_string(chanIt);
				pGr->SetTitle(sGraphTitle.c_str());
				legend->AddEntry(pGr,std::to_string(chanIt).c_str(), "l");
		
				pMg->Add(pGr);
				i++;
			}

			if(Configuration::Instance().ShowTriggerInWaveformsStep())
			{
				int iNumOfSamples = a_channels[a_channels.size() - 1].size();
				m_vpGraphPrecisionTrigger = new TGraph(iNumOfSamples);
				std::vector<float> vTimeSeq = CommonUtils::GenerateTimeSequence(iNumOfSamples, m_fSamplingFreqGHz);
				for (int counter = 0; counter < iNumOfSamples; counter++)
				{
					m_vpGraphPrecisionTrigger->SetPoint(counter, vTimeSeq[counter], TransformToVoltage(a_channels[a_channels.size() - 1][counter]));
				}
				
				m_vpGraphPrecisionTrigger->SetName((m_sInstanceName + std::string("Pan_") + rangeIt.first + "_Trig").c_str());	
				m_vpGraphPrecisionTrigger->SetTitle("Trigger");
				legend->AddEntry(m_vpGraphPrecisionTrigger,"Trigger", "l");
				pMg->Add(m_vpGraphPrecisionTrigger);
			}
			
			std::string sMultiGraphTitle = std::string("Panel ") + rangeIt.first;
			pMg->SetTitle(sMultiGraphTitle.c_str());

			pMg->Draw("AL");
			pMg->GetXaxis()->SetTitle("Time [nanoseconds]");
			pMg->GetXaxis()->CenterTitle();
			pMg->GetYaxis()->SetTitle("Voltage [volts]");
			pMg->GetYaxis()->CenterTitle();

			gPad->Modified();

			pMg->SetMinimum(m_fMinVoltage);
			pMg->SetMaximum(m_fMaxVoltage);
			legend->Draw();
			iPadCounter++;
		}
		m_pCanvas->Update();
	}
	else
	{
//		printf("Plottin again\n");
		for (auto& rangeIt: a_channelsToPadsAssociation)
		{
			printf("Panel %s\n", rangeIt.first.c_str());
			m_pCanvas->cd(iPadCounter + 1);
			for (auto& chanIt: rangeIt.second)
			{
//				printf("Chanenl %d\n", chanIt);
				//TODO: num of samples is constant per run at least!
				m_vpGraph[chanIt]->SetLineWidth(1);
				int iNumOfSamples = a_channels[chanIt].size();	
				std::vector<float> vTimeSeq = CommonUtils::GenerateTimeSequence(iNumOfSamples, m_fSamplingFreqGHz);	
				for (int counter = 0; counter < iNumOfSamples; counter++)
				{
					(m_vpGraph[chanIt]->GetY())[counter] = TransformToVoltage(a_channels[chanIt][counter]);
				}

				for (int counter = 0; counter < iNumOfSamples; counter++)
				{
					(m_vpGraphPrecisionTrigger->GetY())[counter] = TransformToVoltage(a_channels[a_channels.size() - 1][counter]);
				}
	
				gPad->Modified();
			}

			m_vpMultiGraph[iPadCounter]->Draw("AC");
			m_vpLegends[iPadCounter]->Draw();
			iPadCounter++;
		}
		printf("Updating\n");
		m_pCanvas->Update();
		printf("After updating\n");
	}
	printf("done\n");
}
void mergeErrors_v6(){

	cout << "============== Merge Errors =============" << endl;

	/*  Data from http://hepdata.cedar.ac.uk/view/ins1243865/first  */
	/* 0-10 Centrality * */

  double p8557_d1x1y1_xval[] = { 0.7, 0.9, 1.1, 1.3, 1.5, 1.7, 1.9, 2.1, 2.3, 
    2.5, 2.7, 2.9, 3.1, 3.3, 3.5, 3.7, 3.9, 4.1, 4.3, 
    4.5, 4.7, 4.9, 5.25, 5.75, 6.25, 6.75, 7.5 };
  double p8557_d1x1y1_xerrminus[] = { 0.09999999999999998, 0.09999999999999998, 0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 0.09999999999999987, 0.09999999999999987, 0.10000000000000009, 0.09999999999999964, 
    0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 0.09999999999999964, 0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 0.09999999999999964, 0.09999999999999964, 
    0.09999999999999964, 0.10000000000000053, 0.10000000000000053, 0.25, 0.25, 0.25, 0.25, 0.5 };
  double p8557_d1x1y1_xerrplus[] = { 0.10000000000000009, 0.09999999999999998, 0.09999999999999987, 0.09999999999999987, 0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 
    0.10000000000000009, 0.09999999999999964, 0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 0.09999999999999964, 0.10000000000000009, 0.10000000000000053, 0.10000000000000053, 
    0.09999999999999964, 0.09999999999999964, 0.09999999999999964, 0.25, 0.25, 0.25, 0.25, 0.5 };
  double p8557_d1x1y1_yval[] = { 1.076, 1.644, 1.717, 1.744, 1.718, 1.453, 1.24, 1.08, 0.8642, 
    0.678, 0.5001, 0.3669, 0.2623, 0.1768, 0.1238, 0.0849, 0.05931, 0.04299, 0.02735, 
    0.01973, 0.01215, 0.01075, 0.006172, 0.003252, 0.00128, 5.81E-4, 3.75E-4 };
  double p8557_d1x1y1_yerrminus[] = { 0.21876928486421487, 0.12473972903610141, 0.1115212984142491, 0.1040096149401583, 0.09947864092356709, 0.08372574275573791, 0.06762396025078685, 0.05869412236331675, 0.04735609781221421, 
    0.037486130768592266, 0.027644891028904422, 0.020437710243566914, 0.014759742545180116, 0.010121264743103996, 0.007220110802473879, 0.005086619702710239, 0.0036665242396580443, 0.00278485188115993, 0.001895521036549054, 
    0.001479898645178108, 0.001054371850914088, 9.486832980505138E-4, 4.828270912034659E-4, 3.060228749619871E-4, 1.6861791126686394E-4, 1.244266852407473E-4, 7.349829930005183E-5 };
  double p8557_d1x1y1_yerrplus[] = { 0.21876928486421487, 0.12473972903610141, 0.1115212984142491, 0.1040096149401583, 0.09947864092356709, 0.08372574275573791, 0.06762396025078685, 0.05869412236331675, 0.04735609781221421, 
    0.037486130768592266, 0.027644891028904422, 0.020437710243566914, 0.014759742545180116, 0.010121264743103996, 0.007220110802473879, 0.005086619702710239, 0.0036665242396580443, 0.00278485188115993, 0.001895521036549054, 
    0.001479898645178108, 0.001054371850914088, 9.486832980505138E-4, 4.828270912034659E-4, 3.060228749619871E-4, 1.6861791126686394E-4, 1.244266852407473E-4, 7.349829930005183E-5 };
  double p8557_d1x1y1_ystatminus[] = { 0.212, 0.094, 0.071, 0.057, 0.05, 0.041, 0.027, 0.023, 0.0194, 
    0.016, 0.0118, 0.0091, 0.0068, 0.005, 0.0037, 0.00281, 0.00215, 0.00177, 0.00131, 
    0.0011, 8.6E-4, 7.8E-4, 3.71E-4, 2.59E-4, 1.56E-4, 1.21E-4, 7.1E-5 };
  double p8557_d1x1y1_ystatplus[] = { 0.212, 0.094, 0.071, 0.057, 0.05, 0.041, 0.027, 0.023, 0.0194, 
    0.016, 0.0118, 0.0091, 0.0068, 0.005, 0.0037, 0.00281, 0.00215, 0.00177, 0.00131, 
    0.0011, 8.6E-4, 7.8E-4, 3.71E-4, 2.59E-4, 1.56E-4, 1.21E-4, 7.1E-5 };
  
	/*  ==============================================  */

	/* 10-30 Centrality */


  // Plot: p8557_d2x1y2
  double p8557_d2x1y1_xval[] = { 0.7, 0.9, 1.1, 1.3, 1.5, 1.7, 1.9, 2.1, 2.3, 
    2.5, 2.7, 2.9, 3.1, 3.3, 3.5, 3.7, 3.9, 4.1, 4.3, 
    4.5, 4.7, 4.9, 5.25, 5.75, 6.25, 6.75, 7.5 };
  double p8557_d2x1y1_xerrminus[] = { 0.09999999999999998, 0.09999999999999998, 0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 0.09999999999999987, 0.09999999999999987, 0.10000000000000009, 0.09999999999999964, 
    0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 0.09999999999999964, 0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 0.09999999999999964, 0.09999999999999964, 
    0.09999999999999964, 0.10000000000000053, 0.10000000000000053, 0.25, 0.25, 0.25, 0.25, 0.5 };
  double p8557_d2x1y1_xerrplus[] = { 0.10000000000000009, 0.09999999999999998, 0.09999999999999987, 0.09999999999999987, 0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 
    0.10000000000000009, 0.09999999999999964, 0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 0.09999999999999964, 0.10000000000000009, 0.10000000000000053, 0.10000000000000053, 
    0.09999999999999964, 0.09999999999999964, 0.09999999999999964, 0.25, 0.25, 0.25, 0.25, 0.5 };
  double p8557_d2x1y1_yval[] = { 1.06, 1.223, 1.342, 1.33, 1.236, 1.054, 0.8661, 0.7372, 0.6004, 
    0.4648, 0.3465, 0.2514, 0.1741, 0.1207, 0.08793, 0.0614, 0.04268, 0.03026, 0.0197, 
    0.0165, 0.01188, 0.006472, 0.004452, 0.001868, 0.001006, 4.23E-4, 1.31E-4 };
  double p8557_d2x1y1_yerrminus[] = { 0.14969635934116768, 0.08987213138676528, 0.0873212459828649, 0.08044874144447507, 0.07271863585079137, 0.06140032573203501, 0.04769580694358782, 0.040585958162891754, 0.03314830312399113, 
    0.02576198750096739, 0.019275372888740698, 0.014177799547179386, 0.009888377015466188, 0.006896375859826667, 0.005146736830264396, 0.0036970934529708603, 0.0026580067720004025, 0.001960255085441688, 0.001385929291125633, 
    0.001173882447266335, 9.154780172128657E-4, 6.348952669535347E-4, 3.5716942758304493E-4, 2.1153959440256098E-4, 1.4021768789992226E-4, 9.436630754670865E-5, 4.5541190146942804E-5 };
  double p8557_d2x1y1_yerrplus[] = { 0.14969635934116768, 0.08987213138676528, 0.0873212459828649, 0.08044874144447507, 0.07271863585079137, 0.06140032573203501, 0.04769580694358782, 0.040585958162891754, 0.03314830312399113, 
    0.02576198750096739, 0.019275372888740698, 0.014177799547179386, 0.009888377015466188, 0.006896375859826667, 0.005146736830264396, 0.0036970934529708603, 0.0026580067720004025, 0.001960255085441688, 0.001385929291125633, 
    0.001173882447266335, 9.154780172128657E-4, 6.348952669535347E-4, 3.5716942758304493E-4, 2.1153959440256098E-4, 1.4021768789992226E-4, 9.436630754670865E-5, 4.5541190146942804E-5 };
  double p8557_d2x1y1_ystatminus[] = { 0.14, 0.066, 0.056, 0.046, 0.038, 0.031, 0.02, 0.0169, 0.0141, 
    0.0112, 0.0085, 0.0065, 0.0047, 0.0034, 0.00267, 0.00206, 0.00159, 0.00125, 9.8E-4, 
    8.4E-4, 7.0E-4, 5.46E-4, 2.79E-4, 1.9E-4, 1.31E-4, 9.2E-5, 4.5E-5 };
  double p8557_d2x1y1_ystatplus[] = { 0.14, 0.066, 0.056, 0.046, 0.038, 0.031, 0.02, 0.0169, 0.0141, 
    0.0112, 0.0085, 0.0065, 0.0047, 0.0034, 0.00267, 0.00206, 0.00159, 0.00125, 9.8E-4, 
    8.4E-4, 7.0E-4, 5.46E-4, 2.79E-4, 1.9E-4, 1.31E-4, 9.2E-5, 4.5E-5 };
	/*  ==============================================  */

	/* 20-40 Centrality * */

  // Plot: p8557_d3x1y2
  double p8557_d3x1y1_xval[] = { 0.7, 0.9, 1.1, 1.3, 1.5, 1.7, 1.9, 2.1, 2.3, 
    2.5, 2.7, 2.9, 3.1, 3.3, 3.5, 3.7, 3.9, 4.1, 4.3, 
    4.5, 4.7, 4.9, 5.25, 5.75, 6.25, 6.75, 7.5 };
  double p8557_d3x1y1_xerrminus[] = { 0.09999999999999998, 0.09999999999999998, 0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 0.09999999999999987, 0.09999999999999987, 0.10000000000000009, 0.09999999999999964, 
    0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 0.09999999999999964, 0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 0.09999999999999964, 0.09999999999999964, 
    0.09999999999999964, 0.10000000000000053, 0.10000000000000053, 0.25, 0.25, 0.25, 0.25, 0.5 };
  double p8557_d3x1y1_xerrplus[] = { 0.10000000000000009, 0.09999999999999998, 0.09999999999999987, 0.09999999999999987, 0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 
    0.10000000000000009, 0.09999999999999964, 0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 0.09999999999999964, 0.10000000000000009, 0.10000000000000053, 0.10000000000000053, 
    0.09999999999999964, 0.09999999999999964, 0.09999999999999964, 0.25, 0.25, 0.25, 0.25, 0.5 };
  double p8557_d3x1y1_yval[] = { 0.6946, 0.758, 0.7873, 0.7486, 0.6874, 0.562, 0.4608, 0.3885, 0.3118, 
    0.2345, 0.1803, 0.1265, 0.09069, 0.06418, 0.04477, 0.0321, 0.02334, 0.01655, 0.01149, 
    0.00822, 0.00558, 0.004844, 0.002443, 0.001312, 7.01E-4, 3.15E-4, 1.68E-4 };
  double p8557_d3x1y1_yerrminus[] = { 0.07341784524214805, 0.0509825460329317, 0.049400404856640594, 0.044170238849252336, 0.039641518638922, 0.031995312156626945, 0.02500079998720041, 0.02110094784600919, 0.01701763790894612, 
    0.012803515142334937, 0.009848857801796104, 0.0069354163537598814, 0.005035960682928333, 0.003604677516782882, 0.0025554842985234714, 0.0018643229333996834, 0.0013897481786280565, 0.0010183319694480773, 7.451845409024532E-4, 
    5.658992843254E-4, 4.140978145317843E-4, 3.655680511204446E-4, 1.7682759965570986E-4, 1.1567627241573788E-4, 7.73692445355388E-5, 5.345091205957107E-5, 2.9120439557122074E-5 };
  double p8557_d3x1y1_yerrplus[] = { 0.07341784524214805, 0.0509825460329317, 0.049400404856640594, 0.044170238849252336, 0.039641518638922, 0.031995312156626945, 0.02500079998720041, 0.02110094784600919, 0.01701763790894612, 
    0.012803515142334937, 0.009848857801796104, 0.0069354163537598814, 0.005035960682928333, 0.003604677516782882, 0.0025554842985234714, 0.0018643229333996834, 0.0013897481786280565, 0.0010183319694480773, 7.451845409024532E-4, 
    5.658992843254E-4, 4.140978145317843E-4, 3.655680511204446E-4, 1.7682759965570986E-4, 1.1567627241573788E-4, 7.73692445355388E-5, 5.345091205957107E-5, 2.9120439557122074E-5 };
  double p8557_d3x1y1_ystatminus[] = { 0.0647, 0.0341, 0.0298, 0.0235, 0.0197, 0.0153, 0.0098, 0.0083, 0.0068, 
    0.0052, 0.004, 0.0029, 0.0022, 0.00164, 0.00123, 9.4E-4, 7.5E-4, 5.9E-4, 4.8E-4, 
    3.89E-4, 3.06E-4, 2.74E-4, 1.28E-4, 9.5E-5, 6.9E-5, 5.1E-5, 2.8E-5 };
  double p8557_d3x1y1_ystatplus[] = { 0.0647, 0.0341, 0.0298, 0.0235, 0.0197, 0.0153, 0.0098, 0.0083, 0.0068, 
    0.0052, 0.004, 0.0029, 0.0022, 0.00164, 0.00123, 9.4E-4, 7.5E-4, 5.9E-4, 4.8E-4, 
    3.89E-4, 3.06E-4, 2.74E-4, 1.28E-4, 9.5E-5, 6.9E-5, 5.1E-5, 2.8E-5 };
	/*  ==============================================  */

	/* 40-60 Centrality * */

  // Plot: p8557_d4x1y2
  double p8557_d4x1y1_xval[] = { 0.7, 0.9, 1.1, 1.3, 1.5, 1.7, 1.9, 2.1, 2.3, 
    2.5, 2.7, 2.9, 3.1, 3.3, 3.5, 3.7, 3.9, 4.1, 4.3, 
    4.5, 4.7, 4.9, 5.25, 5.75, 6.5, 0, 0 };
  double p8557_d4x1y1_xerrminus[] = { 0.09999999999999998, 0.09999999999999998, 0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 0.09999999999999987, 0.09999999999999987, 0.10000000000000009, 0.09999999999999964, 
    0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 0.09999999999999964, 0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 0.09999999999999964, 0.09999999999999964, 
    0.09999999999999964, 0.10000000000000053, 0.10000000000000053, 0.25, 0.25, 0.5, 0, 0 };
  double p8557_d4x1y1_xerrplus[] = { 0.10000000000000009, 0.09999999999999998, 0.09999999999999987, 0.09999999999999987, 0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 
    0.10000000000000009, 0.09999999999999964, 0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 0.09999999999999964, 0.10000000000000009, 0.10000000000000053, 0.10000000000000053, 
    0.09999999999999964, 0.09999999999999964, 0.09999999999999964, 0.25, 0.25, 0.5, 0, 0 };
  double p8557_d4x1y1_yval[] = { 0.2504, 0.2782, 0.3075, 0.2807, 0.2437, 0.1924, 0.1481, 0.1192, 0.09645, 
    0.07276, 0.05274, 0.03858, 0.02663, 0.01973, 0.01411, 0.009393, 0.007539, 0.005053, 0.003733, 
    0.002524, 0.002074, 0.001509, 8.87E-4, 4.19E-4, 1.5E-4 , 0, 0};
  double p8557_d4x1y1_yerrminus[] = { 0.027861442891566113, 0.02008631374842084, 0.020947553556441862, 0.0175, 0.014869095466772685, 0.011428035701729322, 0.008273451516749223, 0.00670820393249937, 0.005397897738935038, 
    0.00408768883355864, 0.0029882436312991616, 0.0022019309707617995, 0.001546932448428179, 0.0011734564329364766, 8.62670273047588E-4, 6.025188793722567E-4, 4.970965700947855E-4, 3.599236030048599E-4, 2.872159466324946E-4, 
    2.1726711670199886E-4, 1.9250974001333023E-4, 1.5970597985047398E-4, 8.0156097709407E-5, 5.423098745182499E-5, 2.5298221281347037E-5, 0, 0 };
  double p8557_d4x1y1_yerrplus[] = { 0.027861442891566113, 0.02008631374842084, 0.020947553556441862, 0.0175, 0.014869095466772685, 0.011428035701729322, 0.008273451516749223, 0.00670820393249937, 0.005397897738935038, 
    0.00408768883355864, 0.0029882436312991616, 0.0022019309707617995, 0.001546932448428179, 0.0011734564329364766, 8.62670273047588E-4, 6.025188793722567E-4, 4.970965700947855E-4, 3.599236030048599E-4, 2.872159466324946E-4, 
    2.1726711670199886E-4, 1.9250974001333023E-4, 1.5970597985047398E-4, 8.0156097709407E-5, 5.423098745182499E-5, 2.5298221281347037E-5, 0, 0 };
  double p8557_d4x1y1_ystatminus[] = { 0.0249, 0.0145, 0.0142, 0.0105, 0.0085, 0.0062, 0.0037, 0.003, 0.00243, 
    0.00186, 0.0014, 0.00106, 7.9E-4, 6.3E-4, 4.9E-4, 3.77E-4, 3.24E-4, 2.56E-4, 2.18E-4, 
    1.77E-4, 1.62E-4, 1.41E-4, 6.7E-5, 5.0E-5, 2.4E-5, 0, 0 };
  double p8557_d4x1y1_ystatplus[] = { 0.0249, 0.0145, 0.0142, 0.0105, 0.0085, 0.0062, 0.0037, 0.003, 0.00243, 
    0.00186, 0.0014, 0.00106, 7.9E-4, 6.3E-4, 4.9E-4, 3.77E-4, 3.24E-4, 2.56E-4, 2.18E-4, 
    1.77E-4, 1.62E-4, 1.41E-4, 6.7E-5, 5.0E-5, 2.4E-5 , 0, 0};
	/*  ==============================================  */

	/* 60-80 Centrality * */

  // Plot: p8557_d5x1y2
  double p8557_d5x1y1_xval[] = { 0.7, 0.9, 1.1, 1.3, 1.5, 1.7, 1.9, 2.1, 2.3, 
    2.5, 2.7, 2.9, 3.1, 3.3, 3.5, 3.7, 3.9, 4.25, 4.75, 
    5.5, 0, 0, 0, 0, 0, 0 };
  double p8557_d5x1y1_xerrminus[] = { 0.09999999999999998, 0.09999999999999998, 0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 0.09999999999999987, 0.09999999999999987, 0.10000000000000009, 0.09999999999999964, 
    0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 0.09999999999999964, 0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 0.25, 0.25, 
    0.5 , 0, 0, 0, 0, 0, 0};
  double p8557_d5x1y1_xerrplus[] = { 0.10000000000000009, 0.09999999999999998, 0.09999999999999987, 0.09999999999999987, 0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 
    0.10000000000000009, 0.09999999999999964, 0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 0.10000000000000009, 0.09999999999999964, 0.10000000000000009, 0.25, 0.25, 
    0.5 , 0, 0, 0, 0, 0, 0};
  double p8557_d5x1y1_yval[] = { 0.06508, 0.07166, 0.07848, 0.06791, 0.0506, 0.03839, 0.03088, 0.02348, 0.01796, 
    0.01307, 0.009976, 0.007496, 0.005041, 0.00349, 0.002671, 0.00178, 0.001337, 7.69E-4, 3.39E-4, 
    1.42E-4, 0, 0, 0, 0, 0, 0 };
  double p8557_d5x1y1_yerrminus[] = { 0.009465442409100591, 0.006329676137054723, 0.006120163396511567, 0.00472423538786966, 0.003392418016695466, 0.0025185908758669, 0.0018471599822430108, 0.0014117365193264642, 0.0010985900054160333, 
    8.140024569987489E-4, 6.433016399792558E-4, 5.008482804203285E-4, 3.6208286344426737E-4, 2.7271963625672427E-4, 2.2520435164534455E-4, 1.7098830369355678E-4, 1.435896932234344E-4, 7.102112361825881E-5, 4.4384682042344295E-5, 
    2.2135943621178656E-5, 0, 0, 0, 0, 0, 0 };
  double p8557_d5x1y1_yerrplus[] = { 0.009465442409100591, 0.006329676137054723, 0.006120163396511567, 0.00472423538786966, 0.003392418016695466, 0.0025185908758669, 0.0018471599822430108, 0.0014117365193264642, 0.0010985900054160333, 
    8.140024569987489E-4, 6.433016399792558E-4, 5.008482804203285E-4, 3.6208286344426737E-4, 2.7271963625672427E-4, 2.2520435164534455E-4, 1.7098830369355678E-4, 1.435896932234344E-4, 7.102112361825881E-5, 4.4384682042344295E-5, 
    2.2135943621178656E-5, 0, 0, 0, 0, 0, 0 };
  double p8557_d5x1y1_ystatminus[] = { 0.00889, 0.00522, 0.0047, 0.00328, 0.00226, 0.00163, 0.00102, 7.9E-4, 6.3E-4, 
    4.9E-4, 4.06E-4, 3.32E-4, 2.6E-4, 2.1E-4, 1.81E-4, 1.46E-4, 1.27E-4, 6.0E-5, 4.1E-5, 
    2.1E-5 , 0, 0, 0, 0, 0, 0};
  double p8557_d5x1y1_ystatplus[] = { 0.00889, 0.00522, 0.0047, 0.00328, 0.00226, 0.00163, 0.00102, 7.9E-4, 6.3E-4, 
    4.9E-4, 4.06E-4, 3.32E-4, 2.6E-4, 2.1E-4, 1.81E-4, 1.46E-4, 1.27E-4, 6.0E-5, 4.1E-5, 
    2.1E-5, 0, 0, 0, 0, 0, 0 };
	/*  ==============================================  */


	// pPb Xi+ particles
	
	 double pT[27], spectraFromFit[27];
	 copy(begin(p8557_d1x1y1_xval), end(p8557_d1x1y1_xval), begin(pT));
	TCanvas *c3 = new TCanvas("c3", "Test Canvas", 700, 400);
	int k=0; 
	for ( auto i : pT ){

		spectraFromFit[k] = 2.86252e-02*exp(-i*1.50842e+00) ;
//		cout << "spectraFromFit : " << spectraFromFit[k] << endl;
//		cout << "pT : " << pT[k] << endl;
		k++;
			
	}
  	

	/* Error Calculations For all Centralities */

	double xiYValAllCent[27], xiYStatErrPlusAllCent[27], xiYStatErrMinusAllCent[27], xiYSysErrPlusAllCent[27], xiYSysErrMinusAllCent[27],  xiYErrMinusAllCent[27], xiYErrPlusAllCent[27];

	double ratio[27]; /* PbPb vs pPb */
	double nBins = 27;
	for ( int i=0; i < 27; i++ ){

	/*  Mean per pT bin */
		xiYValAllCent[i] = 0;
		xiYValAllCent[i] = p8557_d1x1y1_yval[i]*0.5 + p8557_d2x1y1_yval[i]*0.5 + p8557_d3x1y1_yval[i] + p8557_d3x1y1_yval[i] + p8557_d4x1y1_yval[i] + p8557_d5x1y1_yval[i];

		ratio[i] = xiYValAllCent[i]/spectraFromFit[i];
		cout << "Ratio from fit: " << ratio[i] << endl;
	/*  ==============================================  */

	/* Statistical Errors per pT bin - Sum in Quadrature */
		double m1, m2, m3, m4, m5;
		xiYStatErrPlusAllCent[i] = 0;
		m1 = p8557_d1x1y1_ystatplus[i]*0.5;
		m2 = p8557_d2x1y1_ystatplus[i]*0.5;
		m3 = p8557_d3x1y1_ystatplus[i];
		m4 = p8557_d4x1y1_ystatplus[i];
		m5 = p8557_d5x1y1_ystatplus[i];

		xiYStatErrPlusAllCent[i] = sqrt(m1*m1 + m2*m2 + m3*m3 + m4*m4 + m5*m5);

	/*  ==============================================  */

	/* Statistical Errors Minus per pT bin - Sum */

		double n1, n2, n3, n4, n5;
		xiYStatErrMinusAllCent[i] = 0;
		n1 = p8557_d1x1y1_ystatminus[i]*0.5;
		n2 = p8557_d2x1y1_ystatminus[i]*0.5;
		n3 = p8557_d3x1y1_ystatminus[i];
		n4 = p8557_d4x1y1_ystatminus[i];
		n5 = p8557_d5x1y1_ystatminus[i];

		xiYStatErrMinusAllCent[i] = sqrt(n1*n1 + n2*n2 + n3*n3 + n4*n4 + n5*n5);
	/*  ==============================================  */

	/* Systematic Errors Plus per pT bin - Sum */

		xiYSysErrPlusAllCent[i] = 0;
		xiYSysErrPlusAllCent[i] = p8557_d1x1y1_yerrplus[i] +  p8557_d2x1y1_yerrplus[i] +  p8557_d3x1y1_yerrplus[i] +  p8557_d4x1y1_yerrplus[i] +  p8557_d5x1y1_yerrplus[i];

	/*  ==============================================  */

	/* Systematic Errors Y-Negative per pT bin - Sum */

		xiYSysErrMinusAllCent[i] = 0;
		xiYSysErrMinusAllCent[i] = p8557_d1x1y1_yerrminus[i] +  p8557_d2x1y1_yerrminus[i] +  p8557_d3x1y1_yerrminus[i] +  p8557_d4x1y1_yerrminus[i] +  p8557_d5x1y1_yerrminus[i];
	/*  ==============================================  */


	/* Systematic + Statistical Errors Y-Plus per pT bin - Sum */
	 double q1, q2;
	 q1 =  xiYSysErrPlusAllCent[i];
	 q2 =  xiYSysErrPlusAllCent[i];
	 xiYErrPlusAllCent[i] = sqrt(q1*q1 + q2*q2);
	
	/*  ==============================================  */

	/* Systematic + Statistical Errors Y-Minus per pT bin - Sum */
	 double p1, p2;
	 p1 =  xiYSysErrMinusAllCent[i];
	 p2 =  xiYSysErrMinusAllCent[i];
	 xiYErrMinusAllCent[i] = sqrt(p1*p1 + p2*p2);
	/*  ==============================================  */

}

	double xiXValAllCent[27], xiXErrMinusAllCent[27], xiXErrPlusAllCent[27];
	 copy(begin(p8557_d1x1y1_xerrminus), end(p8557_d1x1y1_xerrminus), begin(xiXErrMinusAllCent));
	 copy(begin(p8557_d1x1y1_xerrplus), end(p8557_d1x1y1_xerrplus), begin(xiXErrPlusAllCent));
	 copy(begin(p8557_d1x1y1_xval), end(p8557_d1x1y1_xval), begin(xiXValAllCent));
	
  
	TCanvas *c2 = new TCanvas("c2", "Test Canvas", 700, 400);
	TCanvas *c1 = new TCanvas("c1", "Test Canvas", 700, 400);

	TMultiGraph *mg = new TMultiGraph();


	/* Turn off error bars for a while */
	bool turnOn = 0;
	for (int i=0; i<27 && turnOn; i++){

		// Cent 00-10
		p8557_d1x1y1_xerrplus[i] = 0;p8557_d1x1y1_xerrminus[i] = 0;
		p8557_d1x1y1_yerrplus[i] = 0;p8557_d1x1y1_yerrminus[i] = 0;

		// Cent 10-20
		p8557_d2x1y1_xerrplus[i] = 0;p8557_d2x1y1_xerrminus[i] = 0;
		p8557_d2x1y1_yerrplus[i] = 0;p8557_d2x1y1_yerrminus[i] = 0;

		// Cent 20-40
		p8557_d3x1y1_xerrplus[i] = 0;p8557_d3x1y1_xerrminus[i] = 0;
		p8557_d3x1y1_yerrplus[i] = 0;p8557_d3x1y1_yerrminus[i] = 0;


		// Cent 40-60
		p8557_d4x1y1_xerrplus[i] = 0;p8557_d4x1y1_xerrminus[i] = 0;
		p8557_d4x1y1_yerrplus[i] = 0;p8557_d4x1y1_yerrminus[i] = 0;


		// Cent 60-80
		p8557_d5x1y1_xerrplus[i] = 0;p8557_d5x1y1_xerrminus[i] = 0;
		p8557_d5x1y1_yerrplus[i] = 0;p8557_d5x1y1_yerrminus[i] = 0;

		// All Centralities
		xiXErrPlusAllCent[i]=0;	xiXErrMinusAllCent[i]=0; 
		xiYErrPlusAllCent[i]=0;	xiYErrMinusAllCent[i]=0; 

	}



	c3->SetLogy(1);
	TGraph *g = new TGraph(nBins, pT, spectraFromFit);
	g->SetTitle("#Xi^{+} spectra from pPb data, CMS");
	g->SetMarkerStyle(21);
	g->SetMarkerSize(1.5);
	g->SetMarkerColor(kRed);
	g->Draw("alp");

	/* ===================================================== */
	c1->cd();
//	TGraph *gp1 = new TGraph(27, p8557_d1x1y1_xval, p8557_d1x1y1_yval);
	TGraphAsymmErrors *gp1 = new TGraphAsymmErrors(27, p8557_d1x1y1_xval, p8557_d1x1y1_yval,   p8557_d1x1y1_xerrplus,   p8557_d1x1y1_yerrplus,    p8557_d1x1y1_xerrminus, p8557_d1x1y1_yerrminus);
	gp1->SetMarkerColor(15);
	gp1->SetMarkerStyle(21);
	gp1->GetYaxis()->SetLimits(0,9);
	mg->Add(gp1);
//	gp1->Draw("ALP");

//	TGraph *gp2 = new TGraph(27, p8557_d2x1y1_xval, p8557_d2x1y1_yval);
	TGraphAsymmErrors *gp2 = new TGraphAsymmErrors(27, p8557_d2x1y1_xval, p8557_d2x1y1_yval,   p8557_d2x1y1_xerrplus,   p8557_d2x1y1_yerrplus,    p8557_d2x1y1_xerrminus, p8557_d2x1y1_yerrminus);
	gp2->SetMarkerColor(2);
	gp2->SetMarkerStyle(21);
	mg->Add(gp2);
//	gp2->Draw("same");


//	TGraph *gp3 = new TGraph(27, p8557_d3x1y1_xval, p8557_d3x1y1_yval);
	TGraphAsymmErrors *gp3 = new TGraphAsymmErrors(27, p8557_d3x1y1_xval, p8557_d3x1y1_yval,   p8557_d3x1y1_xerrplus,   p8557_d3x1y1_yerrplus,    p8557_d3x1y1_xerrminus, p8557_d3x1y1_yerrminus);
	gp3->SetMarkerColor(8);
	gp3->SetMarkerStyle(21);
	mg->Add(gp3);
//	gp3->Draw("same");


//	TGraph *gp4 = new TGraph(27, p8557_d4x1y1_xval, p8557_d4x1y1_yval);
	TGraphAsymmErrors *gp4 = new TGraphAsymmErrors(27, p8557_d4x1y1_xval, p8557_d4x1y1_yval,   p8557_d4x1y1_xerrplus,   p8557_d4x1y1_yerrplus,    p8557_d4x1y1_xerrminus, p8557_d4x1y1_yerrminus);
	gp4->SetMarkerColor(7);
	gp4->SetMarkerStyle(21);
	mg->Add(gp4);
//	gp4->Draw("same");


//	TGraph *gp5 = new TGraph(27, p8557_d5x1y1_xval, p8557_d5x1y1_yval);
	TGraphAsymmErrors *gp5 = new TGraphAsymmErrors(27, p8557_d5x1y1_xval, p8557_d5x1y1_yval,   p8557_d5x1y1_xerrplus,   p8557_d5x1y1_yerrplus,    p8557_d5x1y1_xerrminus, p8557_d5x1y1_yerrminus);
	gp5->SetMarkerColor(46);
	gp5->SetMarkerStyle(21);
	mg->Add(gp5);
//	gp5->Draw("same");


	//TGraph *gp6 = new TGraph(27, xiXValAllCent, xiYValAllCent);
  	TGraphAsymmErrors *gp6 = new TGraphAsymmErrors(27, xiXValAllCent, xiYValAllCent, xiXErrPlusAllCent, xiYErrPlusAllCent, xiXErrMinusAllCent, xiYErrMinusAllCent);
	gp6->SetMarkerColor(4);
	gp6->SetMarkerStyle(21);
//	gp6->Draw("same");
	c1->SetLogy(1);
	mg->Add(gp6);
	mg->SetTitle("Spectra of #Xi^{+} all the Centrality Bins in PbPb collisions, ALICE");
	gPad->SetGrid();
	mg->Draw("alp");
	mg->GetXaxis()->SetTitle("p_{T} (GeV/c)");
	mg->GetYaxis()->SetTitle("Invariant Yield   #frac{d^{2}N}{2#pi p_{T}dp_{T}}");


	TGraph *gp7 = new TGraph(27, xiXValAllCent, xiYValAllCent);
	c2->cd();
	gp7->SetMarkerColor(9);
	gp7->SetMarkerStyle(42);
//	gp7->Draw("same");


//	 /* 
	c2->cd();
	c2->SetLogy(1);
  	TGraphAsymmErrors *gc = new TGraphAsymmErrors(27, xiXValAllCent, xiYValAllCent, xiXErrPlusAllCent, xiYErrPlusAllCent, xiXErrMinusAllCent, xiYErrMinusAllCent);
	gc->SetMarkerStyle(21);
	gc->SetMarkerColor(4);
	gc->SetTitle("ALICE PbPb #Xi^{+} spectra for all centralities with errors (asymmetric) ");
	gc->GetYaxis()->SetTitle("Invariant Yield   #frac{d^{2}N}{2#pi p_{T}dp_{T}}");
	gc->GetXaxis()->SetTitle("p_{T} (GeV/c)");
	gc->Draw("ALP same");



	c1->cd();
	TLegend *lg = new TLegend(0.511494,0.672043,0.892241,0.870968);
	lg->AddEntry(gp1, "0-10% Centrality", "lp");
	lg->AddEntry(gp2, "10-20% Centrality", "lp");
	lg->AddEntry(gp3, "20-40% Centrality", "lp");
	lg->AddEntry(gp4, "40-60% Centrality", "lp");
	lg->AddEntry(gp5, "60-80% Centrality", "lp");
	lg->AddEntry(gp6, "For All Centralities", "lp");
	lg->Draw();


	/* Bin Width Plots */
	double count[27];
	TCanvas *c4 = new TCanvas("c4", "", 700, 400);
	for (int i=0; i < 27; i++) count[i] = i;
	TGraph *gbw = new TGraph(27, count, pT);
	gbw->SetMarkerStyle(20);
	gbw->SetMarkerColor(kBlue);
	gbw->GetYaxis()->SetTitle("Bin width");
	gbw->GetXaxis()->SetTitle("index no");
	c4->SetGrid();
	gbw->Draw();

//	*/


} // Closing main
Example #12
0
void plot( TString stream = "eleTau", TString variable = "diTauVisMass", Float_t xMax = 50){

  TCanvas *c1 = new TCanvas("c1","",5,30,650,600);
  c1->SetGrid(0,0);
  c1->SetFillStyle(4000);
  c1->SetFillColor(10);
  c1->SetTicky();
  c1->SetObjectStat(0);
  
  TLegend* leg = new TLegend(0.14,0.60,0.41,0.85,NULL,"brNDC");
  leg->SetBorderSize(0);
  leg->SetTextSize(0.03);
  leg->SetFillColor(0);

  ifstream is;

  
  is.open("submit/grid/results_"+stream+"_SM_"+variable+".txt");  
  int nMassPoints = 0;
  char* c0 = new char[100];
  while (is.good())     
    {
      is.getline(c0,100,'\n');
      printf("%s\n",c0);
      nMassPoints++;
    }
  is.close();
  nMassPoints -= 1;
  cout << "Using " << nMassPoints << " mass points" << endl;

  if(nMassPoints!=8){
    cout << "Check the mass points!" << endl;
    return;
  }


  Float_t obsX[]          = {0.,0.,0.,0.,0.,0.,0.,0.};
  float obsY[]            = {0.,0.,0.,0.,0.,0.,0.,0.};

  float X[]               = {0.,0.,0.,0.,0.,0.,0.,0.};
  float Y[]               = {0.,0.,0.,0.,0.,0.,0.,0.};

  float eX1sL[]           = {0.,0.,0.,0.,0.,0.,0.,0.};
  float eY1sL[]           = {0.,0.,0.,0.,0.,0.,0.,0.};
  float eX1sH[]           = {0.,0.,0.,0.,0.,0.,0.,0.};
  float eY1sH[]           = {0.,0.,0.,0.,0.,0.,0.,0.};

  float eX2sL[]           = {0.,0.,0.,0.,0.,0.,0.,0.};
  float eY2sL[]           = {0.,0.,0.,0.,0.,0.,0.,0.};
  float eX2sH[]           = {0.,0.,0.,0.,0.,0.,0.,0.};
  float eY2sH[]           = {0.,0.,0.,0.,0.,0.,0.,0.};

  char* c = new char[100];
  is.open("submit/grid/results_"+stream+"_SM_"+variable+".txt");

  int countMass = 0;

  while (is.good())     
    {
      is.getline(c,100,'\n');
      if (is.good()){

	cout << "Now doing mass point number " << countMass << endl;

	eX1sL[countMass] = 0.;
	eX1sH[countMass] = 0.;
	eX2sL[countMass] = 0.;
	eX2sH[countMass] = 0.;

	string line(c);
	char* cSplit = strtok ( c ," ");

	int counter = 0;
	while (cSplit != NULL)
	  {
	    cout << "Parsing the " << counter << "th number in line " << countMass << endl;
	    //cout << atof(cSplit) << endl;
	    if(counter==0){
	      X[countMass]           = atof(cSplit);
	      obsX[countMass]        = atof(cSplit);
	    }
	    if(counter==1) Y[countMass]       = atof(cSplit);
 
	    if(counter==2) eY1sH[countMass]   = atof(cSplit);
	    if(counter==3) eY2sH[countMass]   = atof(cSplit);

	    if(counter==4) eY1sL[countMass]   = atof(cSplit);
	    if(counter==5) eY2sL[countMass]   = atof(cSplit);

	    if(counter==6) obsY[countMass]    = atof(cSplit);

	    counter++;
	    cSplit = strtok ( NULL ," ");
	  }

	countMass++;

      }
    }
  

  for(int i = 0 ; i < nMassPoints ; i++){
    cout << "Mass " << X[i] << endl;
    cout << "Exp  " << Y[i] << endl;
    cout << "Obs  " << obsY[i] << endl;

    eY1sH[i] = eY1sH[i]-Y[i];
    eY1sL[i] = fabs(eY1sL[i]-Y[i]);
    eY2sH[i] = eY2sH[i]-Y[i];
    eY2sL[i] = TMath::Max( TMath::Abs(eY2sL[i]-Y[i]), eY1sL[i] );

    if((string(stream.Data())).find("mu")!=string::npos && (string(variable.Data())).find("diTauVisMass")!=string::npos &&
       (i==1 || i==4) ){
      eY1sH[i] = eY1sH[i-1];
      eY2sH[i] = eY2sH[i-1];
    }

    if((string(stream.Data())).find("mu")!=string::npos && (string(variable.Data())).find("diTauNSVfitMass")!=string::npos &&
       i==4 )
      eY2sH[i] = eY2sH[i-1];

    if((string(stream.Data())).find("ele")!=string::npos && (string(variable.Data())).find("diTauVisMass")!=string::npos &&
       i==6 )
      eY2sH[i] = eY2sH[7]-Y[7];

    cout << "1s Up   " << eY1sH[i] << endl;
    cout << "1s Down " << eY1sL[i] << endl;
  }

  TMultiGraph *mg = new TMultiGraph();
  mg->SetTitle("");

  TGraphAsymmErrors* expected = new TGraphAsymmErrors(nMassPoints, X, Y, eX1sL ,eX1sL , eX1sL, eX1sL);
  TGraphAsymmErrors* oneSigma = new TGraphAsymmErrors(nMassPoints, X, Y, eX1sL, eX1sL, eY1sL, eY1sH);
  TGraphAsymmErrors* twoSigma = new TGraphAsymmErrors(nMassPoints, X, Y, eX2sL, eX2sL, eY2sL, eY2sH);
  TGraphAsymmErrors* observed = new TGraphAsymmErrors(nMassPoints, X, obsY, eX1sL ,eX1sL , eX1sL, eX1sL);

 
  oneSigma->SetMarkerColor(kBlack);
  oneSigma->SetMarkerStyle(kFullCircle);
  oneSigma->SetFillColor(kGreen);
  oneSigma->SetFillStyle(1001);

  twoSigma->SetMarkerColor(kBlack);
  twoSigma->SetMarkerStyle(kFullCircle);
  twoSigma->SetFillColor(kYellow);
  twoSigma->SetFillStyle(1001);

  expected->SetMarkerColor(kBlack);
  expected->SetMarkerStyle(kFullCircle);
  expected->SetMarkerSize(1.5);
  expected->SetLineColor(kBlack);
  expected->SetLineWidth(2);

  observed->SetMarkerColor(kBlue);
  observed->SetMarkerStyle(1);
  observed->SetLineColor(kBlue);
  observed->SetLineWidth(4);

  mg->Add(twoSigma);
  mg->Add(oneSigma);
  mg->Add(expected);
  mg->Add(observed);

  mg->Draw("ALP3");

  c1->cd();
  gPad->Modified();
  mg->GetXaxis()->SetLimits(105,140);
  mg->GetYaxis()->SetTitleOffset(0.97);
  mg->SetMinimum(0.);
  mg->SetMaximum(xMax);
  mg->GetXaxis()->SetTitle("m_{H} (GeV)");
  mg->GetYaxis()->SetTitle("#sigma X BR(H#rightarrow#tau#tau)_{95% CLs}/#sigma_{SM}");

  if((string(stream.Data())).find("ele")!=string::npos )
    leg->SetHeader("#splitline{CMS Preliminary}{#sqrt{s}=7 TeV, 1.9 fb^{-1}, #tau_{e}#tau_{had}}");
  else if((string(stream.Data())).find("mu")!=string::npos )
    leg->SetHeader("#splitline{CMS Preliminary}{#sqrt{s}=7 TeV, 1.9 fb^{-1}, #tau_{#mu}#tau_{had}}");

  leg->AddEntry(expected,"Expected CLs limit","P");
  leg->AddEntry(observed,"Observed CLs limit","L");

  leg->Draw();

  TF1 *line = new TF1("line","1",100,150);
  line->SetLineColor(kRed);
  line->SetLineWidth(2);

  line->Draw("SAME");

  gPad->SaveAs("submit/grid/limits_"+stream+"_"+variable+".png");

}
Example #13
0
void runBATCalculator()
{
    // Definiton of a RooWorkspace containing the statistics model. Later the
    // information for BATCalculator is retrieved from the workspace. This is
    // certainly a bit of overhead but better from an educative point of view.
    cout << "preparing the RooWorkspace object" << endl;

    RooWorkspace* myWS = new RooWorkspace("myWS", true);

    // combined prior for signal contribution
    myWS->factory("Product::signal({sigma_s[0,20],L[5,15],epsilon[0,1]})");
    myWS->factory("N_bkg[0,3]");
    // define prior functions
    // uniform prior for signal crosssection
    myWS->factory("Uniform::prior_sigma_s(sigma_s)");
    // (truncated) prior for efficiency
    myWS->factory("Gaussian::prior_epsilon(epsilon,0.51,0.0765)");
    // (truncated) Gaussian prior for luminosity
    myWS->factory("Gaussian::prior_L(L,10,1)");
    // (truncated) Gaussian prior for bkg crosssection
    myWS->factory("Gaussian::prior_N_bkg(N_bkg,0.52,0.156)");

    // Poisson distribution with mean signal+bkg
    myWS->factory("Poisson::model(n[0,300],sum(signal,N_bkg))");

    // define the global prior function
    myWS->factory("PROD::prior(prior_sigma_s,prior_epsilon,prior_L,prior_N_bkg)");

    // Definition of observables and parameters of interest
    myWS->defineSet("obsSet", "n");
    myWS->defineSet("poiSet", "sigma_s");
    myWS->defineSet("nuisanceSet", "N_bkg,L,epsilon");

    // ->model complete (Additional information can be found in the
    // RooStats manual)

    //  feel free to vary the parameters, but don't forget to choose reasonable ranges for the
    // variables. Currently the Bayesian methods will often not work well if the variable ranges
    // are either too short (for obvious reasons) or too large (for technical reasons).

    // A ModelConfig object is used to associate parts of your workspace with their statistical
    // meaning (it is also possible to initialize BATCalculator directly with elements from the
    // workspace but if you are sharing your workspace with others or if you want to use several
    // different methods the use of ModelConfig will most often turn out to be the better choice.)

    // setup the ModelConfig object
    cout << "preparing the ModelConfig object" << endl;

    ModelConfig modelconfig("modelconfig", "ModelConfig for this example");
    modelconfig.SetWorkspace(*myWS);

    modelconfig.SetPdf(*(myWS->pdf("model")));
    modelconfig.SetParametersOfInterest(*(myWS->set("poiSet")));
    modelconfig.SetPriorPdf(*(myWS->pdf("prior")));
    modelconfig.SetNuisanceParameters(*(myWS->set("nuisanceSet")));
    modelconfig.SetObservables(*(myWS->set("obsSet")));


    // use BATCalculator to the derive credibility intervals as a function of the observed number of
    // events in the hypothetical experiment

    // define vector with tested numbers of events
    TVectorD obsEvents;
    // define vectors which will be filled with the lower and upper limits for each tested number
    // of observed events
    TVectorD BATul;
    TVectorD BATll;

    // fix upper limit of tested observed number of events
    int obslimit = 10;

    obsEvents.ResizeTo(obslimit);
    BATul.ResizeTo(obslimit);
    BATll.ResizeTo(obslimit);


    cout << "starting the calculation of Bayesian credibility intervals with BATCalculator" << endl;
    // loop over observed number of events in the hypothetical experiment
    for (int obs = 1; obs <= obslimit; obs++) {

        obsEvents[obs - 1] = (static_cast<double>(obs));

        // prepare data input for the the observed number of events
        // adjust number of observed events in the workspace. This is communicated to ModelConfig!
        myWS->var("n")->setVal(obs);
        // create data
        RooDataSet data("data", "", *(modelconfig.GetObservables()));
        data.add( *(modelconfig.GetObservables()));

        // prepare BATCalulator
        BATCalculator batcalc(data, modelconfig);

        // give the BATCalculator a unique name (always a good idea in ROOT)
        TString namestring = "mybatc_";
        namestring += obs;
        batcalc.SetName(namestring);

        // fix amount of posterior probability in the calculated interval.
        // the name confidence level is incorrect here
        batcalc.SetConfidenceLevel(0.90);

        // fix length of the Markov chain. (in general: the longer the Markov chain the more
        // precise will be the results)
        batcalc.SetnMCMC(20000);

        // retrieve SimpleInterval object containing the information about the interval (this
        // triggers the actual calculations)
        SimpleInterval* interval = batcalc.GetInterval1D("sigma_s");

        std::cout << "BATCalculator: 90% credibility interval: [ " << interval->LowerLimit() << " - " << interval->UpperLimit() << " ] or 95% credibility upper limit\n";

        // add the interval borders for the current number of observed events to the vectors
        // containing the lower and upper limits
        BATll[obs - 1] = interval->LowerLimit();
        BATul[obs - 1] = interval->UpperLimit();

        // clean up for next loop element
        batcalc.CleanCalculatorForNewData();
        delete interval;
    }
    cout << "all limits calculated" << endl;

    // summarize the results in a plot

    TGraph* grBATll = new TGraph(obsEvents, BATll);
    grBATll->SetLineColor(kGreen);
    grBATll->SetLineWidth(200);
    grBATll->SetFillStyle(3001);
    grBATll->SetFillColor(kGreen);

    TGraph* grBATul = new TGraph(obsEvents, BATul);
    grBATul->SetLineColor(kGreen);
    grBATul->SetLineWidth(-200);
    grBATul->SetFillStyle(3001);
    grBATul->SetFillColor(kGreen);

    // create and draw multigraph
    TMultiGraph* mg = new TMultiGraph("BayesianLimitsBATCalculator", "BayesianLimitsBATCalculator");
    mg->SetTitle("example of Bayesian credibility intervals derived with BATCAlculator ");

    mg->Add(grBATll);
    mg->Add(grBATul);

    mg->Draw("AC");

    mg->GetXaxis()->SetTitle ("# observed events");
    mg->GetYaxis()->SetTitle("limits on signal S (size of test: 0.1)");

    mg->Draw("AC");
}
void Pythia8_Dijet30_result_JER_akPu4PF_(abs(refeta)<2)&&(hiBin>60)_refpt()
{
//=========Macro generated from canvas: Can_result_3/
//=========  (Mon Apr 18 03:09:33 2016) by ROOT version6.02/13
   TCanvas *Can_result_3 = new TCanvas("Can_result_3", "",18,40,700,500);
   gStyle->SetOptFit(1);
   Can_result_3->Range(-2.301397,-0.01150186,237.5545,0.3828568);
   Can_result_3->SetFillColor(0);
   Can_result_3->SetBorderMode(0);
   Can_result_3->SetBorderSize(2);
   Can_result_3->SetFrameBorderMode(0);
   Can_result_3->SetFrameBorderMode(0);
   
   TMultiGraph *multigraph = new TMultiGraph();
   multigraph->SetName("name");
   multigraph->SetTitle("JER_akPu4PF");
   
   Double_t Graph_fx1007[11] = {
   45,
   55,
   65,
   75,
   85,
   95,
   105,
   115,
   130,
   150,
   180};
   Double_t Graph_fy1007[11] = {
   0.1976721,
   0.1639212,
   0.1562002,
   0.1480066,
   0.1479035,
   0.1333827,
   0.1160421,
   0.1205967,
   0.1105508,
   0.08141581,
   0.09210746};
   Double_t Graph_fex1007[11] = {
   5,
   5,
   5,
   5,
   5,
   5,
   5,
   5,
   10,
   10,
   20};
   Double_t Graph_fey1007[11] = {
   0.001003849,
   0.001317066,
   0.001658995,
   0.002251738,
   0.003095601,
   0.004152981,
   0.005688263,
   0.008277583,
   0.006320737,
   0.01258781,
   0.01599127};
   TGraphErrors *gre = new TGraphErrors(11,Graph_fx1007,Graph_fy1007,Graph_fex1007,Graph_fey1007);
   gre->SetName("Graph");
   gre->SetTitle("some title_0");
   gre->SetFillColor(1);
   gre->SetFillStyle(0);
   
   TH1F *Graph_Graph1007 = new TH1F("Graph_Graph1007","some title_0",100,24,216);
   Graph_Graph1007->SetMinimum(0.0558432);
   Graph_Graph1007->SetMaximum(0.2116608);
   Graph_Graph1007->SetDirectory(0);
   Graph_Graph1007->SetStats(0);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#000099");
   Graph_Graph1007->SetLineColor(ci);
   Graph_Graph1007->GetXaxis()->SetLabelFont(42);
   Graph_Graph1007->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1007->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1007->GetXaxis()->SetTitleFont(42);
   Graph_Graph1007->GetYaxis()->SetLabelFont(42);
   Graph_Graph1007->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1007->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1007->GetYaxis()->SetTitleFont(42);
   Graph_Graph1007->GetZaxis()->SetLabelFont(42);
   Graph_Graph1007->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1007->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1007->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1007);
   
   multigraph->Add(gre,"");
   
   Double_t Graph_fx1008[10] = {
   33.60148,
   40.66353,
   49.20982,
   59.5523,
   72.06846,
   87.21514,
   105.5452,
   127.7278,
   154.5724,
   187.059};
   Double_t Graph_fy1008[10] = {
   0.3165438,
   0.2200061,
   0.1916064,
   0.1736762,
   0.1550799,
   0.1417295,
   0.1352239,
   0.1191096,
   0.1233824,
   0.06176231};
   Double_t Graph_fex1008[10] = {
   3.19525,
   3.8668,
   4.67949,
   5.66299,
   6.85317,
   8.29351,
   10.03657,
   12.14595,
   14.6987,
   17.7879};
   Double_t Graph_fey1008[10] = {
   0.01253682,
   0.005719637,
   0.004019816,
   0.005043033,
   0.006710735,
   0.008656837,
   0.01379847,
   0.02334296,
   0.03556038,
   0.01948799};
   gre = new TGraphErrors(10,Graph_fx1008,Graph_fy1008,Graph_fex1008,Graph_fey1008);
   gre->SetName("Graph");
   gre->SetTitle("Graph");
   gre->SetFillColor(1);
   gre->SetFillStyle(0);
   gre->SetLineColor(2);
   gre->SetMarkerColor(2);
   
   TH1F *Graph_Graph1008 = new TH1F("Graph_Graph1008","Graph",100,12.96216,222.291);
   Graph_Graph1008->SetMinimum(0.01359369);
   Graph_Graph1008->SetMaximum(0.3577612);
   Graph_Graph1008->SetDirectory(0);
   Graph_Graph1008->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1008->SetLineColor(ci);
   Graph_Graph1008->GetXaxis()->SetLabelFont(42);
   Graph_Graph1008->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1008->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1008->GetXaxis()->SetTitleFont(42);
   Graph_Graph1008->GetYaxis()->SetLabelFont(42);
   Graph_Graph1008->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1008->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1008->GetYaxis()->SetTitleFont(42);
   Graph_Graph1008->GetZaxis()->SetLabelFont(42);
   Graph_Graph1008->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1008->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1008->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1008);
   
   multigraph->Add(gre,"");
   multigraph->Draw("AP");
   multigraph->GetXaxis()->SetTitle("refpt");
   multigraph->GetXaxis()->SetLabelFont(42);
   multigraph->GetXaxis()->SetLabelSize(0.035);
   multigraph->GetXaxis()->SetTitleSize(0.035);
   multigraph->GetXaxis()->SetTitleFont(42);
   multigraph->GetYaxis()->SetTitle("#sigma_{Reco./Gen.}");
   multigraph->GetYaxis()->SetLabelFont(42);
   multigraph->GetYaxis()->SetLabelSize(0.035);
   multigraph->GetYaxis()->SetTitleSize(0.035);
   multigraph->GetYaxis()->SetTitleFont(42);
   
   TLegend *leg = new TLegend(0.65,0.7,0.85,0.85,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   TLegendEntry *entry=leg->AddEntry("Graph","allJets","l");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph","from chris","l");
   entry->SetLineColor(2);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   leg->Draw();
   TLatex *   tex = new TLatex(0.35,0.8,"#bf{#color[2]{|#eta_{jet}|<2.0}}");
tex->SetNDC();
   tex->SetTextFont(43);
   tex->SetTextSize(26);
   tex->SetLineWidth(2);
   tex->Draw();
      tex = new TLatex(0.17,0.25,"Centrality:30-100%");
tex->SetNDC();
   tex->SetTextFont(43);
   tex->SetTextSize(26);
   tex->SetLineWidth(2);
   tex->Draw();
   
   TPaveText *pt = new TPaveText(0.3743391,0.9365254,0.6256609,0.995,"blNDC");
   pt->SetName("title");
   pt->SetBorderSize(0);
   pt->SetFillColor(0);
   pt->SetFillStyle(0);
   pt->SetTextFont(42);
   AText = pt->AddText("JER_akPu4PF");
   pt->Draw();
   Can_result_3->Modified();
   Can_result_3->cd();
   Can_result_3->SetSelected(Can_result_3);
}
Example #15
0
void graphLE3(Long64_t entry=0,int num=2,int spot=0){
  
  gROOT->ProcessLine(".L ~/analysis/scripts/LoadStyle.C");
  LoadStyle();

  LendaEvent * event = new LendaEvent();
  
  TTree* flt =(TTree*)gDirectory->Get("flt");
  
  flt->SetBranchAddress("Event",&event);

  flt->GetEntry(entry);

  cout<<event->Traces.size()<<endl;


  int size = (int) event->Traces[spot].size();

  Double_t* x = malloc(size*sizeof(Double_t));
  Double_t* y = malloc(size*sizeof(Double_t));

  Double_t* y1= malloc(size*sizeof(Double_t));
    

  Double_t* y2=malloc(size*sizeof(Double_t));
    

    cout<<"size is "<<size<<endl;
    for (int i=0;i<size;i++){

      x[i]=i*10;
      y[i]=event->Traces[spot][i] -380;
      y1[i]=event->Filters[spot][i];
      y2[i]=event->CFDs[spot][i];
    }
    cout<<"50 "<<event->CFDs[spot][50]<<endl;
    cout<<"50 "<<event->CFDs[spot][51]<<endl;
    cout<<"50 "<<event->CFDs[spot][52]<<endl;
    cout<<"50 "<<event->CFDs[spot][53]<<endl;



    TGraph *gr = new TGraph(size,x,y);
    TGraph *gr1 = new TGraph(size,x,y1);
    TGraph *gr2 = new TGraph(size,x,y2);

    TCanvas *c = new TCanvas();

    c->cd(1);

    gr->SetFillColor(kBlack);
    gr1->SetFillColor(0);
    gr2->SetFillColor(0);

    gr->SetLineColor(kBlack);
    gr1->SetLineColor(kBlue);
    gr2->SetLineColor(kRed);
    gr->SetLineWidth(3);
    gr2->SetLineWidth(3);
    gr1->SetLineWidth(3);

    gr->SetMarkerSize(.7);
    gr1->SetMarkerSize(.7);
    gr2->SetMarkerSize(.7);


    gr->SetMarkerStyle(8);
    gr1->SetMarkerStyle(8);
    gr2->SetMarkerStyle(8);
    TMultiGraph *mg = new TMultiGraph();

    leg = new TLegend(0.7,0.7,1,1);
    leg->SetLineWidth(0);
    leg->SetHeader("");
    leg->AddEntry(gr, "Trace","l");
    leg->AddEntry(gr1,"Fast Filter","l");
    leg->AddEntry(gr2,"CFD Filter","l");

    leg->SetTextSize(.05);
    leg->SetFillColor(kWhite);
    mg->Add(gr);
    mg->Add(gr1);
    mg->Add(gr2);

    mg->SetTitle("Pixie Digital Waveform");
    mg->Draw("a L P");
    mg->GetHistogram()->GetXaxis()->SetTitle("Time [ns]");
    mg->GetHistogram()->GetYaxis()->SetTitle("ADC Channel");
    mg->GetHistogram()->GetYaxis()->SetTitleOffset(1.3);

    leg->Draw();      
    
}
Example #16
0
int main(int argc, char** argv)
{

  std::string plot_type = argv[1];
    //"EffAll";
  //    std::string plot_type = "AngScanHigh";
  //  std::string plot_type = "scanX0_HVLow_50";
  //  std::string plot_type = "scanX0_HVLow_20";
  std::cout<<plot_type<<std::endl;

  TFile* inF_MiB3_ON;
  TFile* inF_MiB3_OFF;
  TFile* inF_enSEE;
  TFile* inF_ZStack1_ON;
  TFile* inF_ZStack1_OFF;
  TFile* inF_ZStack2_ON;
  TFile* inF_ZStack2_OFF;

  TFile* inF_MiB3;
  TFile* inF_ZStack1;
  TFile* inF_ZStack2;

  TMultiGraph *mg = new TMultiGraph();

  TLegend *legC;

  if(plot_type == "EffAll"){
    legC = new TLegend(0.15,0.65,0.35,0.85,NULL,"brNDC");

    inF_MiB3_ON = TFile::Open("plots/efficiency_studies/MiB3_HV_HVScan2.root");
    inF_MiB3_OFF = TFile::Open("plots/efficiency_studies/MiB3_HV_HVScan7.root");
    inF_enSEE = TFile::Open("plots/efficiency_studies/enSEE_HV_HVScan5.root");
    inF_ZStack1_ON = TFile::Open("plots/efficiency_studies/ZStack1_HV_HVScan1.root");
    inF_ZStack1_OFF = TFile::Open("plots/efficiency_studies/ZStack1_HV_HVScan8.root");
    inF_ZStack2_ON = TFile::Open("plots/efficiency_studies/ZStack2_HV_HVScan2.root");
    inF_ZStack2_OFF = TFile::Open("plots/efficiency_studies/ZStack2_HV_HVScan6.root");

    TGraphErrors* eff_MiB3_ON = (TGraphErrors*)inF_MiB3_ON->Get("frac_saturated");
    TGraphErrors* eff_MiB3_OFF = (TGraphErrors*)inF_MiB3_OFF->Get("frac_saturated");
    TGraphErrors* eff_enSEE = (TGraphErrors*)inF_enSEE->Get("frac_saturated");
    TGraphErrors* eff_ZStack1_ON = (TGraphErrors*)inF_ZStack1_ON->Get("frac_saturated");
    TGraphErrors* eff_ZStack1_OFF = (TGraphErrors*)inF_ZStack1_OFF->Get("frac_saturated");
    TGraphErrors* eff_ZStack2_ON = (TGraphErrors*)inF_ZStack2_ON->Get("frac_saturated");
    TGraphErrors* eff_ZStack2_OFF = (TGraphErrors*)inF_ZStack2_OFF->Get("frac_saturated");

    //settings
    eff_MiB3_ON->SetMarkerColor(kGreen+1);
    eff_MiB3_ON->SetLineColor(kGreen+1);
    eff_MiB3_OFF->SetMarkerColor(kGreen+1);
    eff_MiB3_OFF->SetLineColor(kGreen+1);
    eff_ZStack2_ON->SetMarkerColor(kBlue);
    eff_ZStack2_ON->SetLineColor(kBlue);
    eff_ZStack1_ON->SetMarkerColor(kRed);
    eff_ZStack1_ON->SetLineColor(kRed);
    eff_ZStack2_OFF->SetMarkerColor(kBlue);
    eff_ZStack2_OFF->SetLineColor(kBlue);
    eff_ZStack1_OFF->SetMarkerColor(kRed);
    eff_ZStack1_OFF->SetLineColor(kRed);
    eff_enSEE->SetMarkerColor(1);
    eff_enSEE->SetLineColor(1);
  //
    eff_MiB3_ON->SetMarkerStyle(20);
    eff_MiB3_ON->SetLineWidth(2);
    eff_MiB3_ON->SetMarkerSize(0.7);
    eff_MiB3_OFF->SetMarkerStyle(22);
    eff_MiB3_OFF->SetLineWidth(2);
    eff_ZStack2_ON->SetMarkerStyle(20);
    eff_ZStack2_ON->SetLineWidth(2);
    eff_ZStack2_ON->SetMarkerSize(0.7);
    eff_ZStack1_ON->SetMarkerStyle(20);
    eff_ZStack1_ON->SetLineWidth(2);
    eff_ZStack1_ON->SetMarkerSize(0.7);
    eff_ZStack2_OFF->SetMarkerStyle(22);
    eff_ZStack2_OFF->SetLineWidth(2);
    eff_ZStack1_OFF->SetMarkerStyle(22);
    eff_ZStack1_OFF->SetLineWidth(2);
    eff_enSEE->SetMarkerStyle(22);
    eff_enSEE->SetLineWidth(2);


    legC->SetTextFont(42);
    legC->SetTextSize(0.03);
    legC->SetFillColor(kWhite);
    legC->SetLineColor(kWhite);
    legC->SetShadowColor(kWhite);

    legC->AddEntry(eff_MiB3_ON, "MiB3 chevron-ON", "p");
    legC->AddEntry(eff_MiB3_OFF, "MiB3 chevron-OFF", "p");
    legC->AddEntry(eff_ZStack2_ON, "ZStack2 ON", "p");
    legC->AddEntry(eff_ZStack2_OFF, "ZStack2 OFF", "p");
    legC->AddEntry(eff_ZStack1_ON, "ZStack1 ON", "p");
    legC->AddEntry(eff_ZStack1_OFF, "ZStack1 OFF", "p");
    legC->AddEntry(eff_enSEE, "SEE OFF", "p");
  
    mg->Add(eff_MiB3_ON);
    mg->Add(eff_MiB3_OFF);
    mg->Add(eff_ZStack1_ON);
    mg->Add(eff_ZStack1_OFF);
    mg->Add(eff_ZStack2_OFF);
    mg->Add(eff_ZStack2_ON);
    mg->Add(eff_ZStack2_OFF);
    mg->Add(eff_enSEE);

    TCanvas* c = new TCanvas();
    gPad->SetTicks();
    char plot_name[100];
    std::string command = "if [ ! -e final_plots/ ] ; then mkdir final_plots ; fi";
    system(command.c_str());
    sprintf(plot_name, "final_plots/saturatedFrac_%s.pdf", plot_type.c_str());

    mg->Draw("AP");
    mg->GetXaxis()->SetRangeUser(-0.1,5.1);
    mg->GetXaxis()->SetTitle("HV (V)");
    mg->GetYaxis()->SetTitle("SaturatedFrac");
    mg->SetMaximum(100);
    mg->SetMinimum(0);
    mg->Draw("AP");  
    legC->Draw("same");

    c->Print(plot_name, "pdf");
    sprintf(plot_name, "final_plots/saturatedFrac_%s.png", plot_type.c_str());
    c->Print(plot_name, "png");

  }

  else {

    legC = new TLegend(0.15,0.70,0.3,0.85,NULL,"brNDC");

    TGraphErrors* eff_MiB3;
    TGraphErrors* eff_enSEE;
    TGraphErrors* eff_ZStack1;
    TGraphErrors* eff_ZStack2;

    if(plot_type == "AngScanHigh"){
      inF_MiB3 = TFile::Open("plots/efficiency_studies/MiB3_X0_AngScan_HVHigh.root");
      inF_enSEE = TFile::Open("plots/efficiency_studies/enSEE_X0_AngScan_HVHigh.root");
      inF_ZStack1 = TFile::Open("plots/efficiency_studies/ZStack1_X0_AngScan_HVHigh.root");
    }
    if(plot_type == "AngScanLow"){
      inF_MiB3 = TFile::Open("plots/efficiency_studies/MiB3_X0_AngScan_HVLow.root");
      inF_enSEE = TFile::Open("plots/efficiency_studies/enSEE_X0_AngScan_HVLow.root");
      inF_ZStack1 = TFile::Open("plots/efficiency_studies/ZStack1_X0_AngScan_HVLow.root");
    }
    
    if(plot_type == "scanX0_HVHigh_50"){
      inF_MiB3 = TFile::Open("plots/efficiency_studies/MiB3_X0_scanX0_HVHigh50GeV.root");
      inF_enSEE = TFile::Open("plots/efficiency_studies/enSEE_X0_scanX0_HVHigh50GeV.root");
      inF_ZStack2 = TFile::Open("plots/efficiency_studies/ZStack2_X0_scanX0_HVHigh50GeV.root");
      inF_ZStack1 = TFile::Open("plots/efficiency_studies/ZStack1_X0_scanX0_HVHigh50GeV.root");
    }
    if(plot_type == "scanX0_HVHigh_20"){
      inF_MiB3 = TFile::Open("plots/efficiency_studies/MiB3_X0_scanX0_HVHigh20GeV.root");
      inF_enSEE = TFile::Open("plots/efficiency_studies/enSEE_X0_scanX0_HVHigh20GeV.root");
      inF_ZStack2 = TFile::Open("plots/efficiency_studies/ZStack2_X0_scanX0_HVHigh20GeV.root");
      inF_ZStack1 = TFile::Open("plots/efficiency_studies/ZStack1_X0_scanX0_HVHigh20GeV.root");
    }
    if(plot_type == "scanX0_HVLow_50"){
      inF_MiB3 = TFile::Open("plots/efficiency_studies/MiB3_X0_scanX0_HVLow50GeV.root");
      inF_enSEE = TFile::Open("plots/efficiency_studies/enSEE_X0_scanX0_HVLow50GeV.root");
      inF_ZStack2 = TFile::Open("plots/efficiency_studies/ZStack2_X0_scanX0_HVLow50GeV.root");
      inF_ZStack1 = TFile::Open("plots/efficiency_studies/ZStack1_X0_scanX0_HVLow50GeV.root");
    }
    if(plot_type == "scanX0_HVLow_20"){
      inF_MiB3 = TFile::Open("plots/efficiency_studies/MiB3_X0_scanX0_HVLow20GeV.root");
      inF_enSEE = TFile::Open("plots/efficiency_studies/enSEE_X0_scanX0_HVLow20GeV.root");
      inF_ZStack2 = TFile::Open("plots/efficiency_studies/ZStack2_X0_scanX0_HVLow20GeV.root");
      inF_ZStack1 = TFile::Open("plots/efficiency_studies/ZStack1_X0_scanX0_HVLow20GeV.root");
    }
    
    
    eff_MiB3 = (TGraphErrors*)inF_MiB3->Get("frac_saturated");
    eff_enSEE = (TGraphErrors*)inF_enSEE->Get("frac_saturated");
    eff_ZStack1 = (TGraphErrors*)inF_ZStack1->Get("frac_saturated");
    if (plot_type=="scanX0_HVLow_20" || plot_type=="scanX0_HVHigh_20" || plot_type=="scanX0_HVHigh_50" || plot_type=="scanX0_HVLow_50") 
      eff_ZStack2 = (TGraphErrors*)inF_ZStack2->Get("frac_saturated");
    
    //settings
    eff_MiB3->SetMarkerColor(kGreen+1);
    eff_MiB3->SetLineColor(kGreen+1);
    if (plot_type=="scanX0_HVLow_20" || plot_type=="scanX0_HVHigh_20" || plot_type=="scanX0_HVHigh_50" || plot_type=="scanX0_HVLow_50") {
      eff_ZStack2->SetMarkerColor(kBlue);
      eff_ZStack2->SetLineColor(kBlue);
    }
    eff_ZStack1->SetMarkerColor(kRed);
    eff_ZStack1->SetLineColor(kRed);
    eff_enSEE->SetMarkerColor(1);
    eff_enSEE->SetLineColor(1);
    //
    eff_MiB3->SetMarkerStyle(20);
    eff_MiB3->SetLineWidth(2);
    eff_MiB3->SetMarkerSize(0.7);
    if (plot_type=="scanX0_HVLow_20" || plot_type=="scanX0_HVHigh_20" || plot_type=="scanX0_HVHigh_50" || plot_type=="scanX0_HVLow_50") {
      eff_ZStack2->SetMarkerStyle(20);
      eff_ZStack2->SetLineWidth(2);
      eff_ZStack2->SetMarkerSize(0.7);
    }
    eff_ZStack1->SetMarkerStyle(20);
    eff_ZStack1->SetLineWidth(2);
    eff_ZStack1->SetMarkerSize(0.7);
    eff_enSEE->SetMarkerStyle(20);
    eff_enSEE->SetLineWidth(2);
    eff_enSEE->SetMarkerSize(0.7);
    
    legC->SetTextFont(42);
    legC->SetTextSize(0.03);
    legC->SetFillColor(kWhite);
    legC->SetLineColor(kWhite);
    legC->SetShadowColor(kWhite);
        
    if(plot_type == "AngScanLow"){
      legC->AddEntry(eff_MiB3, "MiB3 chevron-OFF HV 3000", "p");
      legC->AddEntry(eff_ZStack1, "ZStack1 OFF HV 3000", "p");
      legC->AddEntry(eff_enSEE, "SEE OFF HV 1900", "p");
    }
    if(plot_type == "AngScanHigh"){
      legC->AddEntry(eff_MiB3, "MiB3 chevron-OFF HV 3200", "p");
      legC->AddEntry(eff_ZStack1, "ZStack1 OFF HV 3200", "p");
      legC->AddEntry(eff_enSEE, "SEE OFF HV 2200", "p");
    }

    if(plot_type == "scanX0_HVHigh_50" || plot_type == "scanX0_HVHigh_20"){
      legC->AddEntry(eff_MiB3, "MiB3 chevron-OFF HV 3200", "p");
      legC->AddEntry(eff_ZStack1, "ZStack1 OFF HV 3200", "p");
      legC->AddEntry(eff_ZStack2, "ZStack2 OFF HV 3200", "p");
      legC->AddEntry(eff_enSEE, "SEE OFF  HV 2200", "p");
    }

    if(plot_type == "scanX0_HVLow_50" || plot_type == "scanX0_HVLow_20"){
      legC->AddEntry(eff_MiB3, "MiB3 chevron-OFF HV 3000", "p");
      legC->AddEntry(eff_ZStack1, "ZStack1 OFF HV 3000", "p");
      legC->AddEntry(eff_ZStack2, "ZStack2 OFF HV 3000", "p");
      legC->AddEntry(eff_enSEE, "SEE OFF  HV 1900", "p");
    }

    mg->Add(eff_MiB3);
    mg->Add(eff_ZStack1);
    mg->Add(eff_enSEE);
    if (plot_type=="scanX0_HVLow_20" || plot_type=="scanX0_HVHigh_20" || plot_type=="scanX0_HVHigh_50" || plot_type=="scanX0_HVLow_50") 
      mg->Add(eff_ZStack2);

    TCanvas* c = new TCanvas();
    gPad->SetTicks();
    char plot_name[100];
    std::string command = "if [ ! -e final_plots/ ] ; then mkdir final_plots ; fi";
    system(command.c_str());
    sprintf(plot_name, "final_plots/saturatedFrac_%s.pdf", plot_type.c_str());

    mg->Draw("AP");
    if (plot_type=="scanX0_HVLow_20" || plot_type=="scanX0_HVHigh_20" || plot_type=="scanX0_HVHigh_50" || plot_type=="scanX0_HVLow_50") 
      {
	mg->GetXaxis()->SetRangeUser(-0.1,5.1);
	mg->GetXaxis()->SetTitle("X0");
	mg->GetYaxis()->SetTitle("SaturatedFrac");
	mg->SetTitle(plot_type.c_str());
      }
    else
      {
	mg->GetXaxis()->SetRangeUser(-0.1, 50);
	mg->GetXaxis()->SetTitle("Angle (degrees)");
	mg->GetYaxis()->SetTitle("SaturatedFrac");
	mg->SetTitle(plot_type.c_str());
      }

    mg->SetMaximum(100);
    mg->SetMinimum(0);
    mg->Draw("AP");  
    legC->Draw("same");

    c->Print(plot_name, "pdf");
    sprintf(plot_name, "final_plots/saturatedFrac_%s.png", plot_type.c_str());
    c->Print(plot_name, "png");
  }


  return 0;
}
Example #17
0
int CompareP()
{
  char wkdir[1000]={"/Volumes/IR1_CPRA_X6/output"};
  TFile *outfile = new TFile("/Volumes/IR1_CPRA_X6/output/pcom.root","recreate");
  char file[21][100];
  double ene[21];
  sprintf(file[0], "001_2.0000"); ene[0] = 2.0000;
  sprintf(file[1], "002_2.0500"); ene[1] = 2.0500;
  sprintf(file[2], "003_2.1000"); ene[2] = 2.1000;
  sprintf(file[3], "004_2.1500"); ene[3] = 2.1500;
  sprintf(file[4], "005_2.1750"); ene[4] = 2.1750;
  sprintf(file[5], "006_2.2000"); ene[5] = 2.2000;
  sprintf(file[6], "007_2.2324"); ene[6] = 2.2324;
  sprintf(file[7], "008_2.3094"); ene[7] = 2.3094;
  sprintf(file[8], "009_2.3864"); ene[8] = 2.3864;
  sprintf(file[9], "010_2.3960"); ene[9] = 2.3960;
  sprintf(file[10],"011_2.5000"); ene[10]= 2.5000;
  sprintf(file[11],"012_2.6444"); ene[11]= 2.6444;
  sprintf(file[12],"013_2.6464"); ene[12]= 2.6464;
  sprintf(file[13],"014_2.7000"); ene[13]= 2.7000;
  sprintf(file[14],"015_2.8000"); ene[14]= 2.8000;
  sprintf(file[15],"016_2.9000"); ene[15]= 2.9000;
  sprintf(file[16],"017_2.9500"); ene[16]= 2.9500;
  sprintf(file[17],"018_2.9810"); ene[17]= 2.9810;
  sprintf(file[18],"019_3.0000"); ene[18]= 3.0000;
  sprintf(file[19],"020_3.0200"); ene[19]= 3.0200;
  sprintf(file[20],"021_3.0800"); ene[20]= 3.0800;
  double mka = 0.493677;
  double mmu = 0.1057;

  double enee[21]={0};
  double pka[21],pkae[21],pka3e[21],pka5e[21];
  double pmu[21],pmue[21],pmu3e[21],pmu5e[21];

  gStyle->SetOptStat(0);
  for (int enei=0; enei<21; enei++){
    char filename[100];
    sprintf(filename,"%s/mcBB_%s.root",wkdir,file[enei]);
    TFile *filei1 = new TFile(filename);
    TH1D *hpee   = (TH1D*)filei1->Get("hpNocut");
    TH2D *h2pee  = (TH2D*)filei1->Get("h2pNocut");
    TH1D *hpeec  = (TH1D*)filei1->Get("hpcutTOF");
    TH2D *h2peec = (TH2D*)filei1->Get("h2pcutTOF");

    sprintf(filename,"%s/mcdimu_%s.root",wkdir,file[enei]);
    TFile *filei2 = new TFile(filename);
    TH1D *hpmu   = (TH1D*)filei2->Get("hpNocut");
    TH2D *h2pmu  = (TH2D*)filei2->Get("h2pNocut");
    TH1D *hpmuc  = (TH1D*)filei2->Get("hpcutTOF");
    TH2D *h2pmuc = (TH2D*)filei2->Get("h2pcutTOF");

    sprintf(filename,"%s/mchad_%s.root",wkdir,file[enei]);
    TFile *filei3 = new TFile(filename);
    TH1D *hpha   = (TH1D*)filei3->Get("hpNocut");
    TH2D *h2pha  = (TH2D*)filei3->Get("h2pNocut");
    TH1D *hphac  = (TH1D*)filei3->Get("hpcutTOF");
    TH2D *h2phac = (TH2D*)filei3->Get("h2pcutTOF");

    sprintf(filename,"%s/KKsel_%03d_myxs.root",wkdir,enei+1);
    TFile *filei4 = new TFile(filename);
    TH1D *hpka   = (TH1D*)filei4->Get("hpNocut");
    TH2D *h2pka  = (TH2D*)filei4->Get("h2pNocut");
    TH1D *hpkac  = (TH1D*)filei4->Get("hpcutTOF");
    TH2D *h2pkac = (TH2D*)filei4->Get("h2pcutTOF");

    TCanvas *c1 = new TCanvas();
    TLegend *legend = new TLegend(0.15, 0.6,0.4,0.85);
    if (hpka!=0) {hpka->SetFillColor(0);hpka->SetLineColor(1);hpka->SetMarkerColor(1);hpka->Draw(); legend->AddEntry(hpka,"p_{K}");} else continue;
    if (hpee!=0) {hpee->SetFillColor(0);hpee->SetLineColor(2);hpee->SetMarkerColor(2);hpee->Draw("same");legend->AddEntry(hpee,"p_{e}");}
    if (hpmu!=0) {hpmu->SetFillColor(0);hpmu->SetLineColor(3);hpmu->SetMarkerColor(3);hpmu->Draw("same");legend->AddEntry(hpmu,"p_{#mu}");}
    if (hpha!=0) {hpha->SetFillColor(0);hpha->SetLineColor(4);hpha->SetMarkerColor(4);hpha->Draw("same");legend->AddEntry(hpha,"p_{had}");}
    legend->Draw();
    
    TCanvas *c3 = new TCanvas();
    TLegend *lgd3 = new TLegend(0.15, 0.6,0.4,0.85);
    if (hpkac!=0) {hpkac->SetFillColor(0);hpkac->SetLineColor(1);hpkac->SetMarkerColor(1);hpkac->Draw(); lgd3->AddEntry(hpkac,"p_{K}");} else continue;
    if (hpeec!=0) {hpeec->SetFillColor(0);hpeec->SetLineColor(2);hpeec->SetMarkerColor(2);hpeec->Draw("same");lgd3->AddEntry(hpeec,"p_{e}");}
    if (hpmuc!=0) {hpmuc->SetFillColor(0);hpmuc->SetLineColor(3);hpmuc->SetMarkerColor(3);hpmuc->Draw("same");lgd3->AddEntry(hpmuc,"p_{#mu}");}
    if (hphac!=0) {hphac->SetFillColor(0);hphac->SetLineColor(4);hphac->SetMarkerColor(4);hphac->Draw("same");lgd3->AddEntry(hphac,"p_{had}");}
    lgd3->Draw();
    
    TCanvas *c2 = new TCanvas();
    TLegend *lgd2 = new TLegend(0.15, 0.6,0.4,0.85);
    if(h2pka!=0){h2pka->SetFillColor(0);h2pka->SetLineColor(1);h2pka->SetMarkerColor(1);h2pka->Draw();lgd2->AddEntry(h2pka,"p_{K}");} else continue;
    if(h2pee!=0){h2pee->SetFillColor(0);h2pee->SetLineColor(2);h2pee->SetMarkerColor(2);h2pee->Draw("same");lgd2->AddEntry(h2pee,"p_{e}");}
    if(h2pmu!=0){h2pmu->SetFillColor(0);h2pmu->SetLineColor(3);h2pmu->SetMarkerColor(3);h2pmu->Draw("same");lgd2->AddEntry(h2pmu,"p_{#mu}");}
    if(h2pha!=0){h2pha->SetFillColor(0);h2pha->SetLineColor(4);h2pha->SetMarkerColor(4);h2pha->Draw("same");lgd2->AddEntry(h2pha,"p_{had}");}
    lgd2->Draw();
    
    TCanvas *c4 = new TCanvas();
    TLegend *lgd4 = new TLegend(0.15, 0.6,0.4,0.85);
    if (h2pkac!=0) {h2pkac->SetFillColor(0);h2pkac->SetLineColor(1);h2pkac->SetMarkerColor(1);h2pkac->Draw(); lgd4->AddEntry(h2pkac,"p_{K}");} else continue;
    if (h2peec!=0) {h2peec->SetFillColor(0);h2peec->SetLineColor(2);h2peec->SetMarkerColor(2);h2peec->Draw("same");lgd4->AddEntry(h2peec,"p_{e}");}
    if (h2pmuc!=0) {h2pmuc->SetFillColor(0);h2pmuc->SetLineColor(3);h2pmuc->SetMarkerColor(3);h2pmuc->Draw("same");lgd4->AddEntry(h2pmuc,"p_{#mu}");}
    if (h2phac!=0) {h2phac->SetFillColor(0);h2phac->SetLineColor(4);h2phac->SetMarkerColor(4);h2phac->Draw("same");lgd4->AddEntry(h2phac,"p_{had}");}
    lgd4->Draw();
    
    sprintf(filename,"%s_1p",file[enei]);
    outfile->WriteTObject(c1,filename);
    sprintf(filename,"%s_2p",file[enei]);
    outfile->WriteTObject(c2,filename);
    sprintf(filename,"%s_1p_cut",file[enei]);
    outfile->WriteTObject(c3,filename);
    sprintf(filename,"%s_2p_cut",file[enei]);
    outfile->WriteTObject(c4,filename);

    double p_ka = sqrt(pow(ene[enei]/2,2)-mka*mka);
    double p_mu = sqrt(pow(ene[enei]/2,2)-mmu*mmu);
    //std::cout<<p_ka<<' '<<p_mu<<std::endl;
    hpka->Fit("gaus","R","",p_ka-0.1,p_ka+0.1);
    hpmu->Fit("gaus","R","",p_mu-0.1,p_mu+0.1);
    pka[enei] = hpka->GetFunction("gaus")->GetParameter(1);
    pkae[enei]= hpka->GetFunction("gaus")->GetParameter(2);
    pka3e[enei]= 3*pkae[enei]/2.6*3;
    pka5e[enei]= 5*pkae[enei]/2.6*3;
    pmu[enei] = hpmu->GetFunction("gaus")->GetParameter(1);
    pmue[enei]= hpmu->GetFunction("gaus")->GetParameter(2);
    pmu3e[enei]= 3*pmue[enei]/2.6*3;
    pmu5e[enei]= 5*pmue[enei]/2.6*3;
    std::cout<<p_ka<<' ' << pka[enei]<<" "<< pkae[enei]<<std::endl;
    std::cout<<p_mu<<' ' << pmu[enei]<<" "<< pmue[enei]<<std::endl;
    
    delete filei1;
    delete filei2;
    delete filei3;
    delete filei4;
    delete c1;
    delete c2;
    delete c3;
    delete c4;
    delete legend;
    delete lgd2;
    delete lgd3;
    delete lgd4;
  }

  new TCanvas();
  TGraphErrors *graph1 = new TGraphErrors(21,ene,pka,enee,pkae);
  graph1->SetFillColor(0);
  graph1->SetMarkerStyle(24);
  TGraphErrors *graph1_1 = new TGraphErrors(21,ene,pka,enee,pkae);
  graph1_1->SetFillColor(3);
  TGraphErrors *graph1_3 = new TGraphErrors(21,ene,pka,enee,pka3e);
  graph1_3->SetFillColor(4);
  TGraphErrors *graph1_5 = new TGraphErrors(21,ene,pka,enee,pka5e);
  graph1_5->SetFillColor(2);
  //graph1->Draw("A3LP");

  TGraphErrors *graph2 = new TGraphErrors(21,ene,pmu,enee,pmue);
  graph2->SetFillColor(0);
  graph2->SetMarkerStyle(25);
  TGraphErrors *graph2_1 = new TGraphErrors(21,ene,pmu,enee,pmue);
  graph2_1->SetFillColor(3);
  TGraphErrors *graph2_3 = new TGraphErrors(21,ene,pmu,enee,pmu3e);
  graph2_3->SetFillColor(4);
  TGraphErrors *graph2_5 = new TGraphErrors(21,ene,pmu,enee,pmu5e);
  graph2_5->SetFillColor(2);
  //graph2->Draw("L3P");
  
  TMultiGraph *mg = new TMultiGraph();
  mg->SetTitle("p of 2 prong process");
  mg->Add(graph1_5);
  mg->Add(graph2_5);
  mg->Add(graph1_3);
  mg->Add(graph2_3);
  mg->Add(graph1_1);
  mg->Add(graph2_1);
  mg->Draw("ALP3");
  mg->GetXaxis()->SetTitle("#sqrt{s} (GeV)");
  mg->GetYaxis()->SetTitle("p (GeV/c)");
  graph1->Draw("PL");
  graph2->Draw("PL");

  TLegend *legend = new TLegend(0.15,0.65,0.45,0.85);
  legend->AddEntry(graph1,"p_{K}");
  legend->AddEntry(graph2,"p_{#mu}");
  legend->AddEntry(graph1_1,"1 #sigma");
  legend->AddEntry(graph1_3,"3 #sigma");
  legend->AddEntry(graph1_5,"5 #sigma");
  legend->SetMargin(0.6);
  legend->Draw();

}
void BSA_InCoherent_t()
{
//=========Macro generated from canvas: c17/Incoherent channe
//=========  (Tue Aug 21 12:00:26 2018) by ROOT version6.09/01
   TCanvas *c17 = new TCanvas("c17", "Incoherent channe",0,0,1200,400);
   gStyle->SetOptFit(1);
   c17->Range(0,0,1,1);
   c17->SetFillColor(0);
   c17->SetBorderMode(0);
   c17->SetBorderSize(2);
   c17->SetLeftMargin(0.025);
   c17->SetRightMargin(0.02325581);
   c17->SetFrameBorderMode(0);
  
// ------------>Primitives in pad: c17_1
   TPad *c17_1 = new TPad("c17_1", "Incoherent channe_1",0,0,0.262936,0.9);
   c17_1->Draw();
   c17_1->cd();
   c17_1->Range(-32.86883,-0.4888889,353.6809,0.4);
   c17_1->SetFillColor(0);
   c17_1->SetBorderMode(0);
   c17_1->SetBorderSize(2);
   c17_1->SetGridx();
   c17_1->SetGridy();
   c17_1->SetRightMargin(0);
   c17_1->SetTopMargin(0);
   c17_1->SetFrameBorderMode(0);
   c17_1->SetFrameBorderMode(0);
   
   TMultiGraph *multigraph = new TMultiGraph();
   multigraph->SetName("");
   multigraph->SetTitle("0.05<-t<0.21 [GeV^{2}/c^{2}]");
   
   Double_t Graph_fx1154[9] = {
   21.59954,
   59.03178,
   96.06391,
   141.7703,
   179.2242,
   222.8541,
   259.5793,
   303.38,
   337.8675};
   Double_t Graph_fy1154[9] = {
   0.1020231,
   0.03114899,
   0.2309077,
   0.1341245,
   0.01684177,
   -0.1267998,
   -0.2824572,
   -0.2260703,
   -0.0186068};
   Double_t Graph_fex1154[9] = {
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0};
   Double_t Graph_fey1154[9] = {
   0.04242532,
   0.05165487,
   0.05483741,
   0.07646672,
   0.1006626,
   0.09089962,
   0.05905575,
   0.04462244,
   0.05521722};
   TGraphErrors *gre = new TGraphErrors(9,Graph_fx1154,Graph_fy1154,Graph_fex1154,Graph_fey1154);
   gre->SetName("Graph");
   gre->SetTitle("Graph");
   gre->SetFillColor(1);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#00ff00");
   gre->SetMarkerColor(ci);
   gre->SetMarkerStyle(21);
   
   TH1F *Graph_Graph1154 = new TH1F("Graph_Graph1154","Graph",100,0,369.4943);
   Graph_Graph1154->SetMinimum(-0.4042387);
   Graph_Graph1154->SetMaximum(0.3484709);
   Graph_Graph1154->SetDirectory(0);
   Graph_Graph1154->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1154->SetLineColor(ci);
   Graph_Graph1154->GetXaxis()->SetLabelFont(42);
   Graph_Graph1154->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1154->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1154->GetXaxis()->SetTitleFont(42);
   Graph_Graph1154->GetYaxis()->SetLabelFont(42);
   Graph_Graph1154->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1154->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1154->GetYaxis()->SetTitleFont(42);
   Graph_Graph1154->GetZaxis()->SetLabelFont(42);
   Graph_Graph1154->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1154->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1154->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1154);
   
   
   TF1 *myfit1155 = new TF1("myfit","[0]*sin(x*3.1416/180.0)/(1 + [1]*cos(x*3.1416/180.0))",0,369.4943);
   myfit1155->SetFillColor(19);
   myfit1155->SetFillStyle(0);
   myfit1155->SetLineColor(2);
   myfit1155->SetLineWidth(2);
   myfit1155->SetChisquare(12.03234);
   myfit1155->SetNDF(7);
   myfit1155->GetXaxis()->SetLabelFont(42);
   myfit1155->GetXaxis()->SetLabelSize(0.035);
   myfit1155->GetXaxis()->SetTitleSize(0.035);
   myfit1155->GetXaxis()->SetTitleFont(42);
   myfit1155->GetYaxis()->SetLabelFont(42);
   myfit1155->GetYaxis()->SetLabelSize(0.035);
   myfit1155->GetYaxis()->SetTitleSize(0.035);
   myfit1155->GetYaxis()->SetTitleFont(42);
   myfit1155->SetParameter(0,0.2160608);
   myfit1155->SetParError(0,0.02670852);
   myfit1155->SetParLimits(0,0,0);
   myfit1155->SetParameter(1,0.2378828);
   myfit1155->SetParError(1,0.2292802);
   myfit1155->SetParLimits(1,0,0);
   gre->GetListOfFunctions()->Add(myfit1155);
   
   TPaveStats *ptstats = new TPaveStats(0.27,0.74,0.9,0.9,"brNDC");
   ptstats->SetName("stats");
   ptstats->SetBorderSize(1);
   ptstats->SetFillColor(0);
   ptstats->SetTextAlign(12);
   ptstats->SetTextFont(42);
   TText *AText = ptstats->AddText("#chi^{2} / ndf = 12.03 / 7");
   AText = ptstats->AddText("p0       = 0.2161 #pm 0.02671 ");
   AText = ptstats->AddText("p1       = 0.2379 #pm 0.2293 ");
   ptstats->SetOptStat(0);
   ptstats->SetOptFit(111);
   ptstats->Draw();
   gre->GetListOfFunctions()->Add(ptstats);
   ptstats->SetParent(gre->GetListOfFunctions());
   multigraph->Add(gre,"");
   multigraph->Draw("AP");
   multigraph->GetXaxis()->SetTitle("#phi [deg.]");
   multigraph->GetXaxis()->SetLabelFont(42);
   multigraph->GetXaxis()->SetLabelSize(0.035);
   multigraph->GetXaxis()->SetTitleSize(0.035);
   multigraph->GetXaxis()->SetTitleFont(42);
   multigraph->GetYaxis()->SetTitle("A_{LU}");
   multigraph->GetYaxis()->SetLabelFont(42);
   multigraph->GetYaxis()->SetLabelSize(0.035);
   multigraph->GetYaxis()->SetTitleSize(0.035);
   multigraph->GetYaxis()->SetTitleFont(42);
     gPad->Modified();  
   multigraph->GetYaxis()->SetRangeUser(-0.35, 0.35);  




   TPaveText *pt = new TPaveText(0.2292451,0.9268996,0.7707549,0.995,"blNDC");
   pt->SetName("title");
   pt->SetBorderSize(0);
   pt->SetFillColor(0);
   pt->SetFillStyle(0);
   pt->SetTextFont(42);
   AText = pt->AddText("0.05<-t<0.21 [GeV^{2}/c^{2}]");
   pt->Draw();
   c17_1->Modified();
   c17->cd();
  
// ------------>Primitives in pad: c17_2
   TPad *c17_2 = new TPad("c17_2", "Incoherent channe_2",0.262936,0,0.5008721,0.9);
   c17_2->Draw();
   c17_2->cd();
   c17_2->Range(5.895345,-0.4888889,352.6198,0.4);
   c17_2->SetFillColor(0);
   c17_2->SetBorderMode(0);
   c17_2->SetBorderSize(2);
   c17_2->SetGridx();
   c17_2->SetGridy();
   c17_2->SetLeftMargin(0);
   c17_2->SetRightMargin(0);
   c17_2->SetTopMargin(0);
   c17_2->SetFrameBorderMode(0);
   c17_2->SetFrameBorderMode(0);
   
   multigraph = new TMultiGraph();
   multigraph->SetName("");
   multigraph->SetTitle("0.21<-t<0.36 [GeV^{2}/c^{2}]");
   
   Double_t Graph_fx1157[9] = {
   21.65555,
   61.41754,
   96.1904,
   139.625,
   182.9173,
   222.6445,
   259.1526,
   302.149,
   336.8596};
   Double_t Graph_fy1157[9] = {
   0.04372413,
   0.1019325,
   0.1737435,
   0.1708402,
   0.2316287,
   -0.1435087,
   -0.1227365,
   -0.1969296,
   -0.07714485};
   Double_t Graph_fex1157[9] = {
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0};
   Double_t Graph_fey1157[9] = {
   0.0517677,
   0.05885852,
   0.0646232,
   0.09789667,
   0.1185262,
   0.09557657,
   0.06953456,
   0.04921871,
   0.06282415};
   gre = new TGraphErrors(9,Graph_fx1157,Graph_fy1157,Graph_fex1157,Graph_fey1157);
   gre->SetName("Graph");
   gre->SetTitle("Graph");
   gre->SetFillColor(1);

   ci = TColor::GetColor("#00ff00");
   gre->SetMarkerColor(ci);
   gre->SetMarkerStyle(21);
   
   TH1F *Graph_Graph1157 = new TH1F("Graph_Graph1157","Graph",100,0,368.38);
   Graph_Graph1157->SetMinimum(-0.3057786);
   Graph_Graph1157->SetMaximum(0.4097851);
   Graph_Graph1157->SetDirectory(0);
   Graph_Graph1157->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1157->SetLineColor(ci);
   Graph_Graph1157->GetXaxis()->SetLabelFont(42);
   Graph_Graph1157->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1157->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1157->GetXaxis()->SetTitleFont(42);
   Graph_Graph1157->GetYaxis()->SetLabelFont(42);
   Graph_Graph1157->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1157->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1157->GetYaxis()->SetTitleFont(42);
   Graph_Graph1157->GetZaxis()->SetLabelFont(42);
   Graph_Graph1157->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1157->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1157->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1157);
   
   
   TF1 *myfit1158 = new TF1("myfit","[0]*sin(x*3.1416/180.0)/(1 + [1]*cos(x*3.1416/180.0))",0,368.38);
   myfit1158->SetFillColor(19);
   myfit1158->SetFillStyle(0);
   myfit1158->SetLineColor(2);
   myfit1158->SetLineWidth(2);
   myfit1158->SetChisquare(6.955655);
   myfit1158->SetNDF(7);
   myfit1158->GetXaxis()->SetLabelFont(42);
   myfit1158->GetXaxis()->SetLabelSize(0.035);
   myfit1158->GetXaxis()->SetTitleSize(0.035);
   myfit1158->GetXaxis()->SetTitleFont(42);
   myfit1158->GetYaxis()->SetLabelFont(42);
   myfit1158->GetYaxis()->SetLabelSize(0.035);
   myfit1158->GetYaxis()->SetTitleSize(0.035);
   myfit1158->GetYaxis()->SetTitleFont(42);
   myfit1158->SetParameter(0,0.1721707);
   myfit1158->SetParError(0,0.0324291);
   myfit1158->SetParLimits(0,0,0);
   myfit1158->SetParameter(1,0.001708824);
   myfit1158->SetParError(1,0.4101565);
   myfit1158->SetParLimits(1,0,0);
   gre->GetListOfFunctions()->Add(myfit1158);
   
   ptstats = new TPaveStats(0.27,0.74,0.9,0.9,"brNDC");
   ptstats->SetName("stats");
   ptstats->SetBorderSize(1);
   ptstats->SetFillColor(0);
   ptstats->SetTextAlign(12);
   ptstats->SetTextFont(42);
   AText = ptstats->AddText("#chi^{2} / ndf = 6.956 / 7");
   AText = ptstats->AddText("p0       = 0.1722 #pm 0.03243 ");
   AText = ptstats->AddText("p1       = 0.001709 #pm 0.4102 ");
   ptstats->SetOptStat(0);
   ptstats->SetOptFit(111);
   ptstats->Draw();
   gre->GetListOfFunctions()->Add(ptstats);
   ptstats->SetParent(gre->GetListOfFunctions());
   multigraph->Add(gre,"");
   multigraph->Draw("AP");
   multigraph->GetXaxis()->SetTitle("#phi [deg.]");
   multigraph->GetXaxis()->SetLabelFont(42);
   multigraph->GetXaxis()->SetLabelSize(0.035);
   multigraph->GetXaxis()->SetTitleSize(0.035);
   multigraph->GetXaxis()->SetTitleFont(42);
   multigraph->GetYaxis()->SetLabelFont(42);
   multigraph->GetYaxis()->SetLabelSize(0.035);
   multigraph->GetYaxis()->SetTitleSize(0.035);
   multigraph->GetYaxis()->SetTitleFont(42);
     gPad->Modified();  
   multigraph->GetYaxis()->SetRangeUser(-0.35, 0.35);  



   pt = new TPaveText(0.2194177,0.9304839,0.7805823,0.995,"blNDC");
   pt->SetName("title");
   pt->SetBorderSize(0);
   pt->SetFillColor(0);
   pt->SetFillStyle(0);
   pt->SetTextFont(42);
   AText = pt->AddText("0.21<-t<0.36 [GeV^{2}/c^{2}]");
   pt->Draw();
   c17_2->Modified();
   c17->cd();
  
// ------------>Primitives in pad: c17_3
   TPad *c17_3 = new TPad("c17_3", "Incoherent channe_3",0.5008721,0,0.7388081,0.9);
   c17_3->Draw();
   c17_3->cd();
   c17_3->Range(7.121854,-0.4888889,349.9594,0.4);
   c17_3->SetFillColor(0);
   c17_3->SetBorderMode(0);
   c17_3->SetBorderSize(2);
   c17_3->SetGridx();
   c17_3->SetGridy();
   c17_3->SetLeftMargin(0);
   c17_3->SetRightMargin(0);
   c17_3->SetTopMargin(0);
   c17_3->SetFrameBorderMode(0);
   c17_3->SetFrameBorderMode(0);
   
   multigraph = new TMultiGraph();
   multigraph->SetName("");
   multigraph->SetTitle("0.36<-t<0.67 [GeV^{2}/c^{2}]");
   
   Double_t Graph_fx1160[9] = {
   22.70538,
   60.97743,
   94.23011,
   138.1892,
   183.0975,
   222.79,
   259.8951,
   302.6808,
   334.3759};
   Double_t Graph_fy1160[9] = {
   0.1761498,
   0.1945204,
   0.1034809,
   -0.09380414,
   0.2967375,
   -0.1094475,
   -0.1583282,
   -0.1819771,
   -0.09543453};
   Double_t Graph_fex1160[9] = {
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0};
   Double_t Graph_fey1160[9] = {
   0.06358895,
   0.0584754,
   0.07622601,
   0.115077,
   0.1268505,
   0.1278475,
   0.07389284,
   0.04701977,
   0.07415904};
   gre = new TGraphErrors(9,Graph_fx1160,Graph_fy1160,Graph_fex1160,Graph_fey1160);
   gre->SetName("Graph");
   gre->SetTitle("Graph");
   gre->SetFillColor(1);

   ci = TColor::GetColor("#00ff00");
   gre->SetMarkerColor(ci);
   gre->SetMarkerStyle(21);
   
   TH1F *Graph_Graph1160 = new TH1F("Graph_Graph1160","Graph",100,0,365.5429);
   Graph_Graph1160->SetMinimum(-0.3033832);
   Graph_Graph1160->SetMaximum(0.4896763);
   Graph_Graph1160->SetDirectory(0);
   Graph_Graph1160->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1160->SetLineColor(ci);
   Graph_Graph1160->GetXaxis()->SetLabelFont(42);
   Graph_Graph1160->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1160->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1160->GetXaxis()->SetTitleFont(42);
   Graph_Graph1160->GetYaxis()->SetLabelFont(42);
   Graph_Graph1160->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1160->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1160->GetYaxis()->SetTitleFont(42);
   Graph_Graph1160->GetZaxis()->SetLabelFont(42);
   Graph_Graph1160->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1160->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1160->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1160);
   
   
   TF1 *myfit1161 = new TF1("myfit","[0]*sin(x*3.1416/180.0)/(1 + [1]*cos(x*3.1416/180.0))",0,365.5429);
   myfit1161->SetFillColor(19);
   myfit1161->SetFillStyle(0);
   myfit1161->SetLineColor(2);
   myfit1161->SetLineWidth(2);
   myfit1161->SetChisquare(8.926216);
   myfit1161->SetNDF(7);
   myfit1161->GetXaxis()->SetLabelFont(42);
   myfit1161->GetXaxis()->SetLabelSize(0.035);
   myfit1161->GetXaxis()->SetTitleSize(0.035);
   myfit1161->GetXaxis()->SetTitleFont(42);
   myfit1161->GetYaxis()->SetLabelFont(42);
   myfit1161->GetYaxis()->SetLabelSize(0.035);
   myfit1161->GetYaxis()->SetTitleSize(0.035);
   myfit1161->GetYaxis()->SetTitleFont(42);
   myfit1161->SetParameter(0,0.1371093);
   myfit1161->SetParError(0,0.03383483);
   myfit1161->SetParLimits(0,0,0);
   myfit1161->SetParameter(1,-0.6800102);
   myfit1161->SetParError(1,0.1832383);
   myfit1161->SetParLimits(1,0,0);
   gre->GetListOfFunctions()->Add(myfit1161);
   
   ptstats = new TPaveStats(0.27,0.74,0.9,0.9,"brNDC");
   ptstats->SetName("stats");
   ptstats->SetBorderSize(1);
   ptstats->SetFillColor(0);
   ptstats->SetTextAlign(12);
   ptstats->SetTextFont(42);
   AText = ptstats->AddText("#chi^{2} / ndf = 8.926 / 7");
   AText = ptstats->AddText("p0       = 0.1371 #pm 0.03383 ");
   AText = ptstats->AddText("p1       = -0.68 #pm 0.1832 ");
   ptstats->SetOptStat(0);
   ptstats->SetOptFit(111);
   ptstats->Draw();
   gre->GetListOfFunctions()->Add(ptstats);
   ptstats->SetParent(gre->GetListOfFunctions());
   multigraph->Add(gre,"");
   multigraph->Draw("AP");
   multigraph->GetXaxis()->SetTitle("#phi [deg.]");
   multigraph->GetXaxis()->SetLabelFont(42);
   multigraph->GetXaxis()->SetLabelSize(0.035);
   multigraph->GetXaxis()->SetTitleSize(0.035);
   multigraph->GetXaxis()->SetTitleFont(42);
   multigraph->GetYaxis()->SetLabelFont(42);
   multigraph->GetYaxis()->SetLabelSize(0.035);
   multigraph->GetYaxis()->SetTitleSize(0.035);
   multigraph->GetYaxis()->SetTitleFont(42);
     gPad->Modified();  
   multigraph->GetYaxis()->SetRangeUser(-0.35, 0.35);  




   pt = new TPaveText(0.2194177,0.9304839,0.7805823,0.995,"blNDC");
   pt->SetName("title");
   pt->SetBorderSize(0);
   pt->SetFillColor(0);
   pt->SetFillStyle(0);
   pt->SetTextFont(42);
   AText = pt->AddText("0.36<-t<0.67 [GeV^{2}/c^{2}]");
   pt->Draw();
   c17_3->Modified();
   c17->cd();
  
// ------------>Primitives in pad: c17_4
   TPad *c17_4 = new TPad("c17_4", "Incoherent channe_4",0.7388081,0,0.9767442,0.9);
   c17_4->Draw();
   c17_4->cd();
   c17_4->Range(7.951117,-0.4888889,350.3641,0.4);
   c17_4->SetFillColor(0);
   c17_4->SetBorderMode(0);
   c17_4->SetBorderSize(2);
   c17_4->SetGridx();
   c17_4->SetGridy();
   c17_4->SetLeftMargin(0);
   c17_4->SetRightMargin(0);
   c17_4->SetTopMargin(0);
   c17_4->SetFrameBorderMode(0);
   c17_4->SetFrameBorderMode(0);
   
   multigraph = new TMultiGraph();
   multigraph->SetName("");
   multigraph->SetTitle("0.67<-t<0.90 [GeV^{2}/c^{2}]");
   
   Double_t Graph_fx1163[9] = {
   23.51534,
   59.3759,
   90.55341,
   131.0631,
   176.9476,
   229.0094,
   260.8643,
   304.7922,
   334.7999};
   Double_t Graph_fy1163[9] = {
   0.0123906,
   0.195403,
   0.18963,
   -0.1677207,
   -0.8232306,
   -0.7760588,
   -0.2579708,
   -0.2579435,
   -0.08614626};
   Double_t Graph_fex1163[9] = {
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0};
   Double_t Graph_fey1163[9] = {
   0.09527872,
   0.1168373,
   0.1651642,
   0.3137499,
   0.3909388,
   0.4596559,
   0.1665094,
   0.09339681,
   0.09961735};
   gre = new TGraphErrors(9,Graph_fx1163,Graph_fy1163,Graph_fex1163,Graph_fey1163);
   gre->SetName("Graph");
   gre->SetTitle("Graph");
   gre->SetFillColor(1);

   ci = TColor::GetColor("#00ff00");
   gre->SetMarkerColor(ci);
   gre->SetMarkerStyle(21);
   
   TH1F *Graph_Graph1163 = new TH1F("Graph_Graph1163","Graph",100,0,365.9283);
   Graph_Graph1163->SetMinimum(-1.394766);
   Graph_Graph1163->SetMaximum(0.5138451);
   Graph_Graph1163->SetDirectory(0);
   Graph_Graph1163->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1163->SetLineColor(ci);
   Graph_Graph1163->GetXaxis()->SetLabelFont(42);
   Graph_Graph1163->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1163->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1163->GetXaxis()->SetTitleFont(42);
   Graph_Graph1163->GetYaxis()->SetLabelFont(42);
   Graph_Graph1163->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1163->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1163->GetYaxis()->SetTitleFont(42);
   Graph_Graph1163->GetZaxis()->SetLabelFont(42);
   Graph_Graph1163->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1163->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1163->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1163);
   
   
   TF1 *myfit1164 = new TF1("myfit","[0]*sin(x*3.1416/180.0)/(1 + [1]*cos(x*3.1416/180.0))",0,365.9283);
   myfit1164->SetFillColor(19);
   myfit1164->SetFillStyle(0);
   myfit1164->SetLineColor(2);
   myfit1164->SetLineWidth(2);
   myfit1164->SetChisquare(8.810638);
   myfit1164->SetNDF(7);
   myfit1164->GetXaxis()->SetLabelFont(42);
   myfit1164->GetXaxis()->SetLabelSize(0.035);
   myfit1164->GetXaxis()->SetTitleSize(0.035);
   myfit1164->GetXaxis()->SetTitleFont(42);
   myfit1164->GetYaxis()->SetLabelFont(42);
   myfit1164->GetYaxis()->SetLabelSize(0.035);
   myfit1164->GetYaxis()->SetTitleSize(0.035);
   myfit1164->GetYaxis()->SetTitleFont(42);
   myfit1164->SetParameter(0,0.2352442);
   myfit1164->SetParError(0,0.0807391);
   myfit1164->SetParLimits(0,0,0);
   myfit1164->SetParameter(1,0.003684647);
   myfit1164->SetParError(1,0.5673774);
   myfit1164->SetParLimits(1,0,0);
   gre->GetListOfFunctions()->Add(myfit1164);
   
   ptstats = new TPaveStats(0.27,0.74,0.9,0.9,"brNDC");
   ptstats->SetName("stats");
   ptstats->SetBorderSize(1);
   ptstats->SetFillColor(0);
   ptstats->SetTextAlign(12);
   ptstats->SetTextFont(42);
   AText = ptstats->AddText("#chi^{2} / ndf = 8.811 / 7");
   AText = ptstats->AddText("p0       = 0.2352 #pm 0.08074 ");
   AText = ptstats->AddText("p1       = 0.003685 #pm 0.5674 ");
   ptstats->SetOptStat(0);
   ptstats->SetOptFit(111);
   ptstats->Draw();
   gre->GetListOfFunctions()->Add(ptstats);
   ptstats->SetParent(gre->GetListOfFunctions());
   multigraph->Add(gre,"");
   multigraph->Draw("AP");
   multigraph->GetXaxis()->SetTitle("#phi [deg.]");
   multigraph->GetXaxis()->SetLabelFont(42);
   multigraph->GetXaxis()->SetLabelSize(0.035);
   multigraph->GetXaxis()->SetTitleSize(0.035);
   multigraph->GetXaxis()->SetTitleFont(42);
   multigraph->GetYaxis()->SetLabelFont(42);
   multigraph->GetYaxis()->SetLabelSize(0.035);
   multigraph->GetYaxis()->SetTitleSize(0.035);
   multigraph->GetYaxis()->SetTitleFont(42);
     gPad->Modified();  
   multigraph->GetYaxis()->SetRangeUser(-0.35, 0.35);  




   pt = new TPaveText(0.2194177,0.9304839,0.7805823,0.995,"blNDC");
   pt->SetName("title");
   pt->SetBorderSize(0);
   pt->SetFillColor(0);
   pt->SetFillStyle(0);
   pt->SetTextFont(42);
   AText = pt->AddText("0.67<-t<0.90 [GeV^{2}/c^{2}]");
   pt->Draw();
   c17_4->Modified();
   c17->cd();
   c17->Modified();
   c17->cd();
   c17->SetSelected(c17);
}
void Pythia8_Dijet30_result_JER_akPu4PF_((abs(refeta)<2)&&(hiBin>60))&&(refpt>30)_refeta()
{
//=========Macro generated from canvas: Can_result_3/
//=========  (Mon Apr 18 04:08:04 2016) by ROOT version6.02/13
   TCanvas *Can_result_3 = new TCanvas("Can_result_3", "",18,40,700,500);
   gStyle->SetOptFit(1);
   Can_result_3->Range(-2.75,0.1715425,2.75,0.2926317);
   Can_result_3->SetFillColor(0);
   Can_result_3->SetBorderMode(0);
   Can_result_3->SetBorderSize(2);
   Can_result_3->SetFrameBorderMode(0);
   Can_result_3->SetFrameBorderMode(0);
   
   TMultiGraph *multigraph = new TMultiGraph();
   multigraph->SetName("name");
   multigraph->SetTitle("JER_akPu4PF");
   
   Double_t Graph_fx1007[9] = {
   -1.8,
   -1.4,
   -1,
   -0.6,
   -0.2,
   0.2,
   0.6,
   1,
   1.6};
   Double_t Graph_fy1007[9] = {
   0.2213775,
   0.2313726,
   0.212349,
   0.1992318,
   0.2015521,
   0.2047929,
   0.2065286,
   0.2141753,
   0.2298097};
   Double_t Graph_fex1007[9] = {
   0.2,
   0.2,
   0.2,
   0.2,
   0.2,
   0.2,
   0.2,
   0.2,
   0.4};
   Double_t Graph_fey1007[9] = {
   0.001529502,
   0.001378741,
   0.001274153,
   0.001286487,
   0.00132694,
   0.001354738,
   0.001397823,
   0.001305814,
   0.001034891};
   TGraphErrors *gre = new TGraphErrors(9,Graph_fx1007,Graph_fy1007,Graph_fex1007,Graph_fey1007);
   gre->SetName("Graph");
   gre->SetTitle("some title_0");
   gre->SetFillColor(1);
   gre->SetFillStyle(0);
   
   TH1F *Graph_Graph1007 = new TH1F("Graph_Graph1007","some title_0",100,-2.4,2.4);
   Graph_Graph1007->SetMinimum(0.1944648);
   Graph_Graph1007->SetMaximum(0.236232);
   Graph_Graph1007->SetDirectory(0);
   Graph_Graph1007->SetStats(0);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#000099");
   Graph_Graph1007->SetLineColor(ci);
   Graph_Graph1007->GetXaxis()->SetLabelFont(42);
   Graph_Graph1007->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1007->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1007->GetXaxis()->SetTitleFont(42);
   Graph_Graph1007->GetYaxis()->SetLabelFont(42);
   Graph_Graph1007->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1007->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1007->GetYaxis()->SetTitleFont(42);
   Graph_Graph1007->GetZaxis()->SetLabelFont(42);
   Graph_Graph1007->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1007->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1007->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1007);
   
   multigraph->Add(gre,"");
   
   Double_t Graph_fx1008[20] = {
   -1.9,
   -1.7,
   -1.5,
   -1.2,
   -0.9,
   -0.7,
   -0.5,
   -0.3,
   -0.1,
   0.1,
   0.3,
   0.5,
   0.7,
   0.9,
   1.1,
   1.3,
   1.5,
   1.7,
   1.9,
   1};
   Double_t Graph_fy1008[20] = {
   0.2311591,
   0.2477474,
   0.2655955,
   0.2576075,
   0.2220231,
   0.206768,
   0.2064983,
   0.2020811,
   0.19917,
   0.2115871,
   0.1952014,
   0.1965805,
   0.2158946,
   0.2003286,
   0.213619,
   0.213695,
   0.2466632,
   0.2597152,
   0.2553281,
   0.2344014};
   Double_t Graph_fex1008[20] = {
   0.1,
   0.1,
   0.1,
   0.2,
   0.1,
   0.1,
   0.1,
   0.1,
   0.1,
   0.1,
   0.1,
   0.1,
   0.1,
   0.1,
   0.1,
   0.1,
   0.1,
   0.1,
   0.1,
   -1};
   Double_t Graph_fey1008[20] = {
   0.009894431,
   0.01000488,
   0.01052403,
   0.009913006,
   0.008527985,
   0.007570562,
   0.007309829,
   0.007320613,
   0.00699798,
   0.00776784,
   0.007146697,
   0.00713059,
   0.007530691,
   0.007364154,
   0.007896077,
   0.007855752,
   0.009496669,
   0.01034782,
   0.01046585,
   0.009252961};
   gre = new TGraphErrors(20,Graph_fx1008,Graph_fy1008,Graph_fex1008,Graph_fey1008);
   gre->SetName("Graph");
   gre->SetTitle("Graph");
   gre->SetFillColor(1);
   gre->SetFillStyle(0);
   gre->SetLineColor(2);
   gre->SetMarkerColor(2);
   
   TH1F *Graph_Graph1008 = new TH1F("Graph_Graph1008","Graph",100,-2.4,2.4);
   Graph_Graph1008->SetMinimum(0.1792482);
   Graph_Graph1008->SetMaximum(0.284926);
   Graph_Graph1008->SetDirectory(0);
   Graph_Graph1008->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1008->SetLineColor(ci);
   Graph_Graph1008->GetXaxis()->SetLabelFont(42);
   Graph_Graph1008->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1008->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1008->GetXaxis()->SetTitleFont(42);
   Graph_Graph1008->GetYaxis()->SetLabelFont(42);
   Graph_Graph1008->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1008->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1008->GetYaxis()->SetTitleFont(42);
   Graph_Graph1008->GetZaxis()->SetLabelFont(42);
   Graph_Graph1008->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1008->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1008->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1008);
   
   multigraph->Add(gre,"");
   multigraph->Draw("AP");
   multigraph->GetXaxis()->SetTitle("refeta");
   multigraph->GetXaxis()->SetLabelFont(42);
   multigraph->GetXaxis()->SetLabelSize(0.035);
   multigraph->GetXaxis()->SetTitleSize(0.035);
   multigraph->GetXaxis()->SetTitleFont(42);
   multigraph->GetYaxis()->SetTitle("#sigma_{Reco./Gen.}");
   multigraph->GetYaxis()->SetLabelFont(42);
   multigraph->GetYaxis()->SetLabelSize(0.035);
   multigraph->GetYaxis()->SetTitleSize(0.035);
   multigraph->GetYaxis()->SetTitleFont(42);
   
   TLegend *leg = new TLegend(0.68,0.7,0.88,0.85,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   TLegendEntry *entry=leg->AddEntry("Graph","allJets","l");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph","from chris","l");
   entry->SetLineColor(2);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   leg->Draw();
   TLatex *   tex = new TLatex(0.35,0.8,"#bf{#color[2]{|#eta_{jet}|<2.0 & refpt>30}}");
tex->SetNDC();
   tex->SetTextFont(43);
   tex->SetTextSize(24);
   tex->SetLineWidth(2);
   tex->Draw();
      tex = new TLatex(0.17,0.17,"Centrality:30-100%");
tex->SetNDC();
   tex->SetTextFont(43);
   tex->SetTextSize(24);
   tex->SetLineWidth(2);
   tex->Draw();
   
   TPaveText *pt = new TPaveText(0.3743391,0.9365254,0.6256609,0.995,"blNDC");
   pt->SetName("title");
   pt->SetBorderSize(0);
   pt->SetFillColor(0);
   pt->SetFillStyle(0);
   pt->SetTextFont(42);
   AText = pt->AddText("JER_akPu4PF");
   pt->Draw();
   Can_result_3->Modified();
   Can_result_3->cd();
   Can_result_3->SetSelected(Can_result_3);
}
void AnalyzeClipping(TString inputWaveName = "sum trigger input ch5 960mV",
TString outputWaveName = "sum trigger output ch5 - 2V clip - 960mV input", 
Double_t inputDelay = 1.1E-8, Double_t lowerCut = 16E-9, Double_t upperCut = 23E-9,
const char *inFile = "Data.root",const char *WaveformsFile = "Waveforms.root") {
	
	//try to access data file and in case of failure return
	if(gSystem->AccessPathName(inFile,kFileExists)) {
		cout << "Error: file " << inFile << " does not exsist. Run .x DataParse.C to create it" << endl;
		return;
	}

	TFile *f = TFile::Open(inFile);
	TFolder *dataSet;
	
	TString dataFolderS = "SumTriggerBoardData";
	dataFolderS.Append(";1");

	dataSet = (TFolder*)f->Get(dataFolderS);
	
	cout << dataSet << endl;

	cout << dataSet->GetName() << endl;
	
	Int_t nScope = 150; // number of measurements done by the scope evey time
	
	//try to access waveforms file and in case of failure return
	if(gSystem->AccessPathName(WaveformsFile,kFileExists)) {
		cout << "Error: file " << WaveformsFile << " does not exsist. Run .x WaveformsFileMaker.C to create it" << endl;
		return;
	}
	
	TFile *f = TFile::Open(WaveformsFile);
	TList *listOfKeys = f->GetListOfKeys();
	Int_t numberOfKeys = listOfKeys->GetEntries();
	TList *listOfGraphs = new TList();
	
	// if the waveform file name begins with the string "comparator" it goes in this list
	TList *listOfCompWaves = new TList();
	// if the waveform file name begins with the string "sum output" it goes in this list
	TList *listOfAdderWaves = new TList();

	for(Int_t i = 0; i < numberOfKeys; i++) {
		TString *keyName = new TString(listOfKeys->At(i)->GetName());
		TTree *tree = (TTree*)f->Get(keyName->Data());
		Float_t x = 0;
		Float_t y = 0;
		tree->SetBranchAddress("x",&x);
		tree->SetBranchAddress("y",&y);
		Int_t nentries = tree->GetEntries();

		TString *gName = new TString(keyName->Data());
		gName->Append(" graph");
		TGraphErrors *gWave = new TGraphErrors(nentries);
		gWave->SetName(gName->Data());
		gWave->SetTitle(gName->Data());
		gWave->GetXaxis()->SetTitle("Time");
		gWave->GetYaxis()->SetTitle("Voltage");

		for (Int_t j = 0; j < nentries; j++) {
			tree->GetEntry(j);
			gWave->SetPoint(j,x,y);
		}

		listOfGraphs->Add(gWave);
	}
	
	// Global variables
	
	Double_t *xInput, *xOutput, *yInput, *yOutput;
	
	// V input 960 mV
	
	TString path = "Clipping/Output width analysis/Channel 5/V input 960mV/";
	
	TGraphErrors *gClip960mV = TBGraphErrors(dataSet,path,"V clip","Output FWHM",1,nScope);
	
	gClip960mV->SetMarkerStyle(20);
	gClip960mV->SetMarkerSize(0.8);
	gClip960mV->GetXaxis()->SetTitle("V clipping (mV)");
	gClip960mV->GetYaxis()->SetTitle("Output FWHM (ns)");
	
	TCanvas *cClip960mV = new TCanvas("cClip960mV","Output FWHM in function of V clipping",800,600);
	gClip960mV->Draw("APEL");
	
	// Expected output FWHM
	
	TGraphErrors *gInput960mV = listOfGraphs->FindObject("sum trigger input ch5 960mV graph");
	
	Double_t *xClip = gClip960mV->GetX();
	Int_t nClip = gClip960mV->GetN();
	cout << "nClip = " << nClip << endl;
	Long64_t graphPoints = gInput960mV->GetN();
	yInput = gInput960mV->GetY();
	xInput = gInput960mV->GetX();
	
	vector<double> xFirst(nClip);
	vector<double> xLast(nClip);
	Double_t half;
	
	Int_t flag = 0;
	
	vector<double> yConv(graphPoints);
	for(Int_t i = 0; i < graphPoints; i++) {
		yConv[i] = -(yInput[i]);
		yConv[i] *= 1000;
		if(xInput[i] + inputDelay < lowerCut || xInput[i] + inputDelay > upperCut) 
			yConv[i] = 0;
	}
	
	Double_t yInput960mVMax = TMath::MaxElement(graphPoints,&yConv[0]);
	
	for(Int_t i = 0; i < nClip; i++) {
		if(xClip[i] > yInput960mVMax) half = yInput960mVMax;
		else half = xClip[i];
		
		half /=2;
		cout << half << endl;
		
		flag = 0;
		
		for(Int_t j = 0; j < graphPoints - 3; j++) {
			if((yConv[j + 1] - half)*(yConv[j] - half) < 0 && flag == 0) {
				xFirst[i] = xInput[j];
				flag = 1;
				cout << "found first point! " << xFirst[i] << endl;
				continue;
			}
			if((yConv[j + 1] - half)*(yConv[j] - half) < 0 && flag == 1) {
				xLast[i] = xInput[j];
				cout << "found last point! " << xLast[i] << endl;
				break;
			}
		}
	}
	
	vector<double> expectedFWHM960mV(nClip);
	for(Int_t i = 0; i < expectedFWHM960mV.size(); i++) {
		expectedFWHM960mV[i] = xLast[i] - xFirst[i];
		// convert from seconds to nanoseconds
		expectedFWHM960mV[i] *= 10E8;
		cout << "expectedFWHM960mV[" << i << "] = " << expectedFWHM960mV[i] << endl;
	}
	
	// expected FWHM 960 mV graph
	
	TGraphErrors *gExpClip960mV = new TGraphErrors(nClip,xClip,&expectedFWHM960mV[0],0,0);
	gExpClip960mV->SetLineStyle(7);
	gExpClip960mV->SetMarkerStyle(20);
	gExpClip960mV->SetMarkerSize(0.8);
	
	// V input 1.9 V
	
	path = "Clipping/Output width analysis/Channel 5/V input 1.9V/";
	
	TGraphErrors *gClip1Point9V = TBGraphErrors(dataSet,path,"V clip","Output FWHM",1,nScope);
	
	gClip1Point9V->SetMarkerStyle(20);
	gClip1Point9V->SetMarkerSize(0.8);
	gClip1Point9V->SetLineColor(kRed);
	gClip1Point9V->GetXaxis()->SetTitle("V clipping (mV)");
	gClip1Point9V->GetYaxis()->SetTitle("Output FWHM (ns)");
	TCanvas *cClip1Point9V = new TCanvas("cClip1Point9V","Output FWHM in function of V clipping",800,600);
	gClip1Point9V->Draw("APEL");
	
	// Expected output FWHM
	
	TGraphErrors *gInput1Point9V = listOfGraphs->FindObject("sum trigger input ch5 1900mV graph");
	
	xClip = gClip1Point9V->GetX();
	nClip = gClip1Point9V->GetN();
	cout << "nClip = " << nClip << endl;
	graphPoints = gInput1Point9V->GetN();
	yInput = gInput1Point9V->GetY();
	xInput = gInput1Point9V->GetX();
	
	vector<double> xFirst(nClip);
	vector<double> xLast(nClip);
	
	flag = 0;
	
	vector<double> yConv(graphPoints);
	for(Int_t i = 0; i < graphPoints; i++) {
		yConv[i] = -(yInput[i]);
		yConv[i] *= 1000;
		if(xInput[i] + inputDelay < lowerCut || xInput[i] + inputDelay > upperCut) yConv[i] = 0;
	}
	
	Double_t yInput1Point9VMax = TMath::MaxElement(graphPoints,&yConv[0]);
	
	for(Int_t i = 0; i < nClip; i++) {
		if(xClip[i] > yInput1Point9VMax) half = yInput1Point9VMax;
		else half = xClip[i];
		
		half /= 2;
		cout << half << endl;
		
		flag = 0;
		
		for(Int_t j = 0; j < graphPoints - 3; j++) {
			if((yConv[j + 1] - half)*(yConv[j] - half) < 0 && flag == 0) {
				xFirst[i] = xInput[j];
				flag = 1;
				cout << "found first point! " << xFirst[i] << endl;
				continue;
			}
			if((yConv[j + 1] - half)*(yConv[j] - half) < 0 && flag == 1) {
				xLast[i] = xInput[j];
				cout << "found last point! " << xLast[i] << endl;
				break;
			}
		}
	}
	
	vector<double> expectedFWHM1Point9V(nClip);
	for(Int_t i = 0; i < expectedFWHM1Point9V.size(); i++) {
		expectedFWHM1Point9V[i] = xLast[i] - xFirst[i];
		// convert from seconds to nanoseconds
		expectedFWHM1Point9V[i] *= 10E8;
		cout << "expectedFWHM1Point9V[" << i << "] = " << expectedFWHM1Point9V[i] << endl;
	}
	
	// expected FWHM 960 mV graph
	
	TGraphErrors *gExpClip1Point9V = new TGraphErrors(nClip,xClip,&expectedFWHM1Point9V[0],0,0);
	gExpClip1Point9V->SetLineStyle(7);
	gExpClip1Point9V->SetLineColor(kRed);
	gExpClip1Point9V->SetMarkerStyle(20);
	gExpClip1Point9V->SetMarkerSize(0.8);
	
	// Collection of Output FWHM graphs, 2 amplitudes, serveral V clipping
	
	TMultiGraph *mgClipOutputFWHM = new TMultiGraph();
	mgClipOutputFWHM->SetTitle("Collection of Output FWHM graphs, 2 amplitudes, serveral V clipping");
	
	mgClipOutputFWHM->Add(gClip1Point9V);
	mgClipOutputFWHM->Add(gClip960mV);
	mgClipOutputFWHM->Add(gExpClip960mV);
	mgClipOutputFWHM->Add(gExpClip1Point9V);
	
	
	TCanvas *cmgClipOutputFWHM = new TCanvas("cmgClipOutputFWHM","Collection of Output FWHM graphs, 2 amplitudes, serveral V clipping");
	mgClipOutputFWHM->Draw("APEL");
	
	cmgClipOutputFWHM->Modified();
	mgClipOutputFWHM->GetXaxis()->SetTitle("V clipping (mV)");
	mgClipOutputFWHM->GetYaxis()->SetTitle("Output FWHM (ns)");
	cmgClipOutputFWHM->Update();
		
	legend = new TLegend(0.6,0.67,0.89,0.86,"V input");
	legend->AddEntry(gClip1Point9V, "1.9 V", "lp");
	legend->AddEntry(gClip960mV, "960 mV", "lp");
	legend->AddEntry(gExpClip960mV, "Exp 960 mV", "lp");
	legend->AddEntry(gExpClip1Point9V, "Exp 1.9 V", "lp");
	legend->SetTextSize(0.04);
	legend->SetMargin(0.5);
	legend->Draw();
	
	// Hysteresis plot: V output (t) in function of V input (t) for several clipping values
	
	// variables used in the analysis
	
	Long64_t iInputMax, iOutputMax;
	Float_t xInputMax, xOutputMax, xInputHalf, xOutputHalf;
	Double_t InputMax, OutputMax, InputHalf, OutputHalf;
	
	Long64_t firstIndex = 0;
	Long64_t lastIndex = 0;
	Long64_t inputGraphPoints = 0;
	Long64_t outputGraphPoints = 0;
	
	// hard coded values to cut the x axis of both waves
	// Input wave
	
	inputWaveName += " graph";
	
	TGraphErrors *gInput = listOfGraphs->FindObject(inputWaveName);
	gInput->SetLineColor(kRed);
	gInput->SetLineWidth(2);
	
	xInput = gInput->GetX();
	yInput = gInput->GetY();
	inputGraphPoints = gInput->GetN();
	
	cout << inputGraphPoints << endl;
	
	// Invert the input wave
	
	for(Int_t i = 0; i < inputGraphPoints; i++) {
		yInput[i] = -(yInput[i]);
	}
	
	// find the x at which the graph reaches the max value
	
	iInputMax = TMath::LocMax(inputGraphPoints, yInput);
	xInputMax = xInput[iInputMax];
	cout << "iInputMax = " << iInputMax << endl;
	cout << "xInputMax = " << xInputMax << endl;
	InputMax = gInput->Eval(xInput[iInputMax]);
	cout << "InputMax = " << InputMax << endl;
	
	// Output wave
	
	outputWaveName += " graph";
	
	TGraphErrors *gOutput = listOfGraphs->FindObject(outputWaveName);
	gOutput->SetLineWidth(2);
	
	xOutput = gOutput->GetX();
	yOutput = gOutput->GetY();
	outputGraphPoints = gOutput->GetN();
	
	// find the x at which the graph reaches the max value
	
	iOutputMax = TMath::LocMax(outputGraphPoints, yOutput);
	xOutputMax = xOutput[iOutputMax];
	cout << "iOutputMax = " << iOutputMax << endl;
	cout << "xOutputMax = " << xOutputMax << endl;
	OutputMax = gOutput->Eval(xOutput[iOutputMax]);
	cout << "OutputMax = " << OutputMax << endl;
	
	// compute x delay between max points
	
	Double_t delay = xOutputMax - xInputMax;
	cout << "delay = " << delay << endl;
	
	// Shift the x axis of the input graph and create a new graph with only a portion of the first graph
	
	for(Int_t i = 0; i < inputGraphPoints; i++) {
		xInput[i] += inputDelay;
		
		if(xInput[i] >= lowerCut) {
			if(firstIndex == 0) firstIndex = i;
		}

		if(xInput[i] <= upperCut)
			lastIndex = i;
	}
	
	cout << "firstIndex = " << firstIndex << endl;
	cout << "lastIndex = " << lastIndex << endl;
	cout << "xInput[firstIndex] = " << xInput[firstIndex] << endl;
	cout << lastIndex - firstIndex << endl;
	
	Long64_t input2GraphPoints = lastIndex - firstIndex;
	
	TGraphErrors *gInput2 = new TGraphErrors(input2GraphPoints);
	gInput2->SetTitle(inputWaveName);
	
	for(Int_t i = firstIndex; i <= lastIndex; i++) {
		gInput2->SetPoint(i - firstIndex,xInput[i],yInput[i]);
	}
	
	TCanvas *cgInput2 = new TCanvas("cgInput2", "cgInput2", 1200,800);
	gInput2->Draw("AL");
	
	// create a new graph with only a portion of the first graph
	
	firstIndex = 0;
	lastIndex = 0;
	
	for(Int_t i = 0; i < outputGraphPoints; i++) {
		if(xOutput[i] >= lowerCut) {
			if(firstIndex == 0) firstIndex = i;
		}

		if(xOutput[i] <= upperCut)
			lastIndex = i;
	}
	
	cout << "firstIndex = " << firstIndex << endl;
	cout << "lastIndex = " << lastIndex << endl;
	cout << "xOutput[firstIndex] = " << xOutput[firstIndex] << endl;
	cout << lastIndex - firstIndex << endl;
	
	Long64_t output2GraphPoints = lastIndex - firstIndex;
	
	TGraphErrors *gOutput2 = new TGraphErrors(output2GraphPoints);
	gOutput2->SetTitle(outputWaveName);
	
	for(Int_t i = firstIndex; i <= lastIndex; i++) {
		gOutput2->SetPoint(i - firstIndex,xOutput[i],yOutput[i]);
	}
	
	TCanvas *cgOutput2 = new TCanvas("cgOutput2", "cgOutput2", 1200,800);
	gOutput2->Draw("AL");
	
	// first hysteresis plot
	
	Double_t step;
	
	Double_t *xInput2;
	xInput2 = gInput2->GetX();
	
	cout << "xInput2[input2GraphPoints - 1] = " << xInput2[input2GraphPoints - 1] << endl;
	cout << "xInput2[0] = " << xInput2[0] << endl;
	
	step = (xInput2[input2GraphPoints - 1] - xInput2[0])/output2GraphPoints;
	
	cout << "step = " << step << endl;
	
	// in case gInput2 and gOutput2 contain a different number of points create the hysteresis plot with gOutput2 points
	// and modify the yInput2 to match the number of points of yOutput2
	
	vector<double> yInput2;
	
	for(Int_t i = 0; i < output2GraphPoints; i++) {
		yInput2.push_back(gInput2->Eval(xInput2[0] + i*step));
	}
	
	Double_t *yOutput2;
	yOutput2 = gOutput2->GetY();
	
	TGraphErrors *gHyst = new TGraphErrors(output2GraphPoints, &yInput2.at(0),yOutput2);
	gHyst->SetTitle("Hysteresis plot");
	
	gHyst->GetXaxis()->SetTitle("Vin(t) [mV]");
	gHyst->GetYaxis()->SetTitle("Vout(t) [mV]");
	gHyst->GetYaxis()->SetTitleOffset(1.4);
	
	TCanvas *cgHyst = new TCanvas("cgHyst", "cgHyst", 1200,800);
	cgHyst->SetLeftMargin(0.12);
	gHyst->Draw("AL");
	
	// collection of graphs
	
	TMultiGraph *mgInputOutput = new TMultiGraph();
	mgInputOutput->Add(gInput);
	mgInputOutput->Add(gOutput);
	mgInputOutput->SetTitle("Input and output");
	
	TCanvas *cmgInputOutput = new TCanvas("cmgInputOutput", "Input and output", 1200,800);
	mgInputOutput->Draw("AL");
	cmgInputOutput->Update();
	legend = new TLegend(0.65,0.68,0.86,0.86);
	legend->AddEntry(gInput, "Input", "lp");
	legend->AddEntry(gOutput, "Output", "lp");
	legend->SetMargin(0.4);
	legend->SetTextSize(0.04);
	legend->Draw();
	cmgInputOutput->Modified();

	
}
void continuum_test2(const int type = 11) {
    TChain* gen_chain = new TChain("TEvent");
    gen_chain->Add("/home/vitaly/B0toDh0/Tuples/Fil_b2dh_mixed.root");
    TChain* sig_chain = new TChain("TEvent");
    TChain* bkg_chain = new TChain("TEvent");
    int nsig;
    int m_mode,m_h0mode;
    double eff_min = 0.4;
    double eff_max = 0.95;
    double signif_min = 0;
    double signif_max = 15;
    double rej_min = 0.8;
    double rej_max = 1.0;
//  double mh0_min, mh0_max;
    double de_min, de_max;
    double mbc_min, mbc_max;
    string label;
    switch(type) {
    case 11:
        sig_chain->Add("/home/vitaly/B0toDh0/Tuples/Fil_b2dh_sigmcPi0_s7.root");
        m_mode = 1;
        m_h0mode = 10;
        label = string("#pi^{0}");
        signif_min = 13.;
        signif_max = 20;
        de_min  =-0.1;
        de_max  = 0.0921343;
        mbc_min = 5.27093;
        mbc_max = 5.28789;
        break;
    case 101:
        sig_chain->Add("/home/vitaly/B0toDh0/Tuples/Fil_b2dh_sigmcDST0_s1.root");
        m_mode = 10;
        m_h0mode = 10;
        label = string("D^{*0}#pi^{0}");
        signif_min = 5.5;
        signif_max = 7.2;
        de_min  =-0.1;
        de_max  = 0.0647985;
        mbc_min = 5.27146;
        mbc_max = 5.28769;
        break;
    case 12:
        sig_chain->Add("/home/vitaly/B0toDh0/Tuples/Fil_b2dh_sigmcETA_s2.root");
        m_mode = 2;
        m_h0mode = 10;
        label = string("#eta#rightarrow#gamma#gamma");
        signif_min = 7.5;
        signif_max = 10;
        de_min  =-0.0994528;
        de_max  = 0.0758825;
        mbc_min = 5.27147;
        mbc_max = 5.28763;
        break;
    case 102:
        sig_chain->Add("/home/vitaly/B0toDh0/Tuples/Fil_b2dh_sigmcDST0_s1.root");
        m_mode = 20;
        m_h0mode = 10;
        label = string("D^{*0}#eta(#rightarrow#gamma#gamma)");
        signif_min = 4.;
        signif_max = 5.;
        de_min  =-0.0853615;
        de_max  = 0.0630641;
        mbc_min = 5.27182;
        mbc_max = 5.28746;
        break;
    case 13:
        sig_chain->Add("/home/vitaly/B0toDh0/Tuples/Fil_b2dh_sigmcETA_s2.root");
        m_mode = 2;
        m_h0mode = 20;
        label = string("#eta#rightarrow#pi^{+}#pi^{-}#pi^{0}");
        signif_min = 4.5;
        signif_max = 6.2;
        de_min  =-0.0534644;
        de_max  = 0.0453713;
        mbc_min = 5.27205;
        mbc_max = 5.28735;
        break;
    case 103:
        sig_chain->Add("/home/vitaly/B0toDh0/Tuples/Fil_b2dh_sigmcDST0_s1.root");
        m_mode = 20;
        m_h0mode = 20;
        label = string("D^{*0}#eta(#rightarrow#pi^{+}#pi^{-}#pi^{0})");
        signif_min = 5;
        signif_max = 6.5;
        de_min  =-0.0567598;
        de_max  = 0.0459849;
        mbc_min = 5.27182;
        mbc_max = 5.28746;
        break;
    case 14:
        sig_chain->Add("/home/vitaly/B0toDh0/Tuples/Fil_b2dh_sigmcOMEGA_s5.root");
        m_mode = 3;
        m_h0mode = 20;
        label = string("#omega");
        signif_min = 11.5;
        signif_max = 15.0;
        de_min  =-0.0565915;
        de_max  = 0.0467748;
        mbc_min = 5.27198;
        mbc_max = 5.28743;
        break;
    case 15:
        sig_chain->Add("/home/vitaly/B0toDh0/Tuples/Fil_b2dh_sigmcETAP_s1.root");
        m_mode = 5;
        m_h0mode = 10;
        label = string("#eta'(#rightarrow#gamma#gamma)");
        signif_min = 3.;
        signif_max = 4;
        de_min  =-0.0873898;
        de_max  = 0.0642064;
        mbc_min = 5.27255;
        mbc_max = 5.28718;
        break;
    default:
        cout << "Wrong signal type " << type << endl;
        return;
    }

    bkg_chain->Add("/home/vitaly/B0toDh0/Tuples/Fil_cont.root");
//  bkg_chain->Add("/home/vitaly/B0toDh0/TMVA/FIL1_b2dh_charm_2_12.root");
//  bkg_chain->Add("/home/vitaly/B0toDh0/TMVA/FIL1_b2dh_uds_2_12.root");

    RooArgSet argset;

    RooCategory mode("mode","mode");
    mode.defineType("mode",m_mode);

    RooCategory h0mode("h0mode","h0mode");
    h0mode.defineType("h0mode",m_h0mode);

    argset.add(mode);
    argset.add(h0mode);

    RooCategory good_icpv("good_icpv","good_icpv");
    good_icpv.defineType("good_icpv",1);
    argset.add(good_icpv);

    RooRealVar mbc("mbc","mbc",mbc_min,mbc_max,"GeV");
    argset.add(mbc);
    RooRealVar de("de","#DeltaE",de_min,de_max,"GeV");
    argset.add(de);
    RooRealVar cos_thr("cos_thr","cos_thr",-1,1);
    argset.add(cos_thr);
    RooRealVar cos_hel("cos_hel","cos_hel",-1,1);
    if(type == 14) argset.add(cos_hel);
//  RooRealVar md("md_raw","md_raw",md_min,md_max,"GeV");     argset.add(md);
//  RooRealVar mk("mk","mk",KMass-mk_cut,KMass+mk_cut,"GeV"); argset.add(mk);
//  RooRealVar mh0("mh0","mh0",mh0_min,mh0_max,"GeV"); argset.add(mh0);
//  RooRealVar mpi0("mpi0","mpi0",mpi0_min,mpi0_max,"GeV"); if(type != 12) argset.add(mpi0);
//  RooRealVar chi2_mass_d0("chi2_mass_d0","chi2_mass_d0",0.,50.); argset.add(chi2_mass_d0);

    const bool bdt_flag  = type<15;
    const bool bdtg_flag = false;
    const bool lh1_flag  = false;
    const bool lh0_flag  = type>=15;

    double bdt_best_cut  = 0;
    double bdtg_best_cut = 0;
    double lh1_best_cut  = 0;
    double lh0_best_cut  = 0;

    double bdt_best_sig  = 0;
    double bdtg_best_sig = 0;
    double lh1_best_sig  = 0;
    double lh0_best_sig  = 0;

    double bdt_best_eff  = 0;
    double bdtg_best_eff = 0;
    double lh1_best_eff  = 0;
    double lh0_best_eff  = 0;

    double bdt_best_sup  = 0;
    double bdtg_best_sup = 0;
    double lh1_best_sup  = 0;
    double lh0_best_sup  = 0;

    double bdt_best_pur  = 0;
    double bdtg_best_pur = 0;
    double lh1_best_pur  = 0;
    double lh0_best_pur  = 0;

    if(bdt_flag) {
        RooRealVar bdt("bdt","bdt",-1.,1.);
        argset.add(bdt);
    }
    if(bdtg_flag) {
        RooRealVar bdtg("bdtg","bdtg",-1.,1.);
        argset.add(bdtg);
    }
    if(lh1_flag) {
        RooRealVar lh1("lh1","lh1",0.,1.);
        argset.add(lh1);
    }
    if(lh0_flag) {
        RooRealVar lh0("lh0","lh0",0.,1.);
        argset.add(lh0);
    }
//  RooRealVar atckpi_max("atckpi_max","atckpi_max",0.,atckpi_cut); argset.add(atckpi_max);
//  RooRealVar cos_thr("cos_thr","cos_thr",-1.,1.); argset.add(cos_thr);

//  RooArgSet argset_gen(argset);

    RooCategory b0f("b0f","b0f");
    b0f.defineType("comb",-1);
    b0f.defineType("good",1);
    b0f.defineType("wrph",5);
    b0f.defineType("fsr",10);
    argset.add(b0f);

    RooDataSet ds_sig("ds_sig","ds_sig",sig_chain,argset,"b0f == 1 || b0f == 5 || b0f == 10");
    RooDataSet ds_con("ds_con","ds_con",bkg_chain,argset,"b0f == -1");


    RooDataSet ds_gen("ds_gen","ds_gen",gen_chain,argset,"b0f == 1 || b0f == 5 || b0f == 10");
    nsig = ds_gen.sumEntries()*0.25;
    cout << "Nsig: " << nsig << endl;
    ds_sig.Print();
    ds_con.Print();

    double sig_eff_bdt[100];
    double sig_eff_bdtg[100];
    double sig_eff_lh1[100];
    double sig_eff_lh0[100];

    double back_reg_bdt[100];
    double back_reg_bdtg[100];
    double back_reg_lh1[100];
    double back_reg_lh0[100];

    double signif_bdt[100];
    double signif_bdtg[100];
    double signif_lh1[100];
    double signif_lh0[100];

    const double gen = ds_con.sumEntries()*0.25;
    const double sig = ds_sig.sumEntries();

    stringstream out;
    double S,B;
    const int dots = 100;
    const double dbdt = 1./dots;
    cout << gen*4 << " " << sig << endl;
    for(int i=0; i<dots; i++) {
        if(bdt_flag) {
            out.str("");
            out << "bdt>" << i*dbdt;
            S = ds_sig.sumEntries(out.str().c_str());
            B = ds_con.sumEntries(out.str().c_str())*0.25;
            sig_eff_bdt[i]  = S/sig;
            back_reg_bdt[i] = (gen-B)/gen;
            S = nsig/sig*S;
//      B = nback/gen*B;
            signif_bdt[i] = S/sqrt(S+B+0.0001);
            if(bdt_best_sig<(signif_bdt[i]-0.07)) {
                bdt_best_sig = signif_bdt[i];
                bdt_best_cut = i*dbdt;
                bdt_best_pur = S/(S+B);
                bdt_best_eff = sig_eff_bdt[i];
                bdt_best_sup = back_reg_bdt[i];
            }
        }

        if(lh1_flag) {
            out.str("");
            out << "lh1>sqrt(1-" << i*dbdt*i*dbdt << ") && abs(cos_thr)<1.";
            if(type == 14) out << " && abs(cos_hel)>0.3";
            S = ds_sig.sumEntries(out.str().c_str());
            B = ds_con.sumEntries(out.str().c_str())*0.25;
            sig_eff_lh1[i]  = S/sig;
            back_reg_lh1[i] = (gen-B)/gen;
            S = nsig/sig*S;
//      B = nback/gen*B;
            signif_lh1[i] = S/sqrt(S+B+0.0001);
            if(lh1_best_sig<signif_lh1[i]) {
                lh1_best_sig = signif_lh1[i];
                lh1_best_cut = sqrt(1-i*dbdt*i*dbdt);
                lh1_best_pur = S/(S+B);
                lh1_best_eff = sig_eff_lh1[i];
                lh1_best_sup = back_reg_lh1[i];
            }
        }

        if(lh0_flag) {
            out.str("");
            out << "lh0>" << -1 +2*i*dbdt << " && abs(cos_thr)<1.";
            if(type == 14) out << " && abs(cos_hel)>0.3";
            S = ds_sig.sumEntries(out.str().c_str());
            B = ds_con.sumEntries(out.str().c_str())*0.25;
            sig_eff_lh0[i]  = S/sig;
            back_reg_lh0[i] = (gen-B)/gen;
            S = nsig/sig*S;
//      B = nback/gen*B;
            signif_lh0[i] = S/sqrt(S+B+0.0001);
            if(lh0_best_sig<signif_lh0[i]) {
                lh0_best_sig = signif_lh0[i];
                lh0_best_cut = sqrt(1-i*dbdt*i*dbdt);
                lh0_best_pur = S/(S+B);
                lh0_best_eff = sig_eff_lh0[i];
                lh0_best_sup = back_reg_lh0[i];
            }
        }

        if(bdtg_flag) {
            out.str("");
            out << "bdtg>sqrt(1-" << i*dbdt*i*dbdt << ")";
            S = ds_sig.sumEntries(out.str().c_str());
            B = ds_con.sumEntries(out.str().c_str())/0.949;
            sig_eff_bdtg[i]  = S/sig;
            back_reg_bdtg[i] = (gen-B)/gen;
            S = nsig/sig*S;
//      B = nback/gen*B;
            signif_bdtg[i] = S/sqrt(S+B+0.0001);
            if(bdtg_best_sig<signif_bdtg[i]) {
                bdtg_best_sig = signif_bdtg[i];
                bdtg_best_cut = sqrt(1-i*dbdt*i*dbdt);
                bdtg_best_pur = S/(S+B);
                bdtg_best_eff = sig_eff_bdtg[i];
                bdtg_best_sup = back_reg_bdtg[i];
            }
        }
    }

    TCanvas* c1 = new TCanvas("c1","Signal Efficiency vs. Background Rejection",600,600);
    TH1F* h1 = c1->Draw();
    c1->SetGrid();
    TMultiGraph *mg = new TMultiGraph();
    mg->SetTitle("Background Rejection");
    TGraph* gr_bdt = new TGraph(dots,sig_eff_bdt,back_reg_bdt);
    gr_bdt->SetMarkerSize(1);
    gr_bdt->SetMarkerColor(kBlue);
    gr_bdt->SetMarkerStyle(21);
    gr_bdt->SetTitle("Background Rejection");
    gr_bdt->GetXaxis()->SetRangeUser(eff_min,eff_max);
    gr_bdt->GetXaxis()->SetTitle("Signal Efficiency");
    gr_bdt->GetXaxis()->SetTitleSize(0.06);
    gr_bdt->GetXaxis()->SetTitleOffset(0.75);
    gr_bdt->GetYaxis()->SetRangeUser(rej_min,rej_max);

    TGraph* gr_bdtg = new TGraph(dots,sig_eff_bdtg,back_reg_bdtg);
    gr_bdtg->SetMarkerSize(1);
    gr_bdtg->SetMarkerColor(kRed);
    gr_bdtg->SetMarkerStyle(21);

    TGraph* gr_ksfw1 = new TGraph(dots,sig_eff_lh1,back_reg_lh1);
    gr_ksfw1->SetMarkerSize(1);
    gr_ksfw1->SetMarkerColor(kRed);
    gr_ksfw1->SetMarkerStyle(22);

    TGraph* gr_ksfw0 = new TGraph(dots,sig_eff_lh0,back_reg_lh0);
    gr_ksfw0->SetMarkerSize(1.4);
    gr_ksfw0->SetMarkerColor(kBlue);
    gr_ksfw0->SetMarkerStyle(22);
    gr_ksfw0->SetTitle("Background Rejection");
    gr_ksfw0->GetXaxis()->SetRangeUser(eff_min,eff_max);
    gr_ksfw0->GetXaxis()->SetTitle("Signal Efficiency");
    gr_ksfw0->GetXaxis()->SetTitleSize(0.06);
    gr_ksfw0->GetXaxis()->SetTitleOffset(0.75);
    gr_ksfw0->GetYaxis()->SetRangeUser(rej_min,rej_max);

    if(bdt_flag)mg->Add(gr_bdt);
    if(bdtg_flag)mg->Add(gr_bdtg);
    if(lh1_flag)mg->Add(gr_ksfw1);
    if(lh0_flag)mg->Add(gr_ksfw0);

    if(bdt_flag && !bdtg_flag && !lh1_flag && !lh0_flag) {
        gr_bdt->Draw("AP");
    } else if(lh0_flag && !bdtg_flag && !lh1_flag && !bdt_flag) {
        gr_ksfw0->Draw("AP");
    } else {
        mg->Draw("AP");
    }

    if(type<15) {
        TLine* cutline = new TLine(bdt_best_eff,rej_min,bdt_best_eff,rej_max);
        cutline->SetLineColor(kRed);
        cutline->SetLineWidth(2);
        cutline->Draw("AP");
    } else {
        TLine* cutline = new TLine(lh0_best_eff,rej_min,lh0_best_eff,rej_max);
        cutline->SetLineColor(kRed);
        cutline->SetLineWidth(2);
        cutline->Draw("AP");
    }

    TPaveText *pt = new TPaveText(0.7,0.75,0.98,0.9,"brNDC");
    pt->SetFillColor(0);
    pt->SetTextAlign(12);
    pt->AddText(label.c_str());
    out.str("");
    out << "Input S = " << nsig;
    pt->AddText(out.str().c_str());
    out.str("");
    out << "Input B = " << (int)gen;
    pt->AddText(out.str().c_str());
    pt->Draw();

    TPaveText *pt2 = new TPaveText(0.3,0.25,0.6,0.5,"brNDC");
    pt2->SetFillColor(0);
    pt2->SetTextAlign(12);
    pt2->AddText("Best cut:");
    if(type<15) {
        out.str("");
        out << setprecision(3);
        out << "Pur = " << bdt_best_pur*100;
        pt2->AddText(out.str().c_str());
        out.str("");
        out << "Eff = " << bdt_best_eff*100;
        pt2->AddText(out.str().c_str());
        out.str("");
        out << "Rej = " << bdt_best_sup*100;
        pt2->AddText(out.str().c_str());
        pt2->Draw();
    } else {
        out.str("");
        out << setprecision(3);
        out << "Pur = " << lh0_best_pur*100;
        pt2->AddText(out.str().c_str());
        out.str("");
        out << "Eff = " << lh0_best_eff*100;
        pt2->AddText(out.str().c_str());
        out.str("");
        out << "Rej = " << lh0_best_sup*100;
        pt2->AddText(out.str().c_str());
        pt2->Draw();
    }

    c1->Update();
    out.str("");
    out << "../Note/pics/eff-rej-m" << type << ".root";
    c1->Print(out.str().c_str());
    out.str("");
    out << "../Note/pics/eff-rej-m" << type << ".eps";
    c1->Print(out.str().c_str());

    TCanvas* c2 = new TCanvas("c2","Significance",600,600);
    c2->cd();
    c2->SetGrid();

    TMultiGraph *signif_mg = new TMultiGraph();
    signif_mg->SetTitle("Signal Significance");
    TGraph* signif_gr_bdt = new TGraph(dots,sig_eff_bdt,signif_bdt);
    signif_gr_bdt->SetMarkerSize(1);
    signif_gr_bdt->SetMarkerColor(kBlue);
    signif_gr_bdt->SetMarkerStyle(21);
    signif_gr_bdt->SetTitle("Signal Significance");
    signif_gr_bdt->GetXaxis()->SetRangeUser(eff_min,eff_max);
    signif_gr_bdt->GetXaxis()->SetTitle("Signal Efficiency");
    signif_gr_bdt->GetXaxis()->SetTitleSize(0.06);
    signif_gr_bdt->GetXaxis()->SetTitleOffset(0.75);
    signif_gr_bdt->GetYaxis()->SetRangeUser(signif_min,signif_max);

    TGraph* signif_gr_bdtg = new TGraph(dots,sig_eff_bdtg,signif_bdtg);
    signif_gr_bdtg->SetMarkerSize(1);
    signif_gr_bdtg->SetMarkerColor(kRed);
    signif_gr_bdtg->SetMarkerStyle(21);

    TGraph* signif_gr_ksfw1 = new TGraph(dots,sig_eff_lh1,signif_lh1);
    signif_gr_ksfw1->SetMarkerSize(1);
    signif_gr_ksfw1->SetMarkerColor(kRed);
    signif_gr_ksfw1->SetMarkerStyle(22);

    TGraph* signif_gr_ksfw0 = new TGraph(dots,sig_eff_lh0,signif_lh0);
    signif_gr_ksfw0->SetMarkerSize(1.4);
    signif_gr_ksfw0->SetMarkerColor(kBlue);
    signif_gr_ksfw0->SetMarkerStyle(22);
    signif_gr_ksfw0->SetTitle("Signal Significance");
    signif_gr_ksfw0->GetXaxis()->SetRangeUser(eff_min,eff_max);
    signif_gr_ksfw0->GetXaxis()->SetTitle("Signal Efficiency");
    signif_gr_ksfw0->GetXaxis()->SetTitleSize(0.06);
    signif_gr_ksfw0->GetXaxis()->SetTitleOffset(0.75);
    signif_gr_ksfw0->GetYaxis()->SetRangeUser(signif_min,signif_max);

    if(bdt_flag)  signif_mg->Add(signif_gr_bdt);
    if(bdtg_flag) signif_mg->Add(signif_gr_bdtg);
    if(lh1_flag)  signif_mg->Add(signif_gr_ksfw1);
    if(lh0_flag)  signif_mg->Add(signif_gr_ksfw0);

    if(bdt_flag && !bdtg_flag && !lh1_flag && !lh0_flag) {
        signif_gr_bdt->Draw("AP");
    } else if(!bdt_flag && !bdtg_flag && !lh1_flag && lh0_flag) {
        signif_gr_ksfw0->Draw("AP");
    } else {
        signif_mg->Draw("AP");
    }
    if(type<15) {
        TLine* cutline2 = new TLine(bdt_best_eff,signif_min,bdt_best_eff,signif_max);
        cutline2->SetLineColor(kRed);
        cutline2->SetLineWidth(2);
        cutline2->Draw("AP");
    } else {
        TLine* cutline2 = new TLine(lh0_best_eff,signif_min,lh0_best_eff,signif_max);
        cutline2->SetLineColor(kRed);
        cutline2->SetLineWidth(2);
        cutline2->Draw("AP");
    }

    pt->Draw();
    pt2->Draw();

    c2->Update();
    out.str("");
    out << "../Note/pics/eff-fom-m" << type << ".root";
    c2->Print(out.str().c_str());
    out.str("");
    out << "../Note/pics/eff-fom-m" << type << ".eps";
    c2->Print(out.str().c_str());

    cout << "Summary:" << endl;

    if(bdtg_flag) {
        cout << "bdtg decision: ";
        cout << "sig: "   << bdtg_best_sig;
        cout << ", cut: " << bdtg_best_cut;
        cout << ", pur: " << bdtg_best_pur;
        cout << ", eff: " << bdtg_best_eff;
        cout << ", sup: " << bdtg_best_sup << endl;
    }
    if(bdt_flag) {
        cout << "bdt decision:  ";
        cout << "sig: "   << bdt_best_sig;
        cout << ", cut: " << bdt_best_cut;
        cout << ", pur: " << bdt_best_pur;
        cout << ", eff: " << bdt_best_eff;
        cout << ", sup: " << bdt_best_sup << endl;
    }
    if(lh1_flag) {
        cout << "lh1 decision:  ";
        cout << "sig: "   << lh1_best_sig;
        cout << ", cut: " << lh1_best_cut;
        cout << ", pur: " << lh1_best_pur;
        cout << ", eff: " << lh1_best_eff;
        cout << ", sup: " << lh1_best_sup << endl;
    }
    if(lh0_flag) {
        cout << "lh0 decision:  ";
        cout << "sig: "   << lh0_best_sig;
        cout << ", cut: " << lh0_best_cut;
        cout << ", pur: " << lh0_best_pur;
        cout << ", eff: " << lh0_best_eff;
        cout << ", sup: " << lh0_best_sup << endl;
    }

    return;
}
Example #22
0
void plot(TString hname, TString legpos, TString pdfname, TString pdfmode="", Int_t rebinFactor=2)
{
	TGraphAsymmErrors* gJES = new TGraphAsymmErrors(); gJES->GetXaxis()->SetTitle(histos1[hname+"_calib"]->GetXaxis()->GetTitle()); gJES->GetYaxis()->SetTitle("Normalized"); gJES->SetTitle(histos1[hname+"_calib"]->GetTitle()); 
	TGraphAsymmErrors* gJER = new TGraphAsymmErrors(); gJER->GetXaxis()->SetTitle(histos1[hname+"_calib"]->GetXaxis()->GetTitle()); gJER->GetYaxis()->SetTitle("Normalized"); gJER->SetTitle(histos1[hname+"_calib"]->GetTitle()); 
	TGraphAsymmErrors* gTOT = new TGraphAsymmErrors(); gTOT->GetXaxis()->SetTitle(histos1[hname+"_calib"]->GetXaxis()->GetTitle()); gTOT->GetYaxis()->SetTitle("Normalized"); gTOT->SetTitle(histos1[hname+"_calib"]->GetTitle()); 

	Double_t entries_calib = 0;
	for(Int_t i=1 ; i<=histos1[hname+"_calib"]->GetNbinsX() ; i++) entries_calib+=histos1[hname+"_calib"]->GetBinContent(i);
	Double_t entries_uncalib = 0;
	for(Int_t i=1 ; i<=histos1[hname+"_uncalib"]->GetNbinsX() ; i++) entries_uncalib+=histos1[hname+"_uncalib"]->GetBinContent(i);

	histos1[hname+"_uncalib"]->Rebin(rebinFactor);
	histos1[hname+"_calib"]->Rebin(rebinFactor);
	histos1[hname+"_JESUP"]->Rebin(rebinFactor);
	histos1[hname+"_JESDWN"]->Rebin(rebinFactor);
	histos1[hname+"_JERUP"]->Rebin(rebinFactor);
	histos1[hname+"_JERDWN"]->Rebin(rebinFactor);

	for(Int_t i=1 ; i<=histos1[hname+"_calib"]->GetNbinsX() ; i++)
	{
		float x = histos1[hname+"_calib"]->GetBinCenter(i);
		float y = histos1[hname+"_calib"]->GetBinContent(i)/entries_calib;
		float dx = histos1[hname+"_calib"]->GetBinWidth(i)/2;

		gJES->SetPoint(i-1, x, y);
		gJER->SetPoint(i-1, x, y);
		gTOT->SetPoint(i-1, x, y);
		
		float dyJES1 = fabs(y-histos1[hname+"_JESUP"]->GetBinContent(i)/entries_calib);
		float dyJES2 = fabs(y-histos1[hname+"_JESDWN"]->GetBinContent(i)/entries_calib);
		float dyJES  = (dyJES1>dyJES2) ? dyJES1 : dyJES2;
		float yErrDwnJES = dyJES;
		float yErrUpJES  = dyJES;

		if((y-yErrDwnJES)<0.) yErrDwnJES = 0.;
		gJES->SetPointError(i-1, dx,dx, yErrDwnJES,yErrUpJES);
		
		float dyJER1 = fabs(y-histos1[hname+"_JERUP"]->GetBinContent(i)/entries_calib);
		float dyJER2 = fabs(y-histos1[hname+"_JERDWN"]->GetBinContent(i)/entries_calib);
		float dyJER  = (dyJER1>dyJER2) ? dyJER1 : dyJER2;
		float yErrDwnJER = dyJER;
		float yErrUpJER  = dyJER;

		if((y-yErrDwnJER)<0.) yErrDwnJER = 0.;
		gJER->SetPointError(i-1, dx,dx, yErrDwnJER,yErrUpJER);
		
		
		float yErrDwnTOT = sqrt(yErrDwnJES*yErrDwnJES + yErrDwnJER*yErrDwnJER);
		float yErrUpTOT  = sqrt(yErrUpJES*yErrUpJES + yErrUpJER*yErrUpJER);
		if((y-yErrDwnTOT)<0.) yErrDwnTOT = 0.;
		gTOT->SetPointError(i-1, dx,dx, yErrDwnTOT,yErrUpTOT);
	}
	
	gTOT->SetFillColor(kRed); gTOT->SetLineColor(kRed);
	gTOT->SetFillColor(kRed); gTOT->SetLineColor(kRed);
	
	gJER->SetFillColor(kYellow); gJER->SetLineColor(kYellow);
	gJER->SetFillColor(kYellow); gJER->SetLineColor(kYellow);

	gJES->SetFillColor(kGreen); gJES->SetLineColor(kGreen);
	gJES->SetFillColor(kGreen); gJES->SetLineColor(kGreen);
	
	TMultiGraph *mgBands = new TMultiGraph();
	mgBands->Add(gTOT);
	mgBands->Add(gJER);
	mgBands->Add(gJES);
	
	
	TLegend* legLeft = new TLegend(0.12,0.65,0.42,0.85,NULL,"brNDC");
	legLeft->SetFillStyle(4000); //will be transparent
	legLeft->SetFillColor(0);
	legLeft->SetTextFont(42);
	legLeft->SetBorderSize(0);
	legLeft->AddEntry(histos1[hname+"_calib"], "Calibrated jets","ple");
	legLeft->AddEntry(histos1[hname+"_uncalib"], "Non calibrated jets","ple");
	legLeft->AddEntry(gJES, "JES uncertainty","f");
	legLeft->AddEntry(gJER, "JER uncertainty","f");
	legLeft->AddEntry(gTOT, "Total uncertainty","f");
	
	
	TLegend* legRight = new TLegend(0.5,0.65,0.8,0.85,NULL,"brNDC");
	legRight->SetFillStyle(4000); //will be transparent
	legRight->SetFillColor(0);
	legRight->SetTextFont(42);
	legRight->SetBorderSize(0);
	legRight->AddEntry(histos1[hname+"_calib"], "Calibrated jets","ple");
	legRight->AddEntry(histos1[hname+"_uncalib"], "Non calibrated jets","ple");
	legRight->AddEntry(gJES, "JES uncertainty","f");
	legRight->AddEntry(gJER, "JER uncertainty","f");
	legRight->AddEntry(gTOT, "Total uncertainty","f");
	
	histos1[hname+"_calib"]->Scale(1./entries_calib);
	histos1[hname+"_uncalib"]->Scale(1./entries_uncalib);
	
	TCanvas* cnv = new TCanvas("c","c",600,400);
	cnv->Draw();
	cnv->SetTicks(1,1);
	cnv->cd();
	histos1[hname+"_calib"]->Draw("p");
	mgBands->Draw("a2");
	mgBands->GetXaxis()->SetTitle(histos1[hname+"_calib"]->GetXaxis()->GetTitle());
	mgBands->GetYaxis()->SetTitle("Normalized");
	mgBands->SetTitle(histos1[hname+"_calib"]->GetTitle());
	histos1[hname+"_uncalib"]->GetYaxis()->SetTitle("Normalized");
	histos1[hname+"_uncalib"]->Draw("p same");
	histos1[hname+"_calib"]->GetYaxis()->SetTitle("Normalized");
	histos1[hname+"_calib"]->Draw("p same");
	if(legpos=="left")  legLeft->Draw("same");
	if(legpos=="right") legRight->Draw("same");
	ptxt->Draw("same");
	
	cnv->RedrawAxis();
	cnv->Update();
	TString pngname = "figures/syst."+hname+".png"; pngname.ReplaceAll("calib_","");
	TString epsname = "figures/syst."+hname+".eps"; epsname.ReplaceAll("calib_","");
	cnv->SaveAs(pngname);
	cnv->SaveAs(epsname);
	cnv->SaveAs(pdfname+pdfmode);
	
	delete gJES;
	delete gJER;
	delete gTOT;
	delete mgBands;
	delete legLeft;
	delete legRight;
	delete cnv;
}
Example #23
0
void final_fit() {

  TGraph *g1 = new TGraph("2013-02-01-beam-off-clean.dat","%lg %*lg %*lg %*lg %lg"," ");
  TGraph *g2 = new TGraph("2013-02-15-beam-off-clean.dat","%lg %*lg %*lg %*lg %lg"," ");
  TGraph *g3 = new TGraph("2013-02-28-beam-off_clean.dat","%lg %*lg %*lg %*lg %lg"," ");

  TMultiGraph *mg = new TMultiGraph();
  mg->Add(g1,"g1");
  mg->Add(g2,"g2");
  mg->Add(g3,"g3");
  
  TGraph *cernGraph = new TGraph("CERN_guessed_data.dat");
  TMultiGraph *mgaxes = new TMultiGraph();
  mgaxes->Add(g1,"g12");
  mgaxes->Add(g2,"g22");
  mgaxes->Add(g3,"g32");
  mgaxes->Add(cernGraph,"cernGraph");
  
  // Creates a Root function based on function fitf above
  // TF1 *func = new TF1("fitf",fitf,1E9,1E12,2);
  // TF1 *func2 = new TF1("fitf",fitf,4E12,5E14,2);
  TF1 *lambertfunc = new TF1("fitLambertW",fitLambertW,2e13,5E15,3);
  TF1 *lambertCERNfunc = new TF1("fitLambertW",fitLambertW,5e12,1E16,3);
  // TF1 *func2 = new TF1("fitLambertW",fitf,1E13,1.1E16,3);

  // Sets initial values (guesses)
  // func->SetParameters(0.5,0); 
  // func2->SetParameters(0.5,0);
  // lambertfunc->SetParameters(4.27e-11,0.83,4.9e-6); // Based on the other straight line
  // lambertfunc->SetParameters(1.9e-17,1.279,1.1e-5);
  lambertCERNfunc->SetParameters(4.27e-18,1.289,4.9e-6); // Based on initial fits
  lambertfunc->SetParameters(4.27e-18,1.289,4.9e-6); // Based on CERN paper

  // Fit histogram in range defined by function

  // h2->Fit(func2,"r+");

  // lambertCERNfunc->SetLineColor(4);
  // lambertCERNfunc->SetLineWidth(2);
  // lambertCERNfunc->SetLineStyle(2);

  mg->Fit(lambertfunc,"m+");
  TCanvas *c1 = new TCanvas("c1","c1",800,800);
  mgaxes->SetTitle("Final Fit (with CERN data in black)");
  mgaxes->Draw("a");
  // mgaxes->SetTicks(2,2);


  g1->Draw("*");
  g1->SetMarkerStyle(3);
  g1->SetMarkerColor(kRed);

  g2->Draw("*");
  g2->SetMarkerStyle(25);
  g2->SetMarkerColor(kBlue);
  
  g3->Draw("*");
  g3->SetMarkerStyle(27);
  g3->SetMarkerColor(kGreen+3);
  
  lambertfunc->Draw("same");

  cernGraph->Draw("*");
  lambertCERNfunc->Draw("same");
  lambertCERNfunc->SetLineColor(kBlack);
  
  // TH2F *hpx = new TH2F("hpx"," Forward Voltage V_{F} vs. Fluence n_{eq} (with CERN data)",10,1E10,6.4E16,100,0.2,210.0);
  // // axis range
  // hpx->SetStats(kFALSE);// no statistics
  // hpx->Draw();
  // g1->SetTitle("Fluence vs. Forward Voltage");
  // g1->SetFillColor(1);
  // g1->SetMarkerStyle(3);



  // g1->Fit(func,"r");
  // g1->Fit(lambertfunc,"r+");
  // c1->Divide(1,2);
  // c1->cd(1);
  // h2->SetMarkerStyle(2);
  // h2->SetMarkerSize(0.6);
  // h2->Draw(); 			// minor change

  // c1->cd(2);
  // cernGraph->Draw("*");
  // cernGraph->SetMarkerStyle(4);
  // cernGraph->GetXaxis()->SetRangeUser(5E10,6.4E20);// axis1->Draw("same");
  // g1->Draw("*");
  // g1->GetXaxis()->SetRangeUser(5E10,6.4E20);// axis1->Draw("same");


  // lambertCERNfunc->Draw("same");
  // g1->Draw();
  // c1->cd(2);
  // lambertfunc->Draw();


  c1->SetLogx(1);		// Set Log scale in x
  c1->SetLogy(1);		// Set Log scale in y
  c1->SetTicks(2,2);		// This is for the ticks on both sides
  c1->SetGrid(1);
}
Example #24
0
void plot( TString stream  = "MuTau", 
	   TString channel = "SM0",
	   TString legend  = "#tau_{#mu}#tau_{h}",
	   Float_t xMax_   = 50){

  TCanvas *c1 = new TCanvas("c1","",5,30,650,600);
  c1->SetGrid(0,0);
  c1->SetFillStyle(4000);
  c1->SetFillColor(10);
  c1->SetTicky();
  c1->SetObjectStat(0);
  
  TLegend* leg = new TLegend(0.14,0.60,0.41,0.85,NULL,"brNDC");
  leg->SetBorderSize(0);
  leg->SetTextSize(0.03);
  leg->SetFillColor(0);


  float X[]        = {110,115,120,125,130,135,140,145};

  float obsY[]     = {0.,0.,0.,0.,0.,0.,0.,0.};
  float expY[]     = {0.,0.,0.,0.,0.,0.,0.,0.};

  float expX1sL[]  = {0.,0.,0.,0.,0.,0.,0.,0.};
  float expX1sH[]  = {0.,0.,0.,0.,0.,0.,0.,0.};
  float expY1sL[]  = {0.,0.,0.,0.,0.,0.,0.,0.};
  float expY1sH[]  = {0.,0.,0.,0.,0.,0.,0.,0.};

  float expX2sL[]  = {0.,0.,0.,0.,0.,0.,0.,0.};
  float expX2sH[]  = {0.,0.,0.,0.,0.,0.,0.,0.};
  float expY2sL[]  = {0.,0.,0.,0.,0.,0.,0.,0.};
  float expY2sH[]  = {0.,0.,0.,0.,0.,0.,0.,0.};

  int nMassPoints = 8;

  for(unsigned int i = 0 ; i < nMassPoints; i++){

    TFile f(Form("higgsCombine%s%s.Asymptotic.mH%.0f.root",stream.Data(),channel.Data(),X[i]),"READ");
    if(f.IsZombie()){
      cout << "Cannot open file for " << string(channel.Data()) << " and mass " << X[i] << endl;
      continue;
    }

    Double_t r;
    TTree* limit = (TTree*)f.Get("limit");
    limit->SetBranchAddress("limit",&r);

    for(int k = 0 ; k< limit->GetEntries() ; k++){
      limit->GetEntry(k);
      if(k==0) expY2sL[i] = r;
      if(k==1) expY1sL[i] = r;
      if(k==2) expY[i]    = r;
      if(k==3) expY1sH[i] = r;
      if(k==4) expY2sH[i] = r;
      if(k==5) obsY[i]    = r;
    }

  }
 


  for(int i = 0 ; i < nMassPoints ; i++){
    expY1sH[i] = TMath::Abs(expY1sH[i]-expY[i]);
    expY1sL[i] = TMath::Abs(expY1sL[i]-expY[i]);
    expY2sH[i] = TMath::Abs(expY2sH[i]-expY[i]);
    expY2sL[i] = TMath::Abs(expY2sL[i]-expY[i]);

    cout << "Mass " << X[i] << " => " << expY2sL[i] << ", " << expY1sL[i] << ", " << expY1sH[i] << ", "
	 << expY2sH[i] << ", " << endl;
  }

  TMultiGraph *mg = new TMultiGraph();
  mg->SetTitle("");

  TGraphAsymmErrors* expected = new TGraphAsymmErrors(nMassPoints, X, expY, expX1sL ,expX1sL , expX1sL, expX1sL);
  TGraphAsymmErrors* oneSigma = new TGraphAsymmErrors(nMassPoints, X, expY, expX1sL, expX1sL,  expY1sL, expY1sH);
  TGraphAsymmErrors* twoSigma = new TGraphAsymmErrors(nMassPoints, X, expY, expX2sL, expX2sL,  expY2sL, expY2sH);
  TGraphAsymmErrors* observed = new TGraphAsymmErrors(nMassPoints, X, obsY, expX1sL ,expX1sL , expX1sL, expX1sL);

 
  oneSigma->SetMarkerColor(kBlack);
  oneSigma->SetMarkerStyle(kFullCircle);
  oneSigma->SetFillColor(kGreen);
  oneSigma->SetFillStyle(1001);

  twoSigma->SetMarkerColor(kBlack);
  twoSigma->SetMarkerStyle(kFullCircle);
  twoSigma->SetFillColor(kYellow);
  twoSigma->SetFillStyle(1001);

  expected->SetMarkerColor(kBlack);
  expected->SetMarkerStyle(kFullCircle);
  expected->SetMarkerSize(1.5);
  expected->SetLineColor(kBlack);
  expected->SetLineWidth(2);

  observed->SetMarkerColor(kBlue);
  observed->SetMarkerStyle(1);
  observed->SetLineColor(kBlue);
  observed->SetLineWidth(4);

  mg->Add(twoSigma);
  mg->Add(oneSigma);
  mg->Add(expected);
  mg->Add(observed);

  mg->Draw("ALP3");

  c1->cd();
  gPad->Modified();
  mg->GetXaxis()->SetLimits(110,145);
  mg->GetYaxis()->SetTitleOffset(0.97);
  mg->SetMinimum(0.);
  mg->SetMaximum(xMax_);
  mg->GetXaxis()->SetTitle("m_{H} (GeV)");
  mg->GetYaxis()->SetTitle("#sigma X BR(H#rightarrow#tau#tau)_{95% CLs}/#sigma_{SM}");

  leg->SetHeader(Form("#splitline{CMS Preliminary #sqrt{s}=7 TeV}{4.6 fb^{-1}, %s}",legend.Data()));

  leg->AddEntry(expected,"Expected","P");
  leg->AddEntry(observed,"Observed","L");

  leg->Draw();

  TF1 *line = new TF1("line","1",100,150);
  line->SetLineColor(kRed);
  line->SetLineWidth(2);

  line->Draw("SAME");

  gPad->SaveAs(Form("limit_%s_%s.png",stream.Data(), channel.Data()));
  gPad->SaveAs(Form("limit_%s_%s.pdf",stream.Data(), channel.Data()));

}
void Final_av_Lambda_VarCoupling_40Percent()
{
//=========Macro generated from canvas: c/c
//=========  (Sat Feb 27 17:06:04 2016) by ROOT version6.04/06
   TCanvas *c = new TCanvas("c", "c",0,0,800,700);
   c->SetHighLightColor(2);
   c->Range(-0.4813593,1.36281,3.148656,6.672724);
   c->SetFillColor(0);
   c->SetBorderMode(0);
   c->SetBorderSize(2);
   c->SetLogx();
   c->SetLogy();
   c->SetTickx(1);
   c->SetTicky(1);
   c->SetLeftMargin(0.12);
   c->SetRightMargin(0.04);
   c->SetTopMargin(0.07);
   c->SetBottomMargin(0.12);
   c->SetFrameBorderMode(0);
   c->SetFrameBorderMode(0);
   
   TMultiGraph *multigraph = new TMultiGraph();
   multigraph->SetName("");
   multigraph->SetTitle("");
   
   Double_t Graph_fx1[12] = {
   1,
   10,
   100,
   400,
   700,
   1000,
   1000,
   700,
   400,
   100,
   10,
   1};
   Double_t Graph_fy1[12] = {
   881.525,
   896.549,
   871.907,
   667.806,
   471.744,
   308.777,
   382.832,
   584.437,
   826.374,
   1079.16,
   1110.85,
   1092.23};
   TGraph *graph = new TGraph(12,Graph_fx1,Graph_fy1);
   graph->SetName("Graph");
   graph->SetTitle("");

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#ffcc00");
   graph->SetFillColor(ci);

   ci = TColor::GetColor("#ff6666");
   graph->SetLineColor(ci);
   graph->SetLineWidth(3);
   
   TH1F *Graph_Graph1 = new TH1F("Graph_Graph1","",100,0.9,1099.9);
   Graph_Graph1->SetMinimum(228.5697);
   Graph_Graph1->SetMaximum(1191.057);
   Graph_Graph1->SetDirectory(0);
   Graph_Graph1->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1->SetLineColor(ci);
   Graph_Graph1->GetXaxis()->SetLabelFont(42);
   Graph_Graph1->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1->GetXaxis()->SetTitleFont(42);
   Graph_Graph1->GetYaxis()->SetLabelFont(42);
   Graph_Graph1->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1->GetYaxis()->SetTitleFont(42);
   Graph_Graph1->GetZaxis()->SetLabelFont(42);
   Graph_Graph1->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1->GetZaxis()->SetTitleFont(42);
   graph->SetHistogram(Graph_Graph1);
   
   multigraph->Add(graph,"");
   multigraph->Draw("af");
   multigraph->GetXaxis()->SetTitle("M_{#chi} (GeV)");
   multigraph->GetXaxis()->SetRange(0,96);
   multigraph->GetXaxis()->SetLabelFont(42);
   multigraph->GetXaxis()->SetTitleSize(0.05);
   multigraph->GetXaxis()->SetTitleOffset(1.1);
   multigraph->GetXaxis()->SetTitleFont(42);
   multigraph->GetYaxis()->SetTitle("#Lambda (GeV)");
   multigraph->GetYaxis()->SetLabelFont(42);
   multigraph->GetYaxis()->SetTitleSize(0.05);
   multigraph->GetYaxis()->SetTitleOffset(1.05);
   multigraph->GetYaxis()->SetTitleFont(42);
   
   multigraph = new TMultiGraph();
   multigraph->SetName("");
   multigraph->SetTitle("");
   
   Double_t Graph_fx2[6] = {
   1,
   10,
   100,
   400,
   700,
   1000};
   Double_t Graph_fy2[6] = {
   1092.23,
   1110.85,
   1079.16,
   826.374,
   584.437,
   382.832};
   graph = new TGraph(6,Graph_fx2,Graph_fy2);
   graph->SetName("Graph");
   graph->SetTitle("Graph");
   graph->SetFillColor(1);

   ci = TColor::GetColor("#ff6666");
   graph->SetLineColor(ci);
   
   TH1F *Graph_Graph2 = new TH1F("Graph_Graph2","Graph",100,0.9,1099.9);
   Graph_Graph2->SetMinimum(310.0302);
   Graph_Graph2->SetMaximum(1183.652);
   Graph_Graph2->SetDirectory(0);
   Graph_Graph2->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph2->SetLineColor(ci);
   Graph_Graph2->GetXaxis()->SetLabelFont(42);
   Graph_Graph2->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph2->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph2->GetXaxis()->SetTitleFont(42);
   Graph_Graph2->GetYaxis()->SetLabelFont(42);
   Graph_Graph2->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph2->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph2->GetYaxis()->SetTitleFont(42);
   Graph_Graph2->GetZaxis()->SetLabelFont(42);
   Graph_Graph2->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph2->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph2->GetZaxis()->SetTitleFont(42);
   graph->SetHistogram(Graph_Graph2);
   
   multigraph->Add(graph,"");
   
   Double_t Graph_fx3[6] = {
   1,
   10,
   100,
   400,
   700,
   1000};
   Double_t Graph_fy3[6] = {
   980.038,
   996.742,
   968.943,
   742.067,
   524.44,
   343.371};
   graph = new TGraph(6,Graph_fx3,Graph_fy3);
   graph->SetName("Graph");
   graph->SetTitle("Graph");
   graph->SetFillColor(1);

   ci = TColor::GetColor("#ff6666");
   graph->SetLineColor(ci);
   graph->SetLineWidth(3);
   
   TH1F *Graph_Graph3 = new TH1F("Graph_Graph3","Graph",100,0.9,1099.9);
   Graph_Graph3->SetMinimum(278.0339);
   Graph_Graph3->SetMaximum(1062.079);
   Graph_Graph3->SetDirectory(0);
   Graph_Graph3->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph3->SetLineColor(ci);
   Graph_Graph3->GetXaxis()->SetLabelFont(42);
   Graph_Graph3->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph3->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph3->GetXaxis()->SetTitleFont(42);
   Graph_Graph3->GetYaxis()->SetLabelFont(42);
   Graph_Graph3->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph3->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph3->GetYaxis()->SetTitleFont(42);
   Graph_Graph3->GetZaxis()->SetLabelFont(42);
   Graph_Graph3->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph3->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph3->GetZaxis()->SetTitleFont(42);
   graph->SetHistogram(Graph_Graph3);
   
   multigraph->Add(graph,"");
   
   Double_t Graph_fx4[6] = {
   1,
   10,
   100,
   400,
   700,
   1000};
   Double_t Graph_fy4[6] = {
   881.525,
   896.549,
   871.907,
   667.806,
   471.744,
   308.777};
   graph = new TGraph(6,Graph_fx4,Graph_fy4);
   graph->SetName("Graph");
   graph->SetTitle("Graph");
   graph->SetFillColor(1);

   ci = TColor::GetColor("#ff6666");
   graph->SetLineColor(ci);
   
   TH1F *Graph_Graph4 = new TH1F("Graph_Graph4","Graph",100,0.9,1099.9);
   Graph_Graph4->SetMinimum(249.9998);
   Graph_Graph4->SetMaximum(955.3262);
   Graph_Graph4->SetDirectory(0);
   Graph_Graph4->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph4->SetLineColor(ci);
   Graph_Graph4->GetXaxis()->SetLabelFont(42);
   Graph_Graph4->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph4->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph4->GetXaxis()->SetTitleFont(42);
   Graph_Graph4->GetYaxis()->SetLabelFont(42);
   Graph_Graph4->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph4->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph4->GetYaxis()->SetTitleFont(42);
   Graph_Graph4->GetZaxis()->SetLabelFont(42);
   Graph_Graph4->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph4->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph4->GetZaxis()->SetTitleFont(42);
   graph->SetHistogram(Graph_Graph4);
   
   multigraph->Add(graph,"");
   
   Double_t Graph_fx5[6] = {
   1,
   10,
   100,
   400,
   700,
   1000};
   Double_t Graph_fy5[6] = {
   1028.6,
   1012.32,
   1016.7,
   751.989,
   524.44,
   360.443};
   graph = new TGraph(6,Graph_fx5,Graph_fy5);
   graph->SetName("Graph");
   graph->SetTitle("Graph");
   graph->SetFillColor(1);

   ci = TColor::GetColor("#0000ff");
   graph->SetLineColor(ci);
   graph->SetLineWidth(3);
   
   TH1F *Graph_Graph5 = new TH1F("Graph_Graph5","Graph",100,0.9,1099.9);
   Graph_Graph5->SetMinimum(293.6273);
   Graph_Graph5->SetMaximum(1095.416);
   Graph_Graph5->SetDirectory(0);
   Graph_Graph5->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph5->SetLineColor(ci);
   Graph_Graph5->GetXaxis()->SetLabelFont(42);
   Graph_Graph5->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph5->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph5->GetXaxis()->SetTitleFont(42);
   Graph_Graph5->GetYaxis()->SetLabelFont(42);
   Graph_Graph5->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph5->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph5->GetYaxis()->SetTitleFont(42);
   Graph_Graph5->GetZaxis()->SetLabelFont(42);
   Graph_Graph5->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph5->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph5->GetZaxis()->SetTitleFont(42);
   graph->SetHistogram(Graph_Graph5);
   
   multigraph->Add(graph,"");
   
   Double_t Graph_fx6[35] = {
   3.981,
   4.365,
   4.786,
   5.248,
   5.754,
   6.31,
   6.918,
   7.586,
   8.318,
   9.12,
   10,
   10.965,
   12.023,
   13.183,
   14.454,
   15.849,
   17.378,
   19.055,
   20.893,
   22.909,
   25.119,
   31.623,
   39.811,
   50.119,
   63.096,
   79.433,
   100,
   125.893,
   158.489,
   199.526,
   251.189,
   316.228,
   1000,
   3162.278,
   10000};
   Double_t Graph_fy6[35] = {
   19.76533,
   32.58338,
   47.96959,
   63.10164,
   79.00995,
   95.55754,
   111.9766,
   129.0118,
   146.2376,
   163.5577,
   179.3658,
   194.9584,
   209.5672,
   223.2999,
   236.0683,
   247.7404,
   258.366,
   268.0662,
   277.1383,
   285.1146,
   292.3901,
   306.3527,
   314.441,
   317.1059,
   314.8684,
   308.9039,
   300.2537,
   289.8022,
   278.2241,
   266.1082,
   253.7422,
   241.4337,
   184.6404,
   139.2985,
   104.656};
   graph = new TGraph(35,Graph_fx6,Graph_fy6);
   graph->SetName("Graph");
   graph->SetTitle("Graph");
   graph->SetFillColor(1);

   ci = TColor::GetColor("#6666ff");
   graph->SetLineColor(ci);
   graph->SetLineStyle(6);
   graph->SetLineWidth(3);
   
   TH1F *Graph_Graph6 = new TH1F("Graph_Graph6","Graph",100,3.5829,10999.6);
   Graph_Graph6->SetMinimum(17.78879);
   Graph_Graph6->SetMaximum(346.84);
   Graph_Graph6->SetDirectory(0);
   Graph_Graph6->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph6->SetLineColor(ci);
   Graph_Graph6->GetXaxis()->SetLabelFont(42);
   Graph_Graph6->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph6->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph6->GetXaxis()->SetTitleFont(42);
   Graph_Graph6->GetYaxis()->SetLabelFont(42);
   Graph_Graph6->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph6->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph6->GetYaxis()->SetTitleFont(42);
   Graph_Graph6->GetZaxis()->SetLabelFont(42);
   Graph_Graph6->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph6->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph6->GetZaxis()->SetTitleFont(42);
   graph->SetHistogram(Graph_Graph6);
   
   multigraph->Add(graph,"");
   
   Double_t Graph_fx7[33] = {
   5.050109,
   5.570498,
   6.092375,
   6.79836,
   7.629504,
   8.933253,
   10.64203,
   12.05014,
   13.68495,
   14.93901,
   17.1131,
   19.54765,
   22.0792,
   25.65551,
   29.39341,
   34.84152,
   41.41884,
   48.68491,
   59.2071,
   75.34994,
   97.26741,
   131.0246,
   163.9459,
   202.8261,
   243.2248,
   309.5828,
   383.0166,
   473.8718,
   622.2993,
   833.6,
   1028.448,
   1283.339,
   2026.806};
   Double_t Graph_fy7[33] = {
   71.77067,
   88.82209,
   110.1401,
   130.7052,
   154.2557,
   185.7482,
   213.1504,
   232.735,
   248.5277,
   258.1632,
   268.4587,
   280.1818,
   286.5229,
   293.3758,
   296.7995,
   299.6924,
   299.6947,
   297.0875,
   293.2892,
   285.6511,
   275.8293,
   262.4571,
   252.7364,
   243.3346,
   234.001,
   222.0121,
   212.1495,
   202.5032,
   189.9106,
   177.908,
   168.9168,
   159.7122,
   142.9221};
   graph = new TGraph(33,Graph_fx7,Graph_fy7);
   graph->SetName("Graph");
   graph->SetTitle("Graph");
   graph->SetFillColor(1);

   ci = TColor::GetColor("#ff9900");
   graph->SetLineColor(ci);
   graph->SetLineStyle(2);
   graph->SetLineWidth(3);
   
   TH1F *Graph_Graph7 = new TH1F("Graph_Graph7","Graph",100,4.545098,2228.982);
   Graph_Graph7->SetMinimum(48.97827);
   Graph_Graph7->SetMaximum(322.4871);
   Graph_Graph7->SetDirectory(0);
   Graph_Graph7->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph7->SetLineColor(ci);
   Graph_Graph7->GetXaxis()->SetLabelFont(42);
   Graph_Graph7->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph7->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph7->GetXaxis()->SetTitleFont(42);
   Graph_Graph7->GetYaxis()->SetLabelFont(42);
   Graph_Graph7->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph7->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph7->GetYaxis()->SetTitleFont(42);
   Graph_Graph7->GetZaxis()->SetLabelFont(42);
   Graph_Graph7->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph7->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph7->GetZaxis()->SetTitleFont(42);
   graph->SetHistogram(Graph_Graph7);
   
   multigraph->Add(graph,"");
   
   Double_t Graph_fx8[90] = {
   18.74425,
   19.90368,
   20.73627,
   21.82644,
   23.00752,
   24.07546,
   25.0827,
   25.71454,
   26.71212,
   27.99356,
   28.53122,
   29.59491,
   30.69819,
   31.93543,
   33.71249,
   35.53626,
   36.69926,
   39.48566,
   41.74415,
   44.52103,
   47.27444,
   49.54151,
   51.99283,
   54.56543,
   56.59926,
   59.57426,
   61.97591,
   64.94736,
   67.7638,
   72.165,
   77.52983,
   78.67276,
   79.25885,
   79.50015,
   79.8577,
   79.98559,
   80.10781,
   80.93361,
   82.97299,
   85.0636,
   87.3346,
   89.6657,
   93.68976,
   97.60831,
   101.0972,
   103.4923,
   107.3498,
   111.0254,
   114.4909,
   118.2376,
   120.3333,
   131.3772,
   140.9375,
   145.9754,
   148.1289,
   150.9739,
   154.3249,
   158.6761,
   165.3121,
   170.7206,
   172.2259,
   173.4824,
   174.2374,
   175.2489,
   175.7591,
   179.6599,
   186.3538,
   196.4347,
   207.6675,
   217.3037,
   228.0541,
   241.4457,
   256.7473,
   271.0309,
   292.4573,
   319.2919,
   352.6953,
   387.3116,
   421.6106,
   459.6163,
   505.4719,
   563.2603,
   635.9718,
   692.2802,
   745.897,
   789.6904,
   831.1771,
   886.4295,
   950.901,
   983.4362};
   Double_t Graph_fy8[90] = {
   190.042,
   192.3104,
   192.9376,
   195.179,
   197.2136,
   198.0799,
   199.3876,
   199.4802,
   201.01,
   204.4632,
   204.529,
   206.7971,
   208.8441,
   208.9712,
   209.8662,
   210.2649,
   211.3333,
   212.7612,
   214.3898,
   216.0449,
   217.1898,
   218.8107,
   219.1693,
   219.524,
   220.873,
   221.9988,
   223.3628,
   223.7069,
   225.3419,
   225.4478,
   225.5616,
   225.584,
   239.8787,
   256.2561,
   271.2293,
   293.7999,
   304.8973,
   307.0445,
   308.5203,
   309.6434,
   310.7722,
   310.8221,
   310.5429,
   310.2559,
   309.9569,
   309.996,
   311.8566,
   313.3588,
   314.1336,
   315.2763,
   316.7668,
   317.2607,
   317.3559,
   317.4016,
   319.264,
   319.2881,
   319.6855,
   319.7195,
   318.6591,
   318.3273,
   317.9688,
   309.2591,
   300.7849,
   289.5104,
   286.1793,
   286.2011,
   285.5743,
   285.6238,
   285.3433,
   284.0635,
   283.1184,
   281.2031,
   278.656,
   277.7288,
   275.8579,
   273.0541,
   270.9095,
   265.6796,
   261.7535,
   256.9895,
   253.7797,
   247.4406,
   240.1473,
   234.4071,
   229.3303,
   226.7081,
   224.3734,
   220.2731,
   215.7486,
   213.7682};
   graph = new TGraph(90,Graph_fx8,Graph_fy8);
   graph->SetName("Graph");
   graph->SetTitle("Graph");
   graph->SetFillColor(1);

   ci = TColor::GetColor("#cc33ff");
   graph->SetLineColor(ci);
   graph->SetLineStyle(6);
   graph->SetLineWidth(3);
   
   TH1F *Graph_Graph8 = new TH1F("Graph_Graph8","Graph",100,16.86982,1079.905);
   Graph_Graph8->SetMinimum(177.0742);
   Graph_Graph8->SetMaximum(332.6873);
   Graph_Graph8->SetDirectory(0);
   Graph_Graph8->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph8->SetLineColor(ci);
   Graph_Graph8->GetXaxis()->SetLabelFont(42);
   Graph_Graph8->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph8->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph8->GetXaxis()->SetTitleFont(42);
   Graph_Graph8->GetYaxis()->SetLabelFont(42);
   Graph_Graph8->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph8->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph8->GetYaxis()->SetTitleFont(42);
   Graph_Graph8->GetZaxis()->SetLabelFont(42);
   Graph_Graph8->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph8->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph8->GetZaxis()->SetTitleFont(42);
   graph->SetHistogram(Graph_Graph8);
   
   multigraph->Add(graph,"");
   
   Double_t Graph_fx9[5] = {
   250,
   500,
   1000,
   3000,
   5000};
   Double_t Graph_fy9[5] = {
   597.2217,
   587.5585,
   450.4588,
   245.3363,
   177.6733};
   graph = new TGraph(5,Graph_fx9,Graph_fy9);
   graph->SetName("Graph");
   graph->SetTitle("Graph");
   graph->SetFillColor(1);

   ci = TColor::GetColor("#3399ff");
   graph->SetLineColor(ci);
   graph->SetLineStyle(4);
   graph->SetLineWidth(3);
   
   TH1F *Graph_Graph9 = new TH1F("Graph_Graph9","Graph",100,225,5475);
   Graph_Graph9->SetMinimum(135.7185);
   Graph_Graph9->SetMaximum(639.1765);
   Graph_Graph9->SetDirectory(0);
   Graph_Graph9->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph9->SetLineColor(ci);
   Graph_Graph9->GetXaxis()->SetLabelFont(42);
   Graph_Graph9->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph9->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph9->GetXaxis()->SetTitleFont(42);
   Graph_Graph9->GetYaxis()->SetLabelFont(42);
   Graph_Graph9->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph9->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph9->GetYaxis()->SetTitleFont(42);
   Graph_Graph9->GetZaxis()->SetLabelFont(42);
   Graph_Graph9->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph9->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph9->GetZaxis()->SetTitleFont(42);
   graph->SetHistogram(Graph_Graph9);
   
   multigraph->Add(graph,"");
   
   Double_t Graph_fx10[518] = {
   6.04,
   6.04,
   6.04,
   6.04,
   6.05,
   6.08,
   6.11,
   6.12,
   6.12,
   6.13,
   6.16,
   6.16,
   6.16,
   6.19,
   6.2,
   6.2,
   6.2,
   6.21,
   6.24,
   6.27,
   6.28,
   6.28,
   6.28,
   6.28,
   6.28,
   6.29,
   6.34,
   6.37,
   6.37,
   6.37,
   6.37,
   6.37,
   6.38,
   6.43,
   6.45,
   6.45,
   6.45,
   6.45,
   6.45,
   6.45,
   6.46,
   6.53,
   6.54,
   6.54,
   6.54,
   6.54,
   6.54,
   6.54,
   6.62,
   6.62,
   6.62,
   6.62,
   6.62,
   6.62,
   6.64,
   6.69,
   6.71,
   6.71,
   6.71,
   6.71,
   6.71,
   6.72,
   6.78,
   6.8,
   6.8,
   6.8,
   6.8,
   6.8,
   6.81,
   6.87,
   6.89,
   6.89,
   6.89,
   6.89,
   6.89,
   6.91,
   6.94,
   6.97,
   6.98,
   6.98,
   7,
   7.05,
   7.08,
   7.09,
   7.15,
   7.17,
   7.19,
   7.24,
   7.27,
   7.28,
   7.34,
   7.37,
   7.37,
   7.45,
   7.46,
   7.47,
   7.55,
   7.56,
   7.57,
   7.65,
   7.66,
   7.67,
   7.76,
   7.77,
   7.77,
   7.86,
   7.88,
   7.95,
   7.99,
   8.05,
   8.1,
   8.15,
   8.19,
   8.24,
   8.27,
   8.31,
   8.38,
   8.43,
   8.48,
   8.52,
   8.58,
   8.61,
   8.65,
   8.71,
   8.75,
   8.81,
   8.84,
   8.88,
   8.93,
   8.97,
   9,
   9.05,
   9.12,
   9.17,
   9.24,
   9.29,
   9.36,
   9.42,
   9.49,
   9.54,
   9.62,
   9.67,
   9.74,
   9.8,
   9.87,
   9.93,
   10,
   10.2,
   10.3,
   10.5,
   10.6,
   10.8,
   10.9,
   10.9,
   11,
   11.2,
   11.2,
   11.3,
   11.5,
   11.6,
   11.8,
   11.9,
   12.1,
   12.2,
   12.4,
   12.6,
   12.7,
   12.9,
   13.1,
   13.3,
   13.5,
   13.5,
   13.6,
   13.8,
   14,
   14.2,
   14.4,
   14.5,
   14.5,
   14.8,
   15,
   15.2,
   15.3,
   15.3,
   15.6,
   15.8,
   15.9,
   16,
   16.2,
   16.5,
   16.6,
   16.9,
   17.2,
   17.3,
   17.6,
   17.9,
   18,
   18.3,
   18.6,
   18.7,
   19,
   19.3,
   19.4,
   19.5,
   19.8,
   20.6,
   21.4,
   21.8,
   22,
   22.2,
   22.6,
   22.9,
   23.2,
   23.5,
   23.8,
   24.1,
   24.5,
   24.8,
   25.1,
   25.5,
   25.8,
   26.1,
   26.5,
   26.8,
   27.2,
   27.6,
   28.1,
   28.7,
   29.1,
   29.4,
   29.8,
   30.8,
   31.7,
   32.4,
   32.9,
   34.2,
   35.3,
   35.8,
   36.4,
   36.9,
   37.4,
   38.3,
   38.9,
   39.4,
   40.4,
   41,
   41.6,
   42.6,
   43.2,
   43.8,
   44.4,
   45,
   45.6,
   46.2,
   46.8,
   47.5,
   48.1,
   48.7,
   49.4,
   50.1,
   50.7,
   51.4,
   52.1,
   53.3,
   54.8,
   55.7,
   56.4,
   57.2,
   57.9,
   58.7,
   59.5,
   60.3,
   61.1,
   61.9,
   62.7,
   63.5,
   64.4,
   65.3,
   66.3,
   67.6,
   68.8,
   69.7,
   70.7,
   71.6,
   72.8,
   74.2,
   75.5,
   76.5,
   77.5,
   78.8,
   80.3,
   81.8,
   82.8,
   84,
   85.1,
   86.4,
   88.2,
   89.7,
   90.9,
   92.1,
   93.6,
   95.5,
   97.1,
   98.4,
   100,
   102,
   104,
   105,
   108,
   110,
   112,
   114,
   115,
   118,
   120,
   122,
   124,
   127,
   130,
   132,
   134,
   137,
   139,
   142,
   145,
   147,
   150,
   152,
   155,
   157,
   161,
   164,
   167,
   170,
   173,
   176,
   179,
   182,
   187,
   190,
   194,
   197,
   200,
   205,
   208,
   213,
   216,
   222,
   225,
   231,
   234,
   240,
   244,
   253,
   262,
   267,
   272,
   278,
   283,
   289,
   295,
   301,
   307,
   312,
   317,
   323,
   329,
   334,
   341,
   347,
   353,
   358,
   367,
   374,
   381,
   387,
   395,
   403,
   411,
   419,
   427,
   436,
   445,
   454,
   463,
   475,
   485,
   494,
   504,
   514,
   528,
   545,
   564,
   583,
   603,
   615,
   628,
   639,
   649,
   662,
   675,
   689,
   701,
   712,
   726,
   741,
   756,
   771,
   786,
   802,
   818,
   833,
   846,
   863,
   878,
   892,
   910,
   935,
   964,
   992,
   1030,
   1050,
   1070,
   1090,
   1110,
   1150,
   1190,
   1210,
   1230,
   1260,
   1280,
   1310,
   1340,
   1370,
   1400,
   1430,
   1460,
   1490,
   1520,
   1550,
   1600,
   1650,
   1690,
   1720,
   1750,
   1790,
   1850,
   1910,
   1950,
   1990,
   2030,
   2070,
   2130,
   2170,
   2210,
   2260,
   2300,
   2370,
   2410,
   2460,
   2540,
   2630,
   2680,
   2730,
   2820,
   2920,
   3020,
   3120,
   3190,
   3240,
   3320,
   3370,
   3490,
   3610,
   3690,
   3750,
   3880,
   4020,
   4100,
   4180,
   4270,
   4350,
   4440,
   4530,
   4620,
   4690,
   4810,
   4880,
   5000,
   5080,
   5200,
   5310,
   5420,
   5520,
   5640,
   5750,
   5860,
   5980,
   6100,
   6220,
   6330,
   6440,
   6560,
   6700,
   6830,
   7050,
   7300,
   7450,
   7590,
   7840,
   8110,
   8380,
   8670,
   8850,
   8990,
   9210,
   9390,
   9610};
   Double_t Graph_fy10[518] = {
   10.38676,
   10.50231,
   10.59957,
   10.7015,
   10.89364,
   11.07546,
   11.20647,
   11.30821,
   11.41342,
   11.62109,
   11.82995,
   11.96215,
   12.07818,
   12.17911,
   12.30743,
   12.414,
   12.52534,
   12.76538,
   12.97118,
   13.12865,
   13.25128,
   13.37442,
   13.49524,
   13.62174,
   13.74534,
   13.99711,
   14.24146,
   14.40622,
   14.54013,
   14.67427,
   14.8083,
   14.94868,
   15.22224,
   15.47959,
   15.6669,
   15.80805,
   15.95581,
   16.10083,
   16.2527,
   16.40114,
   16.65049,
   17.00656,
   17.18103,
   17.34867,
   17.50979,
   17.663,
   17.82315,
   18.09534,
   18.48112,
   18.68225,
   18.85134,
   19.02836,
   19.21403,
   19.38419,
   19.72512,
   20.07365,
   20.32073,
   20.51337,
   20.68111,
   20.89181,
   21.0759,
   21.47197,
   21.82747,
   22.10836,
   22.30316,
   22.50687,
   22.72023,
   22.88709,
   23.32871,
   23.73763,
   24.00677,
   24.23435,
   24.45738,
   24.68282,
   24.91041,
   25.36578,
   25.78503,
   26.09729,
   26.34398,
   26.58842,
   27.06598,
   27.53896,
   27.86668,
   28.37133,
   28.86478,
   29.20029,
   29.71859,
   30.24769,
   30.60227,
   31.15273,
   31.68307,
   32.06927,
   32.5362,
   33.23597,
   33.60661,
   34.0793,
   34.82676,
   35.19988,
   35.69491,
   36.46783,
   36.87798,
   37.44003,
   38.20997,
   38.65276,
   39.20006,
   40.07932,
   40.8414,
   41.55343,
   42.4036,
   43.14178,
   44.02907,
   44.76045,
   45.25133,
   46.05417,
   46.59723,
   47.07559,
   47.84267,
   48.80958,
   49.64402,
   50.16063,
   51.06094,
   51.65136,
   52.17979,
   52.98822,
   53.58735,
   54.51024,
   55.15295,
   55.7454,
   56.61769,
   57.29215,
   57.83828,
   58.59123,
   59.58957,
   60.25911,
   61.2608,
   61.9507,
   63.01658,
   63.72388,
   64.8542,
   65.56339,
   66.64773,
   67.45883,
   68.57788,
   69.38042,
   70.52167,
   71.44279,
   73.10832,
   74.86664,
   76.70132,
   78.48531,
   80.39639,
   82.27539,
   83.96915,
   84.81317,
   86.19446,
   88.02168,
   88.90821,
   90.11315,
   92.12023,
   94.32802,
   96.50886,
   98.84577,
   100.8332,
   102.8086,
   104.7116,
   106.793,
   108.8109,
   110.7898,
   112.9515,
   115.1677,
   117.0762,
   118.1521,
   119.1161,
   120.7506,
   122.937,
   125.5722,
   127.4196,
   128.5312,
   129.6638,
   131.542,
   134.0308,
   136.1693,
   137.3979,
   138.4952,
   140.691,
   142.7079,
   144.0108,
   145.2215,
   146.8251,
   149.5702,
   150.7827,
   152.4733,
   155.2857,
   156.5944,
   158.387,
   161.2726,
   162.6707,
   164.4505,
   167.5191,
   168.8856,
   170.7937,
   172.6887,
   174.1507,
   175.4199,
   177.3078,
   182.9573,
   187.7626,
   189.8365,
   190.4369,
   191.0454,
   193.294,
   195.0114,
   196.8028,
   198.6746,
   200.6337,
   202.4317,
   204.8624,
   205.4538,
   206.0518,
   208.4005,
   210.5569,
   212.4997,
   214.5452,
   216.3183,
   218.547,
   220.4993,
   222.5493,
   224.7033,
   226.9325,
   229.2592,
   231.2259,
   233.3437,
   236.0739,
   236.692,
   237.8515,
   240.2765,
   242.669,
   242.8986,
   243.7,
   244.4396,
   245.1237,
   245.324,
   246.1552,
   246.9239,
   247.738,
   248.6028,
   249.34,
   250.183,
   251.0113,
   251.7779,
   252.4054,
   252.4402,
   252.4741,
   252.5072,
   252.5394,
   252.576,
   252.6065,
   251.8236,
   251.565,
   251.5977,
   251.9175,
   252.7618,
   252.7922,
   253.0667,
   254.0334,
   254.1442,
   254.1704,
   254.1995,
   254.2243,
   254.2519,
   254.2788,
   254.305,
   254.3305,
   254.3554,
   254.3796,
   254.4032,
   254.4291,
   254.4543,
   254.2526,
   253.4561,
   253.3367,
   253.3588,
   252.5675,
   252.295,
   252.1031,
   251.2675,
   251.223,
   250.3929,
   250.0624,
   249.8782,
   249.0786,
   249.0366,
   248.174,
   247.9263,
   247.944,
   247.6981,
   246.9351,
   246.8915,
   246.9084,
   246.0196,
   245.5296,
   244.7362,
   244.6935,
   243.8445,
   243.6187,
   242.4377,
   241.8683,
   241.295,
   240.1783,
   239.0772,
   238.001,
   237.4805,
   236.957,
   236.4553,
   236.9969,
   237.012,
   234.4527,
   232.994,
   232.0529,
   231.124,
   230.6725,
   229.7764,
   228.8918,
   227.5962,
   226.7575,
   226.3463,
   225.53,
   224.7235,
   224.3345,
   223.5489,
   222.4,
   221.6514,
   220.9151,
   220.5568,
   219.4781,
   218.4252,
   218.4349,
   217.4066,
   216.4078,
   215.7535,
   214.7888,
   214.4764,
   213.537,
   212.6227,
   211.7229,
   210.5545,
   209.6973,
   208.5851,
   207.767,
   206.7044,
   205.9222,
   204.9054,
   204.1581,
   202.7048,
   200.6119,
   199.4946,
   198.6241,
   197.7734,
   196.9394,
   195.9209,
   195.126,
   194.1531,
   193.393,
   192.6467,
   192.2811,
   191.5566,
   190.8456,
   190.4965,
   189.8054,
   189.1259,
   188.7928,
   187.9657,
   186.9986,
   186.3681,
   185.748,
   185.29,
   184.688,
   183.8008,
   183.0782,
   182.0883,
   181.3984,
   180.4531,
   179.6626,
   178.8891,
   178.132,
   176.4223,
   175.5989,
   174.7941,
   174.0077,
   173.2387,
   171.644,
   170.3208,
   168.5686,
   167.267,
   165.4898,
   164.7208,
   163.9695,
   163.8889,
   163.1556,
   162.5181,
   161.6606,
   160.976,
   160.9779,
   160.2332,
   159.5059,
   158.7245,
   158.0995,
   157.2843,
   156.6211,
   155.8431,
   155.2095,
   155.1483,
   154.4668,
   153.8004,
   153.7418,
   153.0319,
   152.3957,
   150.9962,
   149.8166,
   148.4291,
   146.8649,
   146.1595,
   145.5618,
   144.8424,
   144.2273,
   143.077,
   141.5716,
   140.9059,
   140.2935,
   139.6204,
   138.999,
   138.3208,
   137.7278,
   136.5779,
   135.9239,
   135.2852,
   134.6612,
   134.0513,
   133.455,
   132.8717,
   131.7421,
   130.3946,
   129.6185,
   129.1138,
   128.6188,
   127.8935,
   126.9576,
   125.6149,
   124.9697,
   124.5488,
   123.9302,
   123.3267,
   122.1621,
   121.6,
   121.0507,
   120.5136,
   119.9882,
   118.9705,
   118.3154,
   117.8359,
   116.905,
   115.7187,
   115.1476,
   114.5904,
   113.7792,
   112.4881,
   111.6267,
   110.4508,
   109.8856,
   109.4437,
   108.7971,
   108.3764,
   107.6595,
   106.4832,
   106.0117,
   105.4593,
   104.657,
   103.6329,
   103.0581,
   102.6571,
   102.1086,
   101.7257,
   101.2013,
   100.7625,
   100.2622,
   99.77413,
   99.29779,
   98.89833,
   98.37802,
   97.9966,
   97.43805,
   97.13459,
   96.65859,
   96.25151,
   95.79658,
   95.35219,
   94.91791,
   94.49337,
   94.02686,
   93.6217,
   93.27425,
   93.07861,
   92.78892,
   92.31587,
   91.94598,
   91.2278,
   90.24254,
   89.78968,
   89.42747,
   88.72436,
   87.79184,
   87.11485,
   86.19591,
   85.77034,
   85.35504,
   84.91885,
   84.61402,
   84.25532};
   graph = new TGraph(518,Graph_fx10,Graph_fy10);
   graph->SetName("Graph");
   graph->SetTitle("Graph");
   graph->SetFillColor(1);

   ci = TColor::GetColor("#66ccff");
   graph->SetLineColor(ci);
   graph->SetLineStyle(5);
   graph->SetLineWidth(3);
   
   TH1F *Graph_Graph10 = new TH1F("Graph_Graph10","Graph",518,5.436,10570.4);
   Graph_Graph10->SetMinimum(9.348083);
   Graph_Graph10->SetMaximum(278.861);
   Graph_Graph10->SetDirectory(0);
   Graph_Graph10->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph10->SetLineColor(ci);
   Graph_Graph10->GetXaxis()->SetLabelFont(42);
   Graph_Graph10->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph10->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph10->GetXaxis()->SetTitleFont(42);
   Graph_Graph10->GetYaxis()->SetLabelFont(42);
   Graph_Graph10->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph10->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph10->GetYaxis()->SetTitleFont(42);
   Graph_Graph10->GetZaxis()->SetLabelFont(42);
   Graph_Graph10->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph10->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph10->GetZaxis()->SetTitleFont(42);
   graph->SetHistogram(Graph_Graph10);
   
   multigraph->Add(graph,"");
   
   Double_t Graph_fx11[35] = {
   3.98,
   4.37,
   4.79,
   5.25,
   5.75,
   6.31,
   6.92,
   7.59,
   8.32,
   9.12,
   10,
   10.96,
   12.02,
   13.18,
   14.45,
   15.85,
   17.38,
   19.05,
   20.89,
   22.91,
   25.12,
   31.62,
   39.81,
   50.12,
   63.1,
   79.43,
   100,
   125.89,
   158.49,
   199.53,
   251.19,
   316.23,
   1000,
   3162.3,
   10000};
   Double_t Graph_fy11[35] = {
   64.47703,
   92.96188,
   120.9916,
   144.7661,
   171.1873,
   194.8983,
   219.9867,
   244.5213,
   267.5613,
   289.6608,
   311.7509,
   330.2783,
   345.9273,
   362.605,
   376.5173,
   387.5872,
   398.0475,
   406.9399,
   414.3522,
   421.5604,
   426.3119,
   433.1181,
   435.0014,
   429.503,
   421.4079,
   411.5566,
   398.3919,
   383.7713,
   369.2768,
   352.1727,
   335.9504,
   319.8066,
   245.9105,
   185.1913,
   139.1868};
   graph = new TGraph(35,Graph_fx11,Graph_fy11);
   graph->SetName("Graph");
   graph->SetTitle("Graph");
   graph->SetFillColor(1);

   ci = TColor::GetColor("#66cc66");
   graph->SetLineColor(ci);
   graph->SetLineStyle(2);
   graph->SetLineWidth(3);
   
   TH1F *Graph_Graph11 = new TH1F("Graph_Graph11","Graph",100,3.582,10999.6);
   Graph_Graph11->SetMinimum(27.4246);
   Graph_Graph11->SetMaximum(472.0538);
   Graph_Graph11->SetDirectory(0);
   Graph_Graph11->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph11->SetLineColor(ci);
   Graph_Graph11->GetXaxis()->SetLabelFont(42);
   Graph_Graph11->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph11->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph11->GetXaxis()->SetTitleFont(42);
   Graph_Graph11->GetYaxis()->SetLabelFont(42);
   Graph_Graph11->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph11->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph11->GetYaxis()->SetTitleFont(42);
   Graph_Graph11->GetZaxis()->SetLabelFont(42);
   Graph_Graph11->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph11->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph11->GetZaxis()->SetTitleFont(42);
   graph->SetHistogram(Graph_Graph11);
   
   multigraph->Add(graph,"");
   
   Double_t Graph_fx12[35] = {
   4,
   5,
   6,
   7,
   8,
   9,
   10,
   12,
   14,
   16,
   18,
   20,
   24,
   28,
   32,
   36,
   40,
   44,
   48,
   52,
   56,
   60,
   65,
   70,
   75,
   80,
   85,
   90,
   95,
   100,
   150,
   200,
   300,
   400,
   500};
   Double_t Graph_fy12[35] = {
   91.75045,
   115.9467,
   132.4599,
   144.0692,
   152.856,
   159.9043,
   165.4462,
   172.653,
   177.2831,
   179.5654,
   180.8904,
   181.5836,
   181.5776,
   181.2419,
   178.737,
   176.8406,
   175.2212,
   173.4303,
   171.2294,
   169.3498,
   167.5194,
   165.3283,
   163.1921,
   161.2337,
   159.198,
   157.2876,
   155.7156,
   153.813,
   152.3262,
   150.9621,
   138.5165,
   129.9907,
   118.4184,
   110.7202,
   104.9163};
   graph = new TGraph(35,Graph_fx12,Graph_fy12);
   graph->SetName("Graph");
   graph->SetTitle("Graph");
   graph->SetFillColor(1);

   ci = TColor::GetColor("#333399");
   graph->SetLineColor(ci);
   graph->SetLineStyle(2);
   graph->SetLineWidth(3);
   
   TH1F *Graph_Graph12 = new TH1F("Graph_Graph12","Graph",100,3.6,549.6);
   Graph_Graph12->SetMinimum(82.76714);
   Graph_Graph12->SetMaximum(190.5669);
   Graph_Graph12->SetDirectory(0);
   Graph_Graph12->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph12->SetLineColor(ci);
   Graph_Graph12->GetXaxis()->SetLabelFont(42);
   Graph_Graph12->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph12->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph12->GetXaxis()->SetTitleFont(42);
   Graph_Graph12->GetYaxis()->SetLabelFont(42);
   Graph_Graph12->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph12->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph12->GetYaxis()->SetTitleFont(42);
   Graph_Graph12->GetZaxis()->SetLabelFont(42);
   Graph_Graph12->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph12->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph12->GetZaxis()->SetTitleFont(42);
   graph->SetHistogram(Graph_Graph12);
   
   multigraph->Add(graph,"");
   multigraph->Draw("L");
   
   TLegend *leg = new TLegend(0.16,0.61,0.5,0.85,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextSize(0.03);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   TLegendEntry *entry=leg->AddEntry("NULL","Razor-0#mu 90% CL limit: AV EFT operator","h");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph","Expected limit, with uncertainty","lf");

   ci = TColor::GetColor("#ffcc00");
   entry->SetFillColor(ci);
   entry->SetFillStyle(1001);

   ci = TColor::GetColor("#ff6666");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(3);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph","Observed limit","l");

   ci = TColor::GetColor("#0000ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(3);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   leg->Draw();
   
   leg = new TLegend(0.67,0.61,0.92,0.9,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextSize(0.03);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   entry=leg->AddEntry("Graph","IceCube W^{+}W^{-}","l");

   ci = TColor::GetColor("#3399ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(4);
   entry->SetLineWidth(3);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph","COUPP 2012","l");

   ci = TColor::GetColor("#6666ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(6);
   entry->SetLineWidth(3);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph","SIMPLE 2012","l");

   ci = TColor::GetColor("#ff9900");
   entry->SetLineColor(ci);
   entry->SetLineStyle(2);
   entry->SetLineWidth(3);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph","Super-K W^{+}W^{-}","l");

   ci = TColor::GetColor("#cc33ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(6);
   entry->SetLineWidth(3);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph","XENON 100","l");

   ci = TColor::GetColor("#66ccff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(5);
   entry->SetLineWidth(3);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph","PICO","l");

   ci = TColor::GetColor("#66cc66");
   entry->SetLineColor(ci);
   entry->SetLineStyle(2);
   entry->SetLineWidth(3);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph","PICASSO","l");

   ci = TColor::GetColor("#333399");
   entry->SetLineColor(ci);
   entry->SetLineStyle(2);
   entry->SetLineWidth(3);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   leg->Draw();
   TLatex *   tex = new TLatex(0.955,0.945,"18.8 fb^{-1} (8 TeV)");
tex->SetNDC();
   tex->SetTextAlign(31);
   tex->SetTextFont(42);
   tex->SetTextSize(0.045);
   tex->SetLineWidth(2);
   tex->Draw();
      tex = new TLatex(0.245,0.865,"CMS");
tex->SetNDC();
   tex->SetTextAlign(31);
   tex->SetTextFont(61);
   tex->SetTextSize(0.045);
   tex->SetLineWidth(2);
   tex->Draw();
   
   TH1F *_copy__1 = new TH1F("_copy__1","",100,0.9,1049.95);
   _copy__1->SetMinimum(100);
   _copy__1->SetMaximum(2000000);
   _copy__1->SetDirectory(0);
   _copy__1->SetStats(0);

   ci = TColor::GetColor("#000099");
   _copy__1->SetLineColor(ci);
   _copy__1->GetXaxis()->SetTitle("M_{#chi} (GeV)");
   _copy__1->GetXaxis()->SetRange(0,96);
   _copy__1->GetXaxis()->SetLabelFont(42);
   _copy__1->GetXaxis()->SetTitleSize(0.05);
   _copy__1->GetXaxis()->SetTitleOffset(1.1);
   _copy__1->GetXaxis()->SetTitleFont(42);
   _copy__1->GetYaxis()->SetTitle("#Lambda (GeV)");
   _copy__1->GetYaxis()->SetLabelFont(42);
   _copy__1->GetYaxis()->SetTitleSize(0.05);
   _copy__1->GetYaxis()->SetTitleOffset(1.05);
   _copy__1->GetYaxis()->SetTitleFont(42);
   _copy__1->GetZaxis()->SetLabelFont(42);
   _copy__1->GetZaxis()->SetLabelSize(0.035);
   _copy__1->GetZaxis()->SetTitleSize(0.035);
   _copy__1->GetZaxis()->SetTitleFont(42);
   _copy__1->Draw("sameaxis");
   c->Modified();
   c->cd();
   c->SetSelected(c);
}
void drawGraphs(TGraphErrors* data, TGraphErrors* mc, const std::string& method, const std::string& xTitle, const std::string& yTitle, const std::string& legendTitle, double lumi, const std::string& outputName, int dataMarkerStyle = 20, int dataMarkerColor = kBlack, int mcMarkerStyle = 29, int mcMarkerColor = kBlue) {

  data->SetMarkerSize(1.5);
  data->SetMarkerStyle(dataMarkerStyle);
  data->SetMarkerColor(dataMarkerColor);
  data->SetLineColor(dataMarkerColor);

  mc->SetMarkerSize(1.5);
  mc->SetMarkerStyle(mcMarkerStyle);
  mc->SetMarkerColor(mcMarkerColor);
  mc->SetLineColor(mcMarkerColor);

  // Fit
  TF1* data_fct = nullptr;
  TF1* mc_fct = nullptr;

  TH1D* errors_data = new TH1D("errors_data", "errors", 100, 0, 1);
  errors_data->SetStats(false);
  errors_data->SetFillColor(LIGHT_GRAY);
  //errors_data->SetLineColor(kRed);
  errors_data->SetFillStyle(1001);

  TH1D* errors_mc = (TH1D*) errors_data->Clone("errors_mc");
  errors_mc->SetFillColor(LIGHT_BLUE);

  if (method == "Balancing") {
    data_fct = new TF1("data_fct", "[0] - x*x*[1]", 0, 1);
    data_fct->SetLineColor(dataMarkerColor);
    data_fct->SetLineWidth(1);
    data_fct->SetLineStyle(2);

    data->Fit(data_fct, "RQN");
    (TVirtualFitter::GetFitter())->GetConfidenceIntervals(errors_data, 0.68);

    mc_fct = new TF1("mc_fct", "[0] - x*x*[1]", 0, 1);
    mc_fct->SetLineColor(mcMarkerColor);
    mc_fct->SetLineWidth(1);
    mc_fct->SetLineStyle(2);

    mc->Fit(mc_fct, "RQN");
    (TVirtualFitter::GetFitter())->GetConfidenceIntervals(errors_mc, 0.68);
  } else {
    data_fct = new TF1("data_fct", "[0] + x*[1]", 0, 1);
    data_fct->SetLineColor(dataMarkerColor);
    data_fct->SetLineWidth(1);
    data_fct->SetLineStyle(2);

    data->Fit(data_fct, "RQN");
    (TVirtualFitter::GetFitter())->GetConfidenceIntervals(errors_data, 0.68);

    mc_fct = new TF1("mc_fct", "[0] + x*[1]", 0, 1);
    mc_fct->SetLineColor(mcMarkerColor);
    mc_fct->SetLineWidth(1);
    mc_fct->SetLineStyle(2);

    mc->Fit(mc_fct, "RQN");
    (TVirtualFitter::GetFitter())->GetConfidenceIntervals(errors_mc, 0.68);

  }

  data_fct->SetRange(0, 1);
  mc_fct->SetRange(0, 1);

  TMultiGraph* mg = new TMultiGraph();
  mg->Add(data);
  mg->Add(mc);

  TString title = TString::Format(";%s;%s", xTitle.c_str(), yTitle.c_str());
  mg->SetTitle(title);

  TCanvas* canvas = new TCanvas("canvas", "", 800, 800);

  mg->Draw("ap");

  errors_data->Draw("e3 same");
  errors_mc->Draw("e3 same");

  data_fct->Draw("same");
  mc_fct->Draw("same");

  mg->Draw("ap same");


  TLegend* legend = new TLegend(0.18, 0.18, 0.55, 0.35);
  legend->SetTextFont(42);
  legend->SetFillColor(kWhite);
  legend->SetFillStyle(0);
  legend->SetTextSize(0.035);
  legend->SetBorderSize(1);

  TString legendTitleWithPtCut = TString::Format("%s, p_{T}^{#gamma} #geq 170 GeV", legendTitle.c_str());

  legend->SetHeader(legendTitleWithPtCut);
  legend->AddEntry(data, TString::Format("%s (data)", method.c_str()), "p");
  legend->AddEntry(mc, TString::Format("%s (MC)", method.c_str()), "p");
  legend->Draw();

  TLatex tl;
  tl.SetNDC();
  tl.SetTextSize(0.035);
  tl.SetTextFont(42);

  // Luminosity
  TString sLumi = TString::Format("L = %.02f fb^{-1}", lumi);
  tl.DrawLatex(0.18, 0.96, sLumi);

  // Energy
  tl.DrawLatex(0.80, 0.96, "#sqrt{s} = 8 TeV");

  canvas->Print(outputName.c_str());

  delete canvas;
  delete mg;

  delete errors_data;
  delete errors_mc;
}
Example #27
0
void rateStudy() {
  const int NRUNS = 25;
  const int NCH = 32;
  const int NBINS = 32;

  TCanvas* c1 = new TCanvas("c1", "c1", 800, 600);

  TMultiGraph *mg = new TMultiGraph();

  TLegend *legend=new TLegend(0.65,0.15,0.88,0.55);
  legend->SetNColumns(4);
  legend->SetFillColor(0);

  TH1F* hRate = new TH1F("hRate", "hist", 32.0, 0, 8.0);

  //Color buffer
  const int NCOLORS = 32;
  int color[NCOLORS] = {73, 2, 3, 4, 99, 6, 7, 8, 9, 12, 28, 32, 34,
                        28, 50, 51, 56, 58, 88, 99, 1, 208, 209,
                        218, 212, 210, 221, 224, 225, 226, 227, 228 };

  ifstream fin;
  //fin.open("runlist.txt");
  fin.open("filter_runlist.txt");

  string line = "";

  TFile* out = new TFile("outtemp.root", "REACREATE");
  TH1F* h = new TH1F("h","hist", NBINS, 0, NBINS);
  TF1* pois = new TF1("pois","[0]*TMath::Poisson(x,[1])",0,50);
  TF1* ppp = new TF1("ppp","[0]*TMath::Power(0.5,x*[1])",0.01,1.0);


  for (int ch = 0; ch < NCH; ++ch) {

    //if ( ch==26 || ch==27 )
    //continue;

    //Graph points and errors
    Double_t x[NRUNS];
    Double_t y[NRUNS];
    Double_t errX[NRUNS] = {0};
    Double_t errY[NRUNS] = {0};

    int fileCounter = 0;
    while(getline(fin, line)) {
      vector<double> data = parse(line);
      stringstream filePath;
      filePath << "pmtratestudy/run" << data[0] << "*.root";
      cout << "opening file at " << filePath.str() << endl;
      cout << "file counter: " << fileCounter << " channel=" << ch << endl;
      //TFile* f = new TFile(filePath.str().c_str());
      //TTree* t = (TTree *)f->Get("eventtree");
      TChain* t = new TChain("eventtree");
      t->Add( filePath.str().c_str() );
      out->cd();

      x[fileCounter] = data[1];

      int nfires[NCH] = {0};
      int samples = 0;
      float chmax = 0.0;
      t->SetBranchAddress("nfires", &nfires);
      t->SetBranchAddress("samples", &samples);
      t->SetBranchAddress("chmax", &chmax);
      
      h->Reset();
      
      int nentries = t->GetEntries();
      for (int entry = 0; entry < nentries; ++entry) {
        t->GetEntry(entry);
        if (chmax < 100.0) {
          h->Fill(nfires[ch]);
        }
      }


      
      pois->SetParameter(0,1);
      pois->SetParameter(1, h->GetMean());

      h->Fit(pois,"RQ","",0,50);
      //TF1 *myfit = (TF1 *)h->GetFunction("pois");
      TF1 *myfit = (TF1 *)pois;
      Double_t lambda = myfit->GetParameter(1);  
      h->Draw();
      stringstream histFileName;
      histFileName << "hist/h" << data[0] << "_ch" << ch << ".png";
      c1->SaveAs(histFileName.str().c_str());
      //Graph with poisson method
#if 1
      y[fileCounter] = lambda / ((samples - 1) * 15.625E-6);
      errY[fileCounter] = myfit->GetParError(1) / ((samples - 1) * 15.625E-6);
#endif
      //Graph with mean method
#if 0
      y[fileCounter] = h->GetMean() / ((samples - 1) * 15.625E-6);
      errY[fileCounter] = h->GetMeanError() / ((samples - 1) * 15.625E-6);
#endif
      cout << x[fileCounter] << ", " << y[fileCounter] 
           << " | " << (samples - 1) << endl;
      delete t;
      //f->Close();
      fileCounter++;
    } 

    ppp->SetParameter(0,1);
    ppp->SetParameter(1,0.4);
     
    TGraphErrors* gr = new TGraphErrors(NRUNS, x, y, errX, errY);
    gr->SetLineColor(color[ch % NCOLORS]);
    cout << "color: " << color[ch % NCOLORS] << endl;
    gr->SetLineWidth(2);
    gr->SetMarkerStyle(7);
    gr->Fit("ppp","R0","Q0",0.045,2.0);
    TF1 *afit = (TF1 *)gr->GetFunction("ppp");
    Double_t aRate = 1/afit->GetParameter(1);  
    if (aRate > 0) {
      hRate->Fill(aRate);
    }
    gr->GetXaxis()->SetTitle("Run Date");
    gr->GetYaxis()->SetTitle("Rate [kHz]");

    stringstream entryName, fileName;
    entryName << "Channel" << ch;
    gr->SetTitle(entryName.str().c_str());
    fileName << "plots/" << ch << ".png";
    legend->AddEntry(gr, entryName.str().c_str());
    gr->Draw("alp");
    c1->SaveAs(fileName.str().c_str());
    mg->Add(gr);
    cout << "added plot to mg\n";
    fin.clear();
    fin.seekg(0, ios::beg);
  } // loop over channel
  hRate->Draw();
  hRate->Fit("gaus");
  c1->SaveAs("hrate.pdf");
  mg->Draw("alp");
  mg->GetXaxis()->SetTitle("Days since first run");
  mg->GetYaxis()->SetTitle("Rate [kHz]");
  mg->SetTitle("All channels: Rate vs. Days since first Run");

  legend->Draw();
  c1->SaveAs("mg.pdf");
  
}
Example #28
0
void graphme()
{
	TString filename;
	UInt_t i, j, k, count;
	Double_t junk;
	Double_t parax[67], parae[67], perpx[79], perpe[79], run[146], arrayx[146], arraye[146], parar[67], perpr[79], zero[79], paracheck[67];

	filename = "xs/Para.tmp";
	
	ifstream inFile(filename);
	if ( !inFile.is_open())
	{
		cout << "Error opening file ";
		cout << filename;
		cout << endl;
		break;
	}

	while( !inFile.eof()) 
	{
		inFile >> paracheck[i];
		i++;
	}
	inFile.close();


	filename = "xs/Alex.tmp";

	ifstream inFile(filename);
	if ( !inFile.is_open())
	{
		cout << "Error opening file ";
		cout << filename;
		cout << endl;
		break;
	}

	i = 0;
	j = 0;
	k = 0;
	count = 0;

	while( !inFile.eof()) 
	{
		inFile >> run[i] >> junk >> junk >> junk >> arrayx[i] >> arraye[i];
		i++;
	}
	inFile.close();

	for(i=0;i<146;i++)
	{
		flag = 0;

		for(count=0;count<67;count++)
		{
			if(run[i] == paracheck[count])
			{
				flag = 1;
				break;
			}
		}

		if(flag==0)
		{
			perpx[k] = arrayx[i];
			perpe[k] = arraye[i];
			perpr[k] = run[i];
			zero[k] = 0;
			k++;
		}

		if(flag==1)
		{
			parax[j] = arrayx[i];
			parae[j] = arraye[i];
			parar[j] = run[i];
			j++;		
		}
	}

	TGraphErrors *gr1 = new TGraphErrors(79, perpr, perpx, zero, perpe);
	TGraphErrors *gr2 = new TGraphErrors(67, parar, parax, zero, parae);

	c1 = new TCanvas("c1", "c1", 50, 10, 500, 700);

	gr2->SetMarkerStyle(21);
	gr2->SetMarkerColor(kRed);
	gr1->SetMarkerStyle(22);
	gr1->SetMarkerColor(kBlue);
	
	TMultiGraph *mg = new TMultiGraph();
	mg->SetTitle("Yield/Scalers*Factor with error");
	mg->Add(gr1);
	mg->Add(gr2);
	mg->Draw("AP");
	
	TLegend *tleg = new TLegend(0.6,0.25,0.8,0.35);
	tleg->SetFillColor(0);
	tleg->SetBorderSize(0);
	tleg->AddEntry(gr1,"Perp", "p");
	tleg->AddEntry(gr2,"Para", "p");
	tleg->Draw();

}
Example #29
0
void plotS11Baby() {

   const int numFiles=8;
   char filename[180];
   int antFiles[numFiles][2]={{1,17},{1,18},{1,28},{1,27},{2,7},{2,8},{5,8},{5,9}};
   int whichOpen[numFiles]={1,1,2,2,5,5,6,6};
   int plotThis[numFiles]={1,1,1,1,2,2,2,2};
   char *graphDesc[numFiles]={"Office (1)","Office (2)","Outside (1)","Outside (2)","Salt Day I (1)","Salt Day I (2)","Salt Day III (1)","Salt Day III (2)"};
   TGraph *grOpen[NUM_OPENS]; 
   TGraph *grOpenPower[NUM_OPENS];
   for(int i=0;i<NUM_OPENS;i++) {
      grOpen[i]=getOpenWave(i); 
      //      grOpenPower[i]=FFTtools::makePowerSpectrumVoltsSecondsPadded(grOpen[i],8);
      grOpenPower[i]=FFTtools::makePSVSBartlettPaddedOverlap(grOpen[i],32,1024);
      Double_t *freq=grOpenPower[i]->GetX();
      //      cout << i << "\t" << grOpenPower[i]->GetN() << "\t" <<  freq[1]-freq[0] << "\n";
   }
   
   TGraph *grAnt[numFiles];
   TGraph *grAntPower[numFiles];
   TGraph *grAntRatio[numFiles];
   TGraph *grAntTrans[numFiles];
   for(int i=0;i<numFiles;i++) {
       sprintf(filename,"/home/rjn/saltStuff/hockley2009/disk_%d/TEK%05d.txt",antFiles[i][0],antFiles[i][1]);
       grAnt[i]=getWaveFromTxt(filename);
       grAnt[i]=cropLikeOpen(grAnt[i],whichOpen[i]);
       if(i<3) {
	 //	  grAntPower[i]=FFTtools::makePowerSpectrumVoltsSecondsPadded(grAnt[i],8);
	  grAntPower[i]=FFTtools::makePSVSBartlettPaddedOverlap(grAnt[i],32,1024);
       }
       else {
	  grAntPower[i]=FFTtools::makePSVSBartlettPaddedOverlap(grAnt[i],32,1024);
	  //	  TGraph *grTemp=FFTtools::makePowerSpectrumVoltsSecondsPadded(grAnt[i],8);
	  //	  grAntPower[i]=FFTtools::smoothFFT(grTemp,2);
       }
       grAntRatio[i]=FFTtools::dbGraphs(grAntPower[i],grOpenPower[whichOpen[i]]);
       grAntTrans[i]=FFTtools::ratioSubtractOneGraphs(grAntPower[i],grOpenPower[whichOpen[i]]);
       //       Double_t *freq=grAntPower[i]->GetX();
       //       cout << i << "\t" << freq[1]-freq[0] << "\n";
       //       cout << i << "\t" << grAntPower[i]->GetN() << "\t" <<  freq[1]-freq[0] << "\n";
       //       cout << grAntRatio[i] << "\t" << grAntTrans[i] << endl;
   }


  TCanvas *canWave = new TCanvas("canBabyWave","canBabyWave",800,800);
  canWave->Divide(1,numFiles);
  for(int i=0;i<numFiles;i++) {
     canWave->cd(i+1);
     grAnt[i]->SetLineColor(getNiceColour(i));     
     grAnt[i]->Draw("al");
     grAnt[i]->SetTitle(graphDesc[i]);
     grAnt[i]->GetXaxis()->SetTitle("Time (s)");
     grAnt[i]->GetYaxis()->SetTitle("Voltage (V)");

  }

  TCanvas *can = new TCanvas("canBaby","canBaby",900,600);
  can->Divide(1,2);
  for(int subPad=1;subPad<=2;subPad++) {
    can->cd(subPad);
    TMultiGraph *mg = new TMultiGraph();
    
    TLegend *leggy = new TLegend(0.2,0.2,0.4,0.5);
    leggy->SetBorderSize(0);
    leggy->SetFillColor(0);
    leggy->SetFillStyle(0);  
    for(int i=0;i<numFiles;i++) {
      if(plotThis[i]!=subPad) continue;
      grAntRatio[i]->SetLineColor(getNiceColour(i));
      grAntRatio[i]->SetLineWidth(2);
      mg->Add(grAntRatio[i],"l");
      leggy->AddEntry(grAntRatio[i],graphDesc[i],"l");
    }
    mg->Draw("al");
    mg->SetTitle("S11 Measurements Baby");
    mg->SetMaximum(0);
    mg->SetMinimum(-20);
    mg->GetXaxis()->SetRangeUser(0,1000);
    mg->GetXaxis()->SetTitle("Frequency (MHz)");
    mg->GetYaxis()->SetTitle("Reflected Power (dB)");
    leggy->Draw();
  }


  TCanvas *canTrans = new TCanvas("canTransBaby","canTransBaby",900,600);
  canTrans->Divide(1,2);
  for(int subPad=1;subPad<=2;subPad++) {
    canTrans->cd(subPad);
    TMultiGraph *mg = new TMultiGraph();
    TLegend *leggy2 = new TLegend(0.2,0.55,0.4,0.85);
    leggy2->SetBorderSize(0);
    leggy2->SetFillColor(0);
    leggy2->SetFillStyle(0);  
    for(int i=0;i<numFiles;i++) {
      if(plotThis[i]!=subPad) continue;
      grAntTrans[i]->SetLineColor(getNiceColour(i));
      grAntTrans[i]->SetLineWidth(2);
      mg->Add(grAntTrans[i],"l");
      leggy2->AddEntry(grAntTrans[i],graphDesc[i],"l");
    }
    mg->Draw("al");
    mg->SetTitle("S11 Measurements Baby");
    mg->SetMaximum(1);
    mg->SetMinimum(0);
    mg->GetXaxis()->SetRangeUser(0,1000);
    mg->GetXaxis()->SetTitle("Frequency (MHz)");
    mg->GetYaxis()->SetTitle("Transmission (Ratio)");    
    leggy2->Draw();
  }


}
void EfficiencyByEta_vs_Lz()
{
//=========Macro generated from canvas: eta_lz/eta_lz
//=========  (Tue Apr  5 09:30:27 2016) by ROOT version6.02/05
   TCanvas *eta_lz = new TCanvas("eta_lz", "eta_lz",0,0,700,500);
   eta_lz->Range(-6.5625,-0.125,41.5625,1.125);
   eta_lz->SetFillColor(0);
   eta_lz->SetBorderMode(0);
   eta_lz->SetBorderSize(2);
   eta_lz->SetFrameBorderMode(0);
   eta_lz->SetFrameBorderMode(0);
   
   TMultiGraph *multigraph = new TMultiGraph();
   multigraph->SetName("");
   multigraph->SetTitle("");
   
   Double_t divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ_fx3001[10] = {
   1,
   3,
   5,
   7,
   9,
   11,
   14,
   17,
   19,
   22.5};
   Double_t divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ_fy3001[10] = {
   0.9255743,
   0.887184,
   0.8789174,
   0.8852085,
   0.8950226,
   0.8479381,
   0.7993119,
   0.7869822,
   0.7105263,
   0.5384615};
   Double_t divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ_felx3001[10] = {
   1,
   1,
   1,
   1,
   1,
   1,
   2,
   1,
   1,
   2.5};
   Double_t divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ_fely3001[10] = {
   0.001481033,
   0.00433367,
   0.006472957,
   0.00813138,
   0.01004846,
   0.01400104,
   0.0144885,
   0.03622352,
   0.06131092,
   0.1720041};
   Double_t divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ_fehx3001[10] = {
   1,
   1,
   1,
   1,
   1,
   1,
   2,
   1,
   1,
   2.5};
   Double_t divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ_fehy3001[10] = {
   0.00145469,
   0.00419584,
   0.006195321,
   0.007675046,
   0.009298784,
   0.01306018,
   0.01377348,
   0.03252222,
   0.05512412,
   0.1648473};
   TGraphAsymmErrors *grae = new TGraphAsymmErrors(10,divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ_fx3001,divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ_fy3001,divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ_felx3001,divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ_fehx3001,divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ_fely3001,divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ_fehy3001);
   grae->SetName("divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ");
   grae->SetTitle("num_LEp8_1D_A0_LZ");

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#ff0000");
   grae->SetLineColor(ci);

   ci = TColor::GetColor("#ff0000");
   grae->SetMarkerColor(ci);
   grae->SetMarkerStyle(2);
   
   TH1F *Graph_divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ3001 = new TH1F("Graph_divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ3001","num_LEp8_1D_A0_LZ",100,0,27.5);
   Graph_divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ3001->SetMinimum(0.3104003);
   Graph_divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ3001->SetMaximum(0.9830861);
   Graph_divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ3001->SetDirectory(0);
   Graph_divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ3001->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ3001->SetLineColor(ci);
   Graph_divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ3001->GetXaxis()->SetLabelFont(42);
   Graph_divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ3001->GetXaxis()->SetLabelSize(0.035);
   Graph_divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ3001->GetXaxis()->SetTitleSize(0.035);
   Graph_divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ3001->GetXaxis()->SetTitleFont(42);
   Graph_divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ3001->GetYaxis()->SetLabelFont(42);
   Graph_divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ3001->GetYaxis()->SetLabelSize(0.035);
   Graph_divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ3001->GetYaxis()->SetTitleSize(0.035);
   Graph_divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ3001->GetYaxis()->SetTitleFont(42);
   Graph_divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ3001->GetZaxis()->SetLabelFont(42);
   Graph_divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ3001->GetZaxis()->SetLabelSize(0.035);
   Graph_divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ3001->GetZaxis()->SetTitleSize(0.035);
   Graph_divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ3001->GetZaxis()->SetTitleFont(42);
   grae->SetHistogram(Graph_divide_num_LEp8_1D_A0_LZ_by_den_LEp8_1D_A0_LZ3001);
   
   multigraph->Add(grae,"");
   
   Double_t divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ_fx3002[12] = {
   1,
   3,
   5,
   7,
   9,
   11,
   14,
   17,
   19,
   22.5,
   27.5,
   32.5};
   Double_t divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ_fy3002[12] = {
   0.9411031,
   0.9015597,
   0.8916002,
   0.8833977,
   0.8820225,
   0.8774584,
   0.8594848,
   0.8327138,
   0.8206522,
   0.8528529,
   0.8434783,
   0.8540146};
   Double_t divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ_felx3002[12] = {
   1,
   1,
   1,
   1,
   1,
   1,
   2,
   1,
   1,
   2.5,
   2.5,
   2.5};
   Double_t divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ_fely3002[12] = {
   0.001557248,
   0.004997005,
   0.00715926,
   0.009612966,
   0.01182494,
   0.0141127,
   0.01291605,
   0.02592262,
   0.03284668,
   0.02203922,
   0.02772573,
   0.03663361};
   Double_t divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ_fehx3002[12] = {
   1,
   1,
   1,
   1,
   1,
   1,
   2,
   1,
   1,
   2.5,
   2.5,
   2.5};
   Double_t divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ_fehy3002[12] = {
   0.001520079,
   0.004786173,
   0.006779026,
   0.008995481,
   0.01092244,
   0.01290395,
   0.01203332,
   0.02325302,
   0.02903958,
   0.01976026,
   0.02447678,
   0.03086749};
   grae = new TGraphAsymmErrors(12,divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ_fx3002,divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ_fy3002,divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ_felx3002,divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ_fehx3002,divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ_fely3002,divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ_fehy3002);
   grae->SetName("divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ");
   grae->SetTitle("num_LEp8_1D_A1_LZ");
   grae->SetMarkerStyle(2);
   
   TH1F *Graph_divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ3002 = new TH1F("Graph_divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ3002","num_LEp8_1D_A1_LZ",100,0,38.5);
   Graph_divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ3002->SetMinimum(0.7723237);
   Graph_divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ3002->SetMaximum(0.958105);
   Graph_divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ3002->SetDirectory(0);
   Graph_divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ3002->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ3002->SetLineColor(ci);
   Graph_divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ3002->GetXaxis()->SetLabelFont(42);
   Graph_divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ3002->GetXaxis()->SetLabelSize(0.035);
   Graph_divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ3002->GetXaxis()->SetTitleSize(0.035);
   Graph_divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ3002->GetXaxis()->SetTitleFont(42);
   Graph_divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ3002->GetYaxis()->SetLabelFont(42);
   Graph_divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ3002->GetYaxis()->SetLabelSize(0.035);
   Graph_divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ3002->GetYaxis()->SetTitleSize(0.035);
   Graph_divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ3002->GetYaxis()->SetTitleFont(42);
   Graph_divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ3002->GetZaxis()->SetLabelFont(42);
   Graph_divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ3002->GetZaxis()->SetLabelSize(0.035);
   Graph_divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ3002->GetZaxis()->SetTitleSize(0.035);
   Graph_divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ3002->GetZaxis()->SetTitleFont(42);
   grae->SetHistogram(Graph_divide_num_LEp8_1D_A1_LZ_by_den_LEp8_1D_A1_LZ3002);
   
   multigraph->Add(grae,"");
   
   Double_t divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ_fx3003[12] = {
   1,
   3,
   5,
   7,
   9,
   11,
   14,
   17,
   19,
   22.5,
   27.5,
   32.5};
   Double_t divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ_fy3003[12] = {
   0.9502501,
   0.935305,
   0.9068493,
   0.8950382,
   0.9219144,
   0.921875,
   0.89,
   0.8737374,
   0.8074866,
   0.8093645,
   0.8384615,
   0.8478261};
   Double_t divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ_felx3003[12] = {
   1,
   1,
   1,
   1,
   1,
   1,
   2,
   1,
   1,
   2.5,
   2.5,
   2.5};
   Double_t divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ_fely3003[12] = {
   0.003894584,
   0.008370582,
   0.01203572,
   0.01515001,
   0.01589315,
   0.01802717,
   0.01582595,
   0.02818923,
   0.03323571,
   0.02546897,
   0.03893712,
   0.0470388};
   Double_t divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ_fehx3003[12] = {
   1,
   1,
   1,
   1,
   1,
   1,
   2,
   1,
   1,
   2.5,
   2.5,
   2.5};
   Double_t divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ_fehy3003[12] = {
   0.003634742,
   0.007516641,
   0.01085101,
   0.01353658,
   0.01357227,
   0.01512129,
   0.01415643,
   0.02402349,
   0.02965425,
   0.0232519,
   0.03313846,
   0.03844226};
   grae = new TGraphAsymmErrors(12,divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ_fx3003,divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ_fy3003,divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ_felx3003,divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ_fehx3003,divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ_fely3003,divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ_fehy3003);
   grae->SetName("divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ");
   grae->SetTitle("num_Gp8_1D_A0_LZ");

   ci = TColor::GetColor("#ff0000");
   grae->SetLineColor(ci);
   grae->SetLineStyle(2);

   ci = TColor::GetColor("#ff0000");
   grae->SetMarkerColor(ci);
   grae->SetMarkerStyle(2);
   
   TH1F *Graph_divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ3003 = new TH1F("Graph_divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ3003","num_Gp8_1D_A0_LZ",100,0,38.5);
   Graph_divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ3003->SetMinimum(0.7562875);
   Graph_divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ3003->SetMaximum(0.9718483);
   Graph_divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ3003->SetDirectory(0);
   Graph_divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ3003->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ3003->SetLineColor(ci);
   Graph_divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ3003->GetXaxis()->SetLabelFont(42);
   Graph_divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ3003->GetXaxis()->SetLabelSize(0.035);
   Graph_divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ3003->GetXaxis()->SetTitleSize(0.035);
   Graph_divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ3003->GetXaxis()->SetTitleFont(42);
   Graph_divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ3003->GetYaxis()->SetLabelFont(42);
   Graph_divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ3003->GetYaxis()->SetLabelSize(0.035);
   Graph_divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ3003->GetYaxis()->SetTitleSize(0.035);
   Graph_divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ3003->GetYaxis()->SetTitleFont(42);
   Graph_divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ3003->GetZaxis()->SetLabelFont(42);
   Graph_divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ3003->GetZaxis()->SetLabelSize(0.035);
   Graph_divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ3003->GetZaxis()->SetTitleSize(0.035);
   Graph_divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ3003->GetZaxis()->SetTitleFont(42);
   grae->SetHistogram(Graph_divide_num_Gp8_1D_A0_LZ_by_den_Gp8_1D_A0_LZ3003);
   
   multigraph->Add(grae,"");
   
   Double_t divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ_fx3004[12] = {
   1,
   3,
   5,
   7,
   9,
   11,
   14,
   17,
   19,
   22.5,
   27.5,
   32.5};
   Double_t divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ_fy3004[12] = {
   0.9382671,
   0.9028476,
   0.8930886,
   0.8943534,
   0.8732719,
   0.8631179,
   0.8828829,
   0.7391304,
   0.8125,
   0.7848101,
   0.9032258,
   0.9473684};
   Double_t divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ_felx3004[12] = {
   1,
   1,
   1,
   1,
   1,
   1,
   2,
   1,
   1,
   2.5,
   2.5,
   2.5};
   Double_t divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ_fely3004[12] = {
   0.002390155,
   0.007511495,
   0.01114096,
   0.01479634,
   0.01803571,
   0.02457885,
   0.020362,
   0.04739985,
   0.06185409,
   0.05634454,
   0.08525764,
   0.1108357};
   Double_t divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ_fehx3004[12] = {
   1,
   1,
   1,
   1,
   1,
   1,
   2,
   1,
   1,
   2.5,
   2.5,
   2.5};
   Double_t divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ_fehy3004[12] = {
   0.002308279,
   0.007043833,
   0.01024736,
   0.01326161,
   0.016194,
   0.02157686,
   0.01787098,
   0.04282533,
   0.05064369,
   0.04821565,
   0.05219903,
   0.04358048};
   grae = new TGraphAsymmErrors(12,divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ_fx3004,divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ_fy3004,divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ_felx3004,divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ_fehx3004,divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ_fely3004,divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ_fehy3004);
   grae->SetName("divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ");
   grae->SetTitle("num_Gp8_1D_A1_LZ");
   grae->SetLineStyle(2);
   grae->SetMarkerStyle(2);
   
   TH1F *Graph_divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ3004 = new TH1F("Graph_divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ3004","num_Gp8_1D_A1_LZ",100,0,38.5);
   Graph_divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ3004->SetMinimum(0.6618088);
   Graph_divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ3004->SetMaximum(1.020871);
   Graph_divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ3004->SetDirectory(0);
   Graph_divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ3004->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ3004->SetLineColor(ci);
   Graph_divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ3004->GetXaxis()->SetLabelFont(42);
   Graph_divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ3004->GetXaxis()->SetLabelSize(0.035);
   Graph_divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ3004->GetXaxis()->SetTitleSize(0.035);
   Graph_divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ3004->GetXaxis()->SetTitleFont(42);
   Graph_divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ3004->GetYaxis()->SetLabelFont(42);
   Graph_divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ3004->GetYaxis()->SetLabelSize(0.035);
   Graph_divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ3004->GetYaxis()->SetTitleSize(0.035);
   Graph_divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ3004->GetYaxis()->SetTitleFont(42);
   Graph_divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ3004->GetZaxis()->SetLabelFont(42);
   Graph_divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ3004->GetZaxis()->SetLabelSize(0.035);
   Graph_divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ3004->GetZaxis()->SetTitleSize(0.035);
   Graph_divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ3004->GetZaxis()->SetTitleFont(42);
   grae->SetHistogram(Graph_divide_num_Gp8_1D_A1_LZ_by_den_Gp8_1D_A1_LZ3004);
   
   multigraph->Add(grae,"");
   multigraph->Draw("ALP");
   multigraph->GetXaxis()->SetTitle("L_{Z} [cm]");
   multigraph->GetXaxis()->SetLabelFont(42);
   multigraph->GetXaxis()->SetLabelSize(0.035);
   multigraph->GetXaxis()->SetTitleSize(0.035);
   multigraph->GetXaxis()->SetTitleFont(42);
   multigraph->GetYaxis()->SetTitle("Efficiency");
   multigraph->GetYaxis()->SetLabelFont(42);
   multigraph->GetYaxis()->SetLabelSize(0.035);
   multigraph->GetYaxis()->SetTitleSize(0.035);
   multigraph->GetYaxis()->SetTitleFont(42);
   TLine *line = new TLine(34.5,0,34.5,1);

   ci = TColor::GetColor("#0000ff");
   line->SetLineColor(ci);
   line->SetLineStyle(2);
   line->Draw();
   line = new TLine(46.5,0,46.5,1);

   ci = TColor::GetColor("#0000ff");
   line->SetLineColor(ci);
   line->SetLineStyle(2);
   line->Draw();
   eta_lz->Modified();
   eta_lz->cd();
   eta_lz->SetSelected(eta_lz);
}