Ejemplo n.º 1
0
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;
}
void GE11sEfficiencyPlots_3Sector_DividerCurrent()
{
   
   // Input Files 
   ifstream File1, File2, File3, File4;

    File1.open("EfficiencyData_R1592_R1646_Lat17_GE11_IV.txt");
    File2.open("SWAPHV_EfficiencyData_R2065_R2123_Lat17_GE11_IV.txt");
    File3.open("SWAP_EfficiencyData_R1868_R1906_Lat18_GE11_IV.txt");
    File4.open("EfficiencyData_R1313_R1397_Lat17_GE11_IV_GIF.txt");

   // Name of Detector
   const char*  Detector1 = "#left(i#eta,i#phi#right)=#left(5,2#right); #sigma_{eff} #times 4";
   const char*  Detector2 = "#left(i#eta,i#phi#right)=#left(1,2#right); #sigma_{eff} #times 4";
   const char*  Detector3 = "#left(i#eta,i#phi#right)=#left(8,2#right); #sigma_{eff} #times 4";
   const char*  Detector4 = "#left(i#eta,i#phi#right)=#left(5,2#right); #sigma_{eff} #times 4";

   const char* RunRange = "Threshold = 1.2 fC";	// 15 VFAT units";
   const char* BeamType = "Beam: Muon";
   const char* MSPL = "";
   const char* Threshold = "";
   const char* GasUsed = "";
   const char* ClockMode = "";
   const char* EtaPhiSector = "";

   const char* CanvasName   = "Efficiency_wrt_DividerCurrent";
   const char* pdfFile	    = "EfficiencyPlot_wrt_DividerCurrent_wError4times_2gas.pdf";
   const char* pngFile	    = "EfficiencyPlot_wrt_DividerCurrent_wError4times_2gas.png";
   TFile *f = new   TFile(    "Efficiency_wrt_DividerCurrent_2gas_3Sector.root","RECREATE");

   TGaxis::SetMaxDigits(3);

   //const char* GraphTitle = "Efficiency For Run Range 306 To 407: 2014H2B";
   const char* GraphTitle = "";


   // Set TDR Style
   setTDRStyle();
   gStyle->SetOptFit(0);

   writeExtraText = true;       // if extra text
   extraText  = "#italic{Preliminary}";  // default extra text is "Preliminary"
   int iPeriod = 0;    // 1=7TeV, 2=8TeV, 3=7+8TeV, 7=7+8+13TeV, 0=free form (uses lumi_sqrtS)

   TNtuple *NT_Detector1 = new TNtuple("EtaPhi52_ArCO2CF4","Efficiency Vs Divider Current","Divider_Current:Efficiency:Efficiency_Error");
   TNtuple *NT_Detector2 = new TNtuple("EtaPhi12_ArCO2CF4","Efficiency Vs Divider Current","Divider_Current:Efficiency:Efficiency_Error");
   TNtuple *NT_Detector3 = new TNtuple("EtaPhi82_ArCO2CF4","Efficiency Vs Divider Current","Divider_Current:Efficiency:Efficiency_Error");
   TNtuple *NT_Detector4 = new TNtuple("EtaPhi52_ArCO2",   "Efficiency Vs Divider Current","Divider_Current:Efficiency:Efficiency_Error");

   Int_t nlines = 0;

   vector<double> NT_Detector1_HV,NT_Detector1_Eff,NT_Detector1_EffErr,NT_Detector2_HV,NT_Detector2_Eff,NT_Detector2_EffErr,NT_Detector3_HV,NT_Detector3_Eff,NT_Detector3_EffErr, NT_Detector1_Gain, NT_Detector2_Gain, NT_Detector3_Gain, NT_Detector4_Gain, NT_Detector4_HV,NT_Detector4_Eff,NT_Detector4_EffErr;
   double current, eff, efferr;
   while (1) 
   {
     File1 >> current >> eff >> efferr;
     cout<<"1==> "<<current<<"\t"<<eff<<"\t"<<efferr<<endl;
	if (!File1.good()) break;

	NT_Detector1_HV.push_back(current);
	NT_Detector1_Eff.push_back(eff);
        NT_Detector1_EffErr.push_back(efferr);

	NT_Detector1->Fill(current,eff,efferr);
	nlines++;
   }
   while (1) 
   {
     File2 >> current >> eff >> efferr;
     cout<<"2==> "<<current<<"\t"<<eff<<"\t"<<efferr<<endl;
	if (!File2.good()) break;

	NT_Detector2_HV.push_back(current);
	NT_Detector2_Eff.push_back(eff);
        NT_Detector2_EffErr.push_back(efferr);

	NT_Detector2->Fill(current,eff,efferr);
	nlines++;
   }
   while (1) 
   {
     File3 >> current >> eff >> efferr;
     cout<<"3==> "<<current<<"\t"<<eff<<"\t"<<efferr<<endl;
	if (!File3.good()) break;

	NT_Detector3_HV.push_back(current);
	NT_Detector3_Eff.push_back(eff);
        NT_Detector3_EffErr.push_back(efferr);

	NT_Detector3->Fill(current,eff,efferr);
	nlines++;
   }
   while (1) 
   {
     File4 >> current >> eff >> efferr;
     cout<<"4==> "<<current<<"\t"<<eff<<"\t"<<efferr<<endl;
	if (!File4.good()) break;

	NT_Detector4_HV.push_back(current);
	NT_Detector4_Eff.push_back(eff);
        NT_Detector4_EffErr.push_back(efferr);

	NT_Detector4->Fill(current,eff,efferr);
	nlines++;
   }

   File1.close();
   File2.close();
   File3.close();
   File4.close();
   
   TCanvas* c1 = new TCanvas("c1","",1);
   c1->Range(0,0,1,1);
   TPad *pad = new TPad("pad","",0,0,1,1);
   pad->SetGrid();
   pad->Draw();
   pad->cd();


   TF1 *f1 = new TF1("f1","[0]+(0.989)/([1]+exp(-[2]*(x-697.3)))",650,815);
   TF1 *f2 = new TF1("f2","(0.968)/([1]+exp(-[2]*(x-713)))",650,815);
   TF1 *f3 = new TF1("f3","(0.973)/([1]+exp(-[2]*(x-725)))",650,820);
   TF1 *f4 = new TF1("f4","(0.985)/([1]+exp(-[2]*(x-614)))",565,720);

//   f3->SetParameters(1.,1.,1.);

      // create first graph
   TGraphErrors *gr1 = new TGraphErrors(NT_Detector1_HV.size());
   for(unsigned int i=0;i<NT_Detector1_HV.size();i++)
   {
       gr1->SetPoint(i,NT_Detector1_HV[i],NT_Detector1_Eff[i]);
       gr1->SetPointError(i,0,4*NT_Detector1_EffErr[i]);
   }
   gr1->SetMarkerColor(kGreen+3);
   gr1->SetLineColor(kGreen+3);
   gr1->SetMarkerStyle(21);
   gr1->GetXaxis()->SetTitle("Current Supplied To HV Divider (#mu A)");
   gr1->GetYaxis()->SetTitle("Efficiency");
   gr1->SetTitle(GraphTitle);
   f1->SetLineColor(kGreen+3);
   gr1->Fit("f1","R");

      // create first graph
   TGraphErrors *gr5 = new TGraphErrors(NT_Detector2_HV.size());
   for(unsigned int i=0;i<NT_Detector2_HV.size();i++)
   {
       gr5->SetPoint(i,NT_Detector2_HV[i],NT_Detector2_Eff[i]);
       gr5->SetPointError(i,0,4*NT_Detector2_EffErr[i]);
   }
   gr5->SetMarkerColor(kBlack);
   gr5->SetLineColor(kBlack);
   gr5->SetMarkerStyle(22);
   gr5->GetXaxis()->SetTitle("Current Supplied To HV Divider (#mu A)");
   gr5->GetYaxis()->SetTitle("Efficiency");
   f2->SetLineColor(kBlack);
   gr5->Fit("f2","R");

      // create first graph
   TGraphErrors *gr8 = new TGraphErrors(NT_Detector3_HV.size());
   for(unsigned int i=0;i<NT_Detector3_HV.size();i++)
   {
       gr8->SetPoint(i,NT_Detector3_HV[i],NT_Detector3_Eff[i]);
       gr8->SetPointError(i,0,4*NT_Detector3_EffErr[i]);
   }
   gr8->SetMarkerColor(kBlue);
   gr8->SetLineColor(kBlue);
   gr8->SetMarkerStyle(24);
   gr8->GetXaxis()->SetTitle("Current Supplied To HV Divider (uA)");
   gr8->GetYaxis()->SetTitle("Efficiency");
   gr8->SetTitle(GraphTitle);
   f3->SetLineColor(kBlue);
   gr8->Fit("f3","R");

      // create first graph
   TGraphErrors *gr9 = new TGraphErrors(NT_Detector4_HV.size());
   for(unsigned int i=0;i<NT_Detector4_HV.size();i++)
   {
       gr9->SetPoint(i,NT_Detector4_HV[i],NT_Detector4_Eff[i]);
       gr9->SetPointError(i,0,4*NT_Detector4_EffErr[i]);
   }
   gr9->SetMarkerColor(kMagenta+2);
   gr9->SetLineColor(kMagenta+2);
   gr9->SetMarkerStyle(20);
   gr9->GetXaxis()->SetTitle("Current Supplied To HV Divider (uA)");
   gr9->GetYaxis()->SetTitle("Efficiency");
   f4->SetLineColor(kMagenta+2);
   gr9->Fit("f4","R");

TMultiGraph *mg = new TMultiGraph("mg",";Current Supplied to HV Divider (#mu A);Efficiency");
mg->Add(gr1);
mg->Add(gr5);
mg->Add(gr8);
mg->Add(gr9);
mg->SetMaximum(1.01);
mg->SetMinimum(0.0);
//mg->GetYaxis()->SetRangeUser(570.,820.);
mg->Draw("AP");
mg->GetXaxis()->SetLimits(560,890);
mg->GetYaxis()->SetDecimals(1);


   

   //Draw the Legend 
   TLegend *leg = new TLegend(0.55,0.400,0.80,0.50);
   TLegend *leg2 = new TLegend(0.55,0.150,0.80,0.30);
   leg2->SetTextSize(0.05);
   leg2->SetTextFont(42);
   leg->SetTextSize(0.05);
   leg->SetTextFont(42);
   //leg->AddEntry(gr1,"(i#eta,i#phi)=(1,2)","LPE");
   //leg->AddEntry(gr5,"(i#eta,i#phi)=(5,2)","LPE");
   //leg->AddEntry(gr8,"(i#eta,i#phi)=(8.2)","LPE");
   leg->AddEntry(gr9,Detector4,"PE");
   leg2->AddEntry(gr5,Detector2,"PE");
   leg2->AddEntry(gr1,Detector1,"PE");
   leg2->AddEntry(gr8,Detector3,"PE");

   leg->Draw("same");
   leg2->Draw("same");

   TLatex *text1 = new TLatex(750,0.74,RunRange);
   TLatex *text2 = new TLatex(750,0.66,BeamType);
   TLatex *text5 = new TLatex(750,0.58,"Gap Config: 3/1/2/1 mm");
   TLatex *text3 = new TLatex(750,0.48,"Gas: Ar/CO2 (70/30)");
   TLatex *text4 = new TLatex(750,0.28,"Gas: Ar/CO2/CF4 (45/15/40)");
//   TLatex *text5 = new TLatex(81050,0.64,ClockMode);
   TLatex *text6 = new TLatex(3150,0.56,EtaPhiSector);
   TLatex *text7 = new TLatex(3250,0.48,GasUsed);
   text1->SetTextFont(42);
   text2->SetTextFont(42);
   text3->SetTextFont(42);
   text5->SetTextFont(42);
   //text3->SetTextAngle(50);
   //text4->SetTextAngle(50);
//   text3->SetTextColor(kMagenta);
   text4->SetTextFont(42);
   text1->SetTextSize(0.04);
   text2->SetTextSize(0.04);
   text3->SetTextSize(0.04);
   text4->SetTextSize(0.04);
   text5->SetTextSize(0.04);
   TLatex *cmsprem = new TLatex(560,1.015,"CMS #it{Preliminary}");
   //TLatex *cmsprem = new TLatex(58.5,1.03,"#it{Preliminary}");
   //TLatex *cmsprem = new TLatex(58.5,1.03,"CMS #it{Preliminary}");
   TLatex *gen = new TLatex(855,1.015,"GE1/1");
//   cmsprem->SetTextFont(42);
//   cmsprem->SetTextSize(0.05);
//   gen->SetTextFont(42);
//   gen->SetTextSize(0.05);
//   cmsprem->SetTextSize(0.04);
   text1->Draw("same");
   text2->Draw("same");
   text3->Draw("same");
   text4->Draw("same");
   text5->Draw("same");
   text6->Draw("same");
   text7->Draw("same");
   cmsprem->Draw("same");
   gen->Draw("same");
//
////   CMS_lumi( c1, iPeriod, 0 );
//   

//   Float_t rightmax = 1.1*gr1->GetMaximum();

   //draw an axis on the right side
//   TGaxis *axis = new TGaxis(gPad->GetUxmin(),gPad->GetUymin(),
//	   gPad->GetUxmax(), gPad->GetUymax(),0,rightmax,510,"+L");
//   TGaxis *axis = new TGaxis(104,1.01,23211,1.01,3370,4252,15,"-");
//   cout<<"GetUxmax = "<<gPad->GetUxmin()<<"\tGetUymin = "<<gPad->GetUxmax()<<endl;
//   cout<<"GetUxmax = "<<gPad->GetUymin()<<"\tGetUymin = "<<gPad->GetUymax()<<endl;
//   axis->SetTitle("V_Drift (volts)");
// //  axis->SetTitleSize(2.5);
//  axis->SetTitleFont(42);
//  axis->SetTitleColor(1);
//  //axis->SetTitleFontSize(0.05);
//   axis->SetLineColor(kBlack);
//   axis->SetLabelColor(kBlack);
//   axis->Draw("sames");

   c1->Update();
   c1->SaveAs(pdfFile);
   c1->SaveAs(pngFile);
   //c1->SaveAs();

   c1->Write();
   f->Write();

}
void FindConstant::drawChi2AndFitPol2(const std::vector<double>& res, const std::vector<double>& chi2)
{
  TCanvas* c1 = new TCanvas();
  std::stringstream streamForEResExtraction;
  streamForEResExtraction << scintillatorID << "_beta_" << energyResolution;

  std::vector<double> Chi2ToFit, ResToFit;
  for (size_t i = 0; i < chi2.size(); i++) {
    if (chi2[i] < bestChi2 + 50.0) {
      std::cout << chi2[i] << std::endl;
      Chi2ToFit.push_back( chi2[i] );
      ResToFit.push_back( res[i] );
    }
  }

  TMultiGraph* m = new TMultiGraph();

  TGraph* gr = new TGraph(Chi2ToFit.size(), &ResToFit[0], &Chi2ToFit[0]);
  gr->SetTitle("Chi2 vs #beta");
  gr->GetXaxis()->SetTitle("#beta (#sqrt{keV})");
  gr->GetYaxis()->SetTitle("Chi2 for best fit");
  gr->SetLineColor(2);
  gr->SetLineWidth(4);
  gr->SetMarkerColor(4);
  gr->SetMarkerStyle(21);
  gr->Draw("AP");
  gStyle->SetOptFit(1);

  quadraticFit = new TF1("quadraticFit", "[0]* (x - [1])**2 + [2]", ResToFit[0], ResToFit[ ResToFit.size() - 1 ] );
  quadraticFit->SetParName(0, "a");
  quadraticFit->SetParName(1, "x_min");
  quadraticFit->SetParName(2, "y_min");
  quadraticFit->SetParameter(1, energyResolution);
  quadraticFit->SetParameter(2, bestChi2);
  gr->Fit(quadraticFit, "R");
  quadraticFit->Draw("same");
  std::stringstream buf;
  buf << sourcePosition;
  c1->SaveAs( ("FitResults" + filePath + buf.str() + "/Chi2Plot_strip_fitRegion_" + streamForEResExtraction.str() + expHistoTitle + ".png") );

  m->Add(gr);

  energyResolution = quadraticFit->GetParameter(1);

  TGraph* grFull = new TGraph(chi2.size(), &res[0], &chi2[0]);
  grFull->SetTitle("Chi2 vs #beta");
  grFull->GetXaxis()->SetTitle("#beta (#sqrt{keV})");
  grFull->GetYaxis()->SetTitle("Chi2 for best fit");
  grFull->SetLineColor(2);
  grFull->SetLineWidth(4);
  grFull->SetMarkerColor(4);
  grFull->SetMarkerStyle(21);

  m->Add(grFull);

  m->Draw("AP");

  c1->SaveAs( ("FitResults" + filePath + buf.str() + "/Chi2Plot_strip_" + streamForEResExtraction.str() + expHistoTitle + ".png") );

  delete gr;
  delete c1;
}
Ejemplo n.º 4
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 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);
}
Ejemplo n.º 6
0
void draw_cross(){


  Double_t Ecounter[20],yeild[20],flux[20],cross[20];
   Double_t  yerr1[20],yerr2[20],yerr3[20]; 
  // static Int_t n=3;
/*
  Double_t fit(Double_t *x,Double_t *par){
    return par[0]+par[1]*x[0];
  }

  TF1 *fitf = new TF1("fitf",fit,-10,25,2);
*/
   
 	y1[0]= 16.86/2.359;
	y1[1]= 22.16/4.063;
	y1[2]= 27.37/6.23;
	y1[3]= 32.83/8.854;
	y1[4]= 3.797/1.194;
	y1[5]= 5.886/2.89;
	y1[6]= 7.973/5.32;


E[0]= 0.8; 
	y2[0]= 0.7432/2.359*2;
E[1]= 1.05; 
	y2[1]= 0.9432/4.063*2;
E[2]= 1.25;
	y2[2]= 1.17/6.23*2;
E[3]= 1.55;	
	y2[3]= 1.39/8.854*2.0;
E[4]= 1.8;
	y2[4]= 0.16/1.194*2;
E[5]= 2.8;
	y2[5]= 0.2506/2.89*2;
E[6]= 3.8;
	y2[6]= 0.339/5.32*2;



/*
x[0]= 35;
	y1[0]= 0.3178;
	y1[1]= (207.0*100.0/26083.0)*0.8726;
	y1[2]= (445.0*100.0/26083.0)*0.8726;
	y1[3]= (638.0*100.0/26083.0)*0.8726;
	y1[4]= (1444.0*100.0/26083.0)*0.8726;
	y1[5]= (3139.0*100.0/26083.0)*0.8726;
x[1]= 45;
	y2[0]= 0.1356;
	y2[1]= (36.0*100.0/14580.0)*0.8726;
	y2[2]= (81.0*100.0/14580.0)*0.8726;
	y2[3]= (107.0*100.0/14580.0)*0.8726;
	y2[4]= (269.0*100.0/14580.0)*0.8726;
	y2[5]= (666.0*100.0/14580.0)*0.8726;
x[2]= 55;
	y3[0]= 0.0595;
	y3[1]= (13.0*100.0/9960.0)*0.8726;
	y3[2]= (31.0*100.0/9960.0)*0.8726;
	y3[3]= (37.0*100.0/9960.0)*0.8726;
	y3[4]= (74.0*100.0/9960.0)*0.8726;
	y3[5]= (190.0*100.0/9960.0)*0.8726;
x[3]= 60;
x[4]= 75;
x[5]= 95;



*/

/*
     yerr1[0] = 0.0085;
     yerr1[1] = 0.0092;
     yerr1[2] = 0.0099;
     yerr1[3] = 0.0080;
     yerr1[4] = 0.0124;
     yerr1[5] = 0.0127;
   
yerr2[0] = 0.097;
yerr2[1] = 0.071;
yerr2[2] = 0.0617;
yerr2[3] = 0.0313;
yerr2[4] = 0.0292;
yerr2[5] = 0.0264;
	yerr3[0] = 0.0174;
	yerr3[1] = 0.0362;
	yerr3[2] = 0.0559;
	yerr3[3] = 0.0611;
	yerr3[4] = 0.0864;
	yerr3[5] = 0.1384;

*/


   TMultiGraph *mg = new TMultiGraph("mg","Q2 resolution");
   TGraphErrors *g1 = new TGraphErrors(7,x,y1,0,0);
   TGraphErrors *g2 = new TGraphErrors(7,x,y2,0,0);	
//   TGraphErrors *g3 = new TGraphErrors(6,x,y3,0,yerr3);

  TCanvas *c11 = new TCanvas("c11","counts vs T",600,600);

//  g1->Draw("A*");
g1->SetName("g1");
g1->SetTitle("");  
g1->SetMarkerStyle(21);
g1->SetMarkerColor(1);
g1->SetMarkerSize(1.0);
g1->SetDrawOption("AP");
g1->SetLineColor(1);
g1->SetLineWidth(0);
g1->SetFillStyle(0);
g1->GetYaxis()->SetTitle("Q2 resolution (%)");
g1->GetXaxis()->SetTitle("Angle bin (deg)");


g2->SetName("g2");
g2->SetTitle("");
g2->SetMarkerStyle(22); 
g2->SetMarkerSize(1.5);
g2->SetMarkerColor(4);
g2->SetDrawOption("P");
g2->SetLineColor(2);
g2->SetLineWidth(0);
g2->SetFillStyle(0);



/*
g3->SetName("g3");
g3->SetMarkerStyle(22);
g3->SetMarkerSize(0.8);
g3->SetMarkerColor(4);
g3->SetDrawOption("P");
g3->SetLineColor(7);
g3->SetLineWidth(2);
g3->SetFillStyle(0);

*/

//mg->Add(g3);
mg->Add(g1);
mg->Add(g2);

//g1->Draw("ALP");
mg->Draw("AP");
mg->GetXaxis()->SetTitle(" Angle bin (deg)");
mg->GetYaxis()->SetTitle(" Q2 resolution (%)");
gPad->Modified();


//mg->GetYaxis()->SetLimits(0,1);




leg = new TLegend(0.1,0.7,0.48,0.9);
leg->AddEntry("g1","Hycal Q2 resolution ");
leg->AddEntry("g2","Gem Q2 resolution");
//leg->AddEntry("g3","1.30-1.55deg angle bin");
leg->Draw();






  //g1->GetXaxis()->SetRange(0,1400);
/*
  g1->Fit("fitf","","",0,0);
  Double_t parameter[2];

  fitf->GetParameters(parameter);
  cout<<"y[500]="<<parameter[0] + parameter[1] * 500<<endl;

*/



 }
Ejemplo n.º 7
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");
}
Ejemplo n.º 8
0
void Eff_Doping(){		// name of file

using namespace std;

double bias=30;
int i=0;			// used to name the TGraphs

TCanvas *c1 = new TCanvas("c1","c1",600,400);
TPad *pad1 = new TPad("pad1","",0,0,1,1);
TLegend *leg = new TLegend(.80,.70,.85,.87);

TGraph *gr[4];			// defines array to number of TGraphs

TMultiGraph *mg = new TMultiGraph();		// create multigraph

for (double fluence=13;fluence<=15;fluence+=1){		// loop to create multigraph for select bias values

	TString str =TString::Format("/afs/cern.ch/work/m/mbucklan/TCAD/SimpleCMOS/DepletionSimRemesh_3pixels_Rad/Neffextraction_3pixel_yCut_bias=%.1f_pitch=15.0_Fluence=1e+%.0f.txt",bias,fluence);		// does some magic, creates string with name of file
		
	if (i==4){
	
	i++;
	
	}

	gr[i] = new TGraph(str,"%lg %lg");		// creates graph called gr and reads file
	
	
	TString str1 =TString::Format("1e%.0f n_{eq} cm^{-2}",fluence);		// creates string with bias value
	
	gr[i]->SetTitle(str1);			// sets title to string
	gr[i]->SetLineColor(i+1);		// sets line colour, changes for each graph
	
	mg->Add(gr[i]);				// adds graph to multigraph
	leg->AddEntry(gr[i],str1,"l");
	
	i++;
	
}
	
pad1->Draw();
pad1->cd();
pad1->SetTickx(1);		//draws ticks on top side x axis
pad1->SetTicky(1);		//draws ticks on right hand side y axis

gPad->Update();
	
mg->Draw("AL");		// draws multigraph

// Make the graph look fancy...ish
mg->GetXaxis()->SetTitle("Depth (#mum)");
mg->GetYaxis()->SetTitle("Effective Doping Concentration (cm^{-3})");

TString str2 =TString::Format("Effective Doping Concentration for 3 Pixel 100#mum Thick Sensor at %.0fV, Resistivity=100#Omegacm",bias);		// does some magic, creates string with name of file

mg->GetHistogram()->SetTitle(str2);

mg->SetMinimum(-2e12);

leg->SetTextSize(0.03);
leg->Draw();

}
Ejemplo n.º 9
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");

}
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();

	
}
Ejemplo n.º 11
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;
}
Ejemplo n.º 12
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();
}
Ejemplo n.º 13
0
//This program takes 4 inputs: the half range of the fixed position, the min and max of the varying position, and the step size of the slice examined
//This program is easier to understand after reading resolutionChain.cpp
int main(int argc, char *argv[]){
  
  const float FIXMAX = atof(argv[1]), VARMIN = atof(argv[2]), VARMAX = atof(argv[3]), STEP = atof(argv[4]); //Assigning inputs
  
  TCanvas *c = new TCanvas("c", "c", 1800, 600);
  c->Divide(3,1);
  
  //Creating multigraphs for final output
  TMultiGraph *mgX = new TMultiGraph("mgX", "Normalized Calibration Constant on X");
  TMultiGraph *mgY = new TMultiGraph("mgY", "Normalized Calibration Constant on Y");
  TMultiGraph *mgXY = new TMultiGraph("mgXY", "Ratio of Normalized Calibration Constants for Y/X");
  
  TString filename;
  TFile *file;
  
  int range = (int) (VARMAX - VARMIN); //Number of graphs for each multigraph
  range++; //Adding one to account for the edge. This is separate just to remember that it has to happen
  vector<TGraphErrors*> graphs(range*3); //Vector of TGraphErrors, for each graph of the 3 multigraphs
  
  //Loop to get each of the graphs created by resolutionChain.cpp. Also sets line color, marker color, and line style. For color, different shades of blue are used for comparison
  for(int i = 0; i < range; i++){
    
    filename.Form("./ResolutionX/%g_%g_%g/resolutionX_%g_%g_%g.root", FIXMAX, VARMIN+i, STEP, FIXMAX, VARMIN+i, STEP);
    file = TFile::Open(filename.Data());
    graphs.at(i) = (TGraphErrors*) file->Get("gr");
    graphs.at(i)->SetLineColor(kBlue+3*(i-3));
    graphs.at(i)->SetMarkerColor(kBlue+3*(i-3));
    graphs.at(i)->SetMarkerStyle(20+i);
    
    filename.Form("./ResolutionY/%g_%g_%g/resolutionY_%g_%g_%g.root", FIXMAX, VARMIN+i, STEP, FIXMAX, VARMIN+i, STEP);
    file = TFile::Open(filename.Data());
    graphs.at(i+range) = (TGraphErrors*) file->Get("gr");
    graphs.at(i+range)->SetLineColor(kBlue+3*(i-3));
    graphs.at(i+range)->SetMarkerColor(kBlue+3*(i-3));
    graphs.at(i+range)->SetMarkerStyle(20+i);
  }
  
  /////////////////////////  Normalizing the X and Y Plots  /////////////////////////
  
  float max1 = 0, max2 = 0;
  
  int N = (int) graphs.at(0)->GetN();
  
  int numPts = 2*(3-(-3))/STEP; //Number of points between -3 and 3 - just makes it clear where the number comes from. Normalization is done within this range.
  if(numPts > N) numPts = N; //If the range is less than -3 to 3, sets the number of points to the max possible
  
  int startPt = (N - numPts)/2;
  int endPt = startPt + numPts;
  
  //Finding the maximum value in the range of all graphs
  for(int pt = startPt; pt < endPt; pt++){
    for(int grs = 0; grs < range; grs++){
      if(max1 < graphs.at(grs)->GetY()[pt])
	max1 = graphs.at(grs)->GetY()[pt];
      
      if(max2 < graphs.at(grs+range)->GetY()[pt])
	max2 = graphs.at(grs+range)->GetY()[pt];
    }
  }
   
  //Scales each point in each graph by the appropriate normalization factor. Also, creates the ratio graphs, propagates error, and adds each graph to the proper multigraph
  for(int grs = 0; grs < range; grs++){
    double ratio[2*N];
    double errRatioX[2*N];
    double errRatioY[2*N];
    double eX1, eX2, eY1, eY2, ptX, ptY;
    
    
    for(int i = 0; i < graphs.at(grs)->GetN(); i++){
      graphs.at(grs)->GetY()[i] = (graphs.at(grs)->GetY()[i])/max1;
      graphs.at(grs+range)->GetY()[i] = (graphs.at(grs+range)->GetY()[i])/max2;
      
      graphs.at(grs)->GetEY()[i] = (graphs.at(grs)->GetEY()[i])/max1;
      graphs.at(grs+range)->GetEY()[i] = (graphs.at(grs+range)->GetEY()[i])/max2;
      
      ptX = graphs.at(grs)->GetY()[i];
      ptY = graphs.at(grs+range)->GetY()[i];
      ratio[i] = ptY/ptX;
      
      eX1 = graphs.at(grs)->GetEX()[i];
      eY1 = graphs.at(grs)->GetEY()[i];
      eX2 = graphs.at(grs+range)->GetEX()[i];
      eY2 = graphs.at(grs+range)->GetEY()[i];
      errRatioX[i] = eX1;
      errRatioY[i] = ratio[i]*sqrt((eY1*eY1)/(ptY*ptY) + (eY2*eY2)/(ptY*ptY));
    }
    
    mgX->Add(graphs.at(grs));
    mgY->Add(graphs.at(grs+range));
    
    graphs.at(grs+2*range) = new TGraphErrors(graphs.at(grs)->GetN(), graphs.at(grs)->GetX(), ratio, errRatioX, errRatioY);
    graphs.at(grs+2*range)->SetLineColor(kBlue+3*(grs-3));
    graphs.at(grs+2*range)->SetMarkerColor(kBlue+3*(grs-3));
    graphs.at(grs+2*range)->SetMarkerStyle(20+grs);
    mgXY->Add(graphs.at(grs+2*range));
  }
    
  //Used to fit stuff, but it wasn't all that necessary
//   TF1 *p1 = new TF1("p1", "[0]*(x-[1])*(x-[2]) + [3]", -1*FIXMAX, FIXMAX);
//   TF1 *p2 = new TF1("p2", "[0]*(x-[1])*(x-[2]) + [3]", -1*FIXMAX, FIXMAX);
//   
//   p1->SetParameters(-1, 0, 0, 1);
//   p2->SetParameters(-1, 0, 0, 1);
//   
//   graphs.at(range-1)->Fit(p1, "RQME");
//   graphs.at(2*range-1)->Fit(p2, "RQME");
//   
//   float fitmax1 = p1->GetParameter(1);
//   float fitmax2 = p2->GetParameter(1);
//   
//   float fitDiff = fitmax1 - fitmax2;
//   
//   cout << "X Center: " << fitmax1 << " Y Center: " << fitmax2 << " Difference: " << fitDiff << endl;

  /////////////////////////  Drawing the X Graph  /////////////////////////
  c->cd(1);
  mgX->Draw("apl");
  mgX->GetXaxis()->SetTitle("Hodoscope X Position (mm)");
  mgX->GetYaxis()->SetTitle("m2/m1");
  mgX->GetYaxis()->SetTitleOffset(1.75);
  mgX->GetYaxis()->SetRangeUser(.9, 1.05);
  
  c->SetLeftMargin(0.15);
  
  TLegend* legX = new TLegend(0.1,0.1,0.5,0.3);
  legX->SetNColumns(2);
  TString entryName;
  for(int i = 0; i < range; i++){
    entryName.Form("Y in [-%g,%g]", (VARMIN+i)/2, (VARMIN+i)/2);
    legX->AddEntry(graphs.at(i),entryName.Data(),"lp");
  }
  legX->Draw();
  
  //p1->Draw("same");
  
  /////////////////////////  Drawing the Y Graph  /////////////////////////
  c->cd(2);
  mgY->Draw("apl");
  mgY->GetXaxis()->SetTitle("Hodoscope Y Position (mm)");
  mgY->GetYaxis()->SetTitle("m2/m1");
  mgY->GetYaxis()->SetTitleOffset(1.75);
  mgY->GetYaxis()->SetRangeUser(.9, 1.05);
  
  c->SetLeftMargin(0.15);
  
  TLegend* legY = new TLegend(0.1,0.1,0.5,0.3);
  legY->SetNColumns(2);
  for(int i = 0; i < range; i++){
    entryName.Form("X in [-%g,%g]", (VARMIN+i)/2, (VARMIN+i)/2);
    legY->AddEntry(graphs.at(i+range), entryName.Data(), "lp");
  }
  legY->Draw();
  
  //p2->Draw("same");
  
  /////////////////////////  Drawing the Ratio  /////////////////////////
  c->cd(3);
  mgXY->Draw("apl");
  mgXY->GetXaxis()->SetTitle("Hodoscope Position (mm)");
  mgXY->GetYaxis()->SetTitle("(my2/my1)/(mx2/mx1)");
  mgXY->GetYaxis()->SetTitleOffset(1.75);
  mgXY->GetYaxis()->SetRangeUser(.95, 1.05);
  
  c->SetLeftMargin(0.15);
  
  TLegend* legXY = new TLegend(0.1,0.1,0.5,0.3);
  legXY->SetNColumns(2);
  for(int i = 0; i < range; i++){
    entryName.Form("Range in [-%g,%g]", (VARMIN+i)/2, (VARMIN+i)/2);
    legXY->AddEntry(graphs.at(i+2*range),entryName.Data(),"lp");
  }
  legXY->Draw();
  
  /////////////////////////  Saving  /////////////////////////
  TString saveName;
  saveName.Form("Resolution Comparison %g_%g-%g_%g.png", FIXMAX, VARMIN, VARMAX, STEP);
  c->SaveAs(saveName.Data());
  
  saveName.Form("Resolution Comparison %g_%g-%g_%g.root", FIXMAX, VARMIN, VARMAX, STEP);
  c->SaveAs(saveName.Data());
  
  return 1;
}
Ejemplo n.º 14
0
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// drawFigure7
//
//    parameter = "dg0"
//    parameter = "lam0"
//    parameter = "dk0"
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void drawFigure7(TString parameter = "dk0")
{
  gInterpreter->ExecuteMacro("WZPaperStyle.C");

  gSystem->mkdir("pdf", kTRUE);
  gSystem->mkdir("png", kTRUE);


  // Individual settings
  //----------------------------------------------------------------------------
  if (parameter.Contains("dg0"))
    {
      xtitle = "#Delta#kappa^{Z}";
      ytitle = "#lambda";
      xmin   = -0.5;
      xmax   =  0.5;
      ymin   = -0.039;
      ymax   =  0.053;
    }
  else if (parameter.Contains("lam0"))
    {
      xtitle = "#Delta#kappa^{Z}";
      ytitle = "#Deltag^{Z}_{1}";
      xmin   = -0.53;
      xmax   =  0.53;
      ymin   = -0.05;
      ymax   =  0.09;
    }
  else if (parameter.Contains("dk0"))
    {
      xtitle = "#Deltag^{Z}_{1}";
      ytitle = "#lambda";
      xmin   = -0.059;
      xmax   =  0.059;
      ymin   = -0.037;
      ymax   =  0.052;
    }


  // Read the input file
  //----------------------------------------------------------------------------
  TFile* file = new TFile("rootfiles/contours_" + parameter + "_2Dpol2.root", "read");

  TGraph* cont_exp_68 = (TGraph*)file->Get("cont_exp_68");
  TGraph* cont_exp_95 = (TGraph*)file->Get("cont_exp_95");
  TGraph* cont_exp_99 = (TGraph*)file->Get("cont_exp_99");
  TGraph* cont_obs_95 = (TGraph*)file->Get("cont_obs_95");
  TGraph* bestFit     = (TGraph*)file->Get("bestFit");

  bestFit->SetMarkerSize(1.5);
  bestFit->SetMarkerStyle(34);

  TGraph* g_large = new TGraph(2);

  g_large->SetPoint(0, -1.0, 1.0);
  g_large->SetPoint(1,  1.0, 1.0);


  // Draw
  //----------------------------------------------------------------------------
  TCanvas* canvas = new TCanvas("canvas", "canvas");

  TMultiGraph* mg = new TMultiGraph();

  mg->Add(cont_exp_68);
  mg->Add(cont_exp_95);
  mg->Add(cont_exp_99);
  mg->Add(cont_obs_95);
  mg->Add(bestFit, "p");
  mg->Add(g_large);

  mg->Draw("ac");

  mg->SetMinimum(ymin);
  mg->SetMaximum(ymax);


  // Axis labels
  //----------------------------------------------------------------------------
  TAxis* xaxis = mg->GetXaxis();
  TAxis* yaxis = mg->GetYaxis();
  
  xaxis->SetLabelFont  (    42);
  xaxis->SetLabelOffset(  0.01);
  xaxis->SetLabelSize  (  0.05);
  xaxis->SetNdivisions (   505);
  xaxis->SetTitle      (xtitle);
  xaxis->SetTitleFont  (    42);
  xaxis->SetTitleOffset(   1.2);
  xaxis->SetTitleSize  (  0.05);

  xaxis->SetLimits(xmin, xmax);

  yaxis->SetLabelFont  (    42);
  yaxis->SetLabelOffset(  0.01);
  yaxis->SetLabelSize  (  0.05);
  yaxis->SetNdivisions (   505);
  yaxis->SetTitle      (ytitle);
  yaxis->SetTitleFont  (    42);
  yaxis->SetTitleOffset(   1.6);
  yaxis->SetTitleSize  (  0.05);

  canvas->Modified();


  // Legend
  //----------------------------------------------------------------------------
  Double_t x0 = 0.580;
  Double_t y0 = 0.755;

  DrawTLegend(x0 - 0.36, y0 + 2.*(_yoffset+0.001), (TH1F*)cont_exp_68, " Expected 68% CL", "l");
  DrawTLegend(x0 - 0.36, y0 + 1.*(_yoffset+0.001), (TH1F*)cont_exp_95, " Expected 95% CL", "l");
  DrawTLegend(x0,        y0 + 2.*(_yoffset+0.001), (TH1F*)cont_exp_99, " Expected 99% CL", "l");
  DrawTLegend(x0,        y0 + 1.*(_yoffset+0.001), (TH1F*)cont_obs_95, " Observed 95% CL", "l");
  DrawTLegend(x0,        y0,                       (TH1F*)bestFit,     " Best fit",          "p");


  // Finish it
  //----------------------------------------------------------------------------
  DrawTLatex(_cmsTextFont,   0.190, 0.94, 0.055, 11, "CMS");
  //  DrawTLatex(_extraTextFont, 0.315, 0.94, 0.030, 11, "Preliminary");
  DrawTLatex(_lumiTextFont,  0.940, 0.94, 0.040, 31, "19.6 fb^{-1} (8 TeV)");

  canvas->SaveAs("pdf/lZ_dkg_2dlimit_" + parameter + "_2Dpol2_deltaNLL.pdf");
  canvas->SaveAs("png/lZ_dkg_2dlimit_" + parameter + "_2Dpol2_deltaNLL.png");
}
Ejemplo n.º 15
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();

}
Ejemplo n.º 16
0
void IsovsPt(){


  TFile *f1 = new TFile("../../CutTMVATrees_Barrel.root");
 
  float ppt,peta,Sie_ie,iso_P,iso_C,iso_N,to_e,weight;
  int nvtx;

  gStyle->SetOptStat(0);



  //Signal Tree
  t_S->SetBranchAddress("Sieie",&Sie_ie);
  t_S->SetBranchAddress("isoP",&iso_P);
  t_S->SetBranchAddress("isoC",&iso_C);
  t_S->SetBranchAddress("isoN",&iso_N);
  t_S->SetBranchAddress("ToE",&to_e);
  t_S->SetBranchAddress("weighT",&weight);
  t_S->SetBranchAddress("Nvtx",&nvtx);
  t_S->SetBranchAddress("Peta",&peta);
  t_S->SetBranchAddress("Ppt",&ppt);

  //Background Tree
  t_B->SetBranchAddress("Sieie",&Sie_ie);
  t_B->SetBranchAddress("isoP",&iso_P);
  t_B->SetBranchAddress("isoC",&iso_C);
  t_B->SetBranchAddress("isoN",&iso_N);
  t_B->SetBranchAddress("ToE",&to_e);
  t_B->SetBranchAddress("weighT",&weight);
  t_B->SetBranchAddress("Nvtx",&nvtx);
  t_B->SetBranchAddress("Peta",&peta);
  t_B->SetBranchAddress("Ppt",&ppt);



  TH2F *isoCptS = new TH2F("isoCptS","Iso Charge vs Pt",100,0,200,3000,0,30);
  TH2F *isoNptS = new TH2F("isoNptS","Iso Neutral vs Pt",100,0,200,3000,0,30);
  TH2F *isoPptS = new TH2F("isoPptS","Iso Photon vs Pt",100,0,200,3000,0,30);




  for(int i  = 0; i < t_S->GetEntries();i++){

    t_S->GetEntry(i);

 
    isoCptS->Fill(ppt,iso_C);
 
    if(to_e < 0.05){
      
      isoNptS->Fill(ppt,iso_N);

    }

    isoPptS->Fill(ppt,iso_P);
  }




  // Now that we have the Iso vs pt histograms lets see the efficiency in pt bins

  double BinCch [100][3000] = {0};
  double BinCph [100][3000] = {0};
  double BinCh  [100][3000] = {0};
 
  double ptX[100] ={0};

  

  cout<<"here"<<endl;

  for(int j  = 0 ; j < 100 ; j++){
  
    double ptx = 200.0*j/100 + 1.0; 
    ptX[j] = ptx; 

    for(int i  = 0; i < 3000 ; i++){
      double isocx = 30.0*i/3000 + 0.005; 
      double isopx = 30.0*i/3000 + 0.005; 
      double isonx = 30.0*i/3000 + 0.005; 
      
      int bin =  isoCptS->FindBin(ptx,isocx);    
      BinCch[j][i] = isoCptS->GetBinContent(bin);

      bin =  isoPptS->FindBin(ptx,isopx);    
      BinCph[j][i] = isoPptS->GetBinContent(bin);

      bin =  isoNptS->FindBin(ptx,isonx);    
      BinCh[j][i] = isoNptS->GetBinContent(bin);

    
    
    }

  } 




  double ch_95[100] = {0};
  double ch_90[100] = {0}; 
  double ch_80[100] = {0}; 
  double ch_70[100] = {0}; 
  
  

  double ph_95[100] = {0};
  double ph_90[100] = {0}; 
  double ph_80[100] = {0}; 
  double ph_70[100] = {0}; 
  
  double ne_95[100] = {0};
  double ne_90[100] = {0}; 
  double ne_80[100] = {0}; 
  double ne_70[100] = {0}; 
  
  double ch_95e[100] = {0};
  double ch_90e[100] = {0}; 
  double ch_80e[100] = {0}; 
  double ch_70e[100] = {0}; 
  
  double ph_95e[100] = {0}; 
  double ph_90e[100] = {0}; 
  double ph_80e[100] = {0}; 
  double ph_70e[100] = {0}; 
  
  double ne_95e[100] = {0};
  double ne_90e[100] = {0}; 
  double ne_80e[100] = {0}; 
  double ne_70e[100] = {0}; 



  
  for(int j = 0 ; j  < 100; j ++){
    
    double totC = 0;
    double totN = 0;
    double totP = 0;
    
    for(int i = 0; i < 3000; i++) totC = totC + BinCch[j][i];
    for(int i = 0; i < 3000; i++) totN = totN + BinCh[j][i]; 
    for(int i = 0; i < 3000; i++) totP = totP + BinCph[j][i]; 

    double entrC = 0;
    double entrP = 0;
    double entrN = 0;
    
    int passc95 = 0; 
    int passc9 = 0;
    int passc8 = 0;
    int passc7 = 0;

    int passp95 = 0; 
    int passp9 = 0;
    int passp8 = 0;
    int passp7 = 0;

    int passn95 = 0; 
    int passn9 = 0;
    int passn8 = 0;
    int passn7 = 0; 

    for(int i  = 0; i < 3000 ; i++){
      
      entrC = entrC + BinCch[j][i];
      entrP = entrP + BinCph[j][i];
      entrN = entrN + BinCh[j][i];

      //------- photon
      if(passp95 == 0 && entrP*1.0/totP  > 0.95){
	
	double num = sqrt(entrP);
	double den = sqrt(totP);

	ph_95e[j] = 0.95*sqrt(pow(num/totP,2) + pow(den/entrP,2) );



	ph_95[j] = i*0.01;
	passp95= 1; 
      }

      


      if(passp9 == 0 && entrP*1.0/totP  > 0.90){
	
	double num = sqrt(entrP);
	double den = sqrt(totP);

	ph_90e[j] = 0.9*sqrt(pow(num/totP,2) + pow(den/entrP,2) );



	ph_90[j] = i*0.01;
	passp9 = 1; 
      }
      if(passp8 == 0 && entrP*1.0/totP  > 0.80){

	
	double num = sqrt(entrP);
	double den = sqrt(totP);

	ph_80e[j] = 0.8*sqrt(pow(num/totP,2) + pow(den/entrP,2) );

	
	ph_80[j] = i*0.01;
	passp8 = 1; 
      }
      if(passp7 == 0 && entrP*1.0/totP  > 0.70){

	
	double num = sqrt(entrP);
	double den = sqrt(totP);

	ph_70e[j] = 0.7*sqrt(pow(num/totP,2) + pow(den/entrP,2) );



	ph_70[j] = i*0.01;
	passp7 = 1; 
      }


      //--------- charge
      if(passc95 == 0 && entrC*1.0/totC  > 0.95){
	
	double num = sqrt(entrC);
	double den = sqrt(totC);

	ch_95e[j] = 0.95*sqrt(pow(num/totC,2) + pow(den/entrC,2) );



	ch_95[j] = i*0.01;
	passc95= 1; 
      }
      

      if(passc9 == 0 && entrC*1.0/totC  > 0.90){

	double num = sqrt(entrC);
	double den = sqrt(totC);

	ch_90e[j] = 0.9*sqrt(pow(num/totC,2) + pow(den/entrC,2) );

	ch_90[j] = i*0.01;
	passc9 = 1; 
      }
      if(passc8 == 0 && entrC*1.0/totC  > 0.80){

	double num = sqrt(entrC);
	double den = sqrt(totC);

	ch_80e[j] = 0.8*sqrt(pow(num/totC,2) + pow(den/entrC,2) );

	ch_80[j] = i*0.01;
	passc8 = 1; 
      }
      if(passc7 == 0 && entrC*1.0/totC  > 0.70){
	
	double num = sqrt(entrC);
	double den = sqrt(totC);

	ch_70e[j] = 0.7*sqrt(pow(num/totC,2) + pow(den/entrC,2) );

	ch_70[j] = i*0.01;
	passc7 = 1; 
      }

      
      //--------- neutral
      if(passn95 == 0 && entrN*1.0/totN  > 0.95){
	
	double num = sqrt(entrN);
	double den = sqrt(totN);

	ne_95e[j] = 0.95*sqrt(pow(num/totN,2) + pow(den/entrN,2) );



	ne_95[j] = i*0.01;
	passn95= 1; 
      }
    






      if(passn9 == 0 && entrN*1.0/totN  > 0.90){

	
	double num = sqrt(entrN);
	double den = sqrt(totN);

	ne_90e[j] = 0.9*sqrt(pow(num/totN,2) + pow(den/entrN,2) );



	ne_90[j] = i*0.01;
	passn9 = 1; 
      }
      if(passn8 == 0 && entrN*1.0/totN  > 0.80){

	
	double num = sqrt(entrN);
	double den = sqrt(totN);

	ne_80e[j] = 0.8*sqrt(pow(num/totN,2) + pow(den/entrN,2) );


	ne_80[j] = i*0.01; 
	passn8 = 1; 
      }
      if(passn7 == 0 && entrN*1.0/totN  > 0.70){

	
	double num = sqrt(entrN);
	double den = sqrt(totN);

	ne_70e[j] = 0.7*sqrt(pow(num/totN,2) + pow(den/entrN,2) );


	ne_70[j] = i*0.01;
	passn7 = 1; 
      }


    }
    
  }
  

  double ptXe[100] = {2};
  
  TGraph *p95 = new TGraphErrors(100,ptX,ph_95,ptXe,ph_95e);
  TGraph *p9 = new TGraphErrors(100,ptX,ph_90,ptXe,ph_90e);
  TGraph *p8 = new TGraphErrors(100,ptX,ph_80,ptXe,ph_80e);
  TGraph *p7 = new TGraphErrors(100,ptX,ph_70,ptXe,ph_70e);

  p95->SetMarkerColor(kMagenta);
  p9->SetMarkerColor(kRed);
  p8->SetMarkerColor(kOrange);
  p7->SetMarkerColor(kYellow);
 

  p95->SetMarkerSize(kMagenta);
  p9->SetMarkerSize(1);
  p8->SetMarkerSize(1);
  p7->SetMarkerSize(1);

  
  p95->SetLineColor(kMagenta);
  p9->SetLineColor(kRed);
  p8->SetLineColor(kOrange);
  p7->SetLineColor(kYellow);






  TGraph *n95 = new TGraphErrors(100,ptX,ne_95,ptXe,ne_95e);
  TGraph *n9 = new TGraphErrors(100,ptX,ne_90,ptXe,ne_90e);
  TGraph *n8 = new TGraphErrors(100,ptX,ne_80,ptXe,ne_80e);
  TGraph *n7 = new TGraphErrors(100,ptX,ne_70,ptXe,ne_70e);

  n95->SetMarkerColor(kMagenta);
  n9->SetMarkerColor(kRed);
  n8->SetMarkerColor(kOrange);
  n7->SetMarkerColor(kYellow);

  n95->SetMarkerSize(kMagenta);
  n9->SetMarkerSize(1);
  n8->SetMarkerSize(1);
  n7->SetMarkerSize(1);

  n95->SetLineColor(kMagenta);
  n9->SetLineColor(kRed);
  n8->SetLineColor(kOrange);
  n7->SetLineColor(kYellow);




  TGraph *c95 = new TGraphErrors(100,ptX,ch_95,ptXe,ch_95e);
  TGraph *c9 = new TGraphErrors(100,ptX,ch_90,ptXe,ch_90e);
  TGraph *c8 = new TGraphErrors(100,ptX,ch_80,ptXe,ch_80e);
  TGraph *c7 = new TGraphErrors(100,ptX,ch_70,ptXe,ch_70e);

  c95->SetMarkerColor(kMagenta); 
  c9->SetMarkerColor(kRed);
  c8->SetMarkerColor(kOrange);
  c7->SetMarkerColor(kYellow);


  c95->SetLineColor(kMagenta); 
  c9->SetLineColor(kRed);
  c8->SetLineColor(kOrange);
  c7->SetLineColor(kYellow);



  c95->SetMarkerSize(1);
  c9->SetMarkerSize(1);
  c8->SetMarkerSize(1);
  c7->SetMarkerSize(1);




  TMultiGraph *PhoIso = new TMultiGraph();
  TMultiGraph *ChgIso = new TMultiGraph();
  TMultiGraph *NeuIso = new TMultiGraph();


  PhoIso->Add(p95,"p");
  PhoIso->Add(p9,"p");
  PhoIso->Add(p7,"p");
  PhoIso->Add(p8,"p");


  ChgIso->Add(c95,"p");
  ChgIso->Add(c9,"p");
  ChgIso->Add(c7,"p");
  ChgIso->Add(c8,"p");

  NeuIso->Add(n95,"p");
  NeuIso->Add(n9,"p");
  NeuIso->Add(n7,"p");
  NeuIso->Add(n8,"p");

  



  TCanvas *c1 = new TCanvas("c1","Iso P vs Pt",1000,500);
  c1->Divide(2,1); 

  c1->cd(1);
  PhoIso->Draw("AP");
  PhoIso->GetXaxis()->SetTitle("Pt GeVc^{-1}");
  PhoIso->GetYaxis()->SetTitle("Isolation PF:gamma");
  

  
  c1->cd(2)->SetLogz();
  
  isoPptS->Draw("colz");  
  isoPptS->GetXaxis()->SetTitle("Pt GeVc^{-1}");
  isoPptS->GetYaxis()->SetTitle("Isolation PF:gamma");

  c1->SaveAs("PhotonIso_95.png");


  TCanvas *c2 = new TCanvas("c2","Iso C vs Pt",1000,500);
  c2->Divide(2,1);
  c2->cd(1);
  ChgIso->Draw("AP");
  ChgIso->GetXaxis()->SetTitle("Pt GeVc^{-1}");
  ChgIso->GetYaxis()->SetTitle("Isolation PF:ch hadrons");
  

  c2->cd(2)->SetLogz();
  
  isoCptS->Draw("colz");  
  isoCptS->GetXaxis()->SetTitle("Pt GeVc^{-1}");
  isoCptS->GetYaxis()->SetTitle("Isolation PF:ch hadrons");


  c2->SaveAs("ChargeIso_95.png");
  
  TCanvas *c3 = new TCanvas("c3","Iso N vs Pt",1000,500);
  c3->Divide(2,1);
  c3->cd(1);
  NeuIso->Draw("AP");
  NeuIso->GetXaxis()->SetTitle("Pt GeVc^{-1}");
  NeuIso->GetYaxis()->SetTitle("Isolation PF:h0");
  

  c3->cd(2)->SetLogz();
  
  isoNptS->Draw("colz");  
  isoNptS->GetXaxis()->SetTitle("Pt GeVc^{-1}");
  isoNptS->GetYaxis()->SetTitle("Isolation PF:h0");


  c3->SaveAs("NeutralIso_95_HoEcut.png");

  c1->Update();
  c2->Update();
  c3->Update();

}
// =================================================
void plotter::plotEffOnOneCanvas( string extension )
{
	yAxisLabel_ = "Efficiency";
	xAxisLabel_ = "Electron p_{T} (GeV)";
	
	x_[6] = 125;
	xRange_[6] = 75;
	
	setExtension( extension );
   setOutFilexPrefix( "eff" );
	setUpCanvas();
	
	TMultiGraph *mg = new TMultiGraph();
	
   for( int j = 0; j < max_-1; j++)
	{
		// Read Data input
      input.readDataEff( inputDataPath_, files1_.at(j) );
		eff1_ = input.getDataEff().first;
		eff_error1_ = input.getDataEff().second;
		
      TGraphAsymmErrors *tgaeEffData = new TGraphAsymmErrors( numOfPoints_, x_, eff1_, xRange_, xRange_, eff_error1_, eff_error1_);
      tgaeEffData->SetTitle("TGraphAsymmErrors for Data efficiencies");
      tgaeEffData->SetMarkerSize(1);
      if (j == 0) tgaeEffData->SetMarkerStyle(20);
		else if (j == 1) tgaeEffData->SetMarkerStyle(24);
      else if (j == 2) tgaeEffData->SetMarkerStyle(21);
      else tgaeEffData->SetMarkerStyle(25);
		
		tgaeEffData->SetMarkerColor(kAzure - 2*j);
      tgaeEffData->SetLineColor(kAzure - 2*j);
		
		legend_->SetX1(.60);
		legend_->SetX2(.87);
		legend_->AddEntry(tgaeEffData, etaRegionLegend_.at(j), "p");
		
		mg->Add(tgaeEffData,"p");
   } // end for j
	
	canvas->SetLogx();
	
	mg->SetMinimum(0.4);
	mg->SetMaximum(1);
	mg->Draw("A");
	mg->GetXaxis()->SetMoreLogLabels();
	mg->GetXaxis()->SetTitle( xAxisLabel_ );
   mg->GetYaxis()->SetTitle( yAxisLabel_ );
	mg->GetXaxis()->SetTitleOffset(1.3);
	mg->GetYaxis()->SetTitleOffset(1.25);
	
	legend_->Draw();
	pt_->Draw();
	texZee_->Draw();
//	texCMS_->Draw();
//	texLumi_->Draw();
	
	cout << "--------------------------------------------------------------------------------" << endl;
	TString fileName = "eff_04";
	if ( extension_ == "all" )
	{
		canvas->SaveAs( outPlotsDir_ + fileName + ".pdf" );
		canvas->SaveAs( outPlotsDir_ + fileName + ".png" );
		canvas->SaveAs( outPlotsDir_ + fileName + ".eps" );
//		canvas->SaveAs( outPlotsDir_ + fileName + ".ps"  );
		canvas->SaveAs( outPlotsDir_ + fileName + ".C"   );
		canvas->SaveAs( outPlotsDir_ + fileName + ".root");
	}
	else
		canvas->SaveAs( outPlotsDir_ + fileName + extension_ );
	cout << "--------------------------------------------------------------------------------" << endl;
	
	canvas->Destructor();
	legend_->Clear();
	
	// Clear out files vector
   outFiles_.clear();
	
} // end plotEffOnOneCanvas
Ejemplo n.º 18
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);
}
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);
}
Ejemplo n.º 20
0
void qcd() {
   
  setTDRStyle();

  std::vector<double> bins;
  bins.push_back(275.);
  bins.push_back(325.);
  for ( int i = 0; i < 6; ++i ) { bins.push_back(375.+100.*i); }

  std::vector<double> widths;
  widths.push_back(25.);
  widths.push_back(25.);
  for ( int i = 0; i < 6; ++i ) { widths.push_back(50.); }

  std::vector<double> effs;
  effs.push_back(1.13);
  effs.push_back(0.83);
  effs.push_back(0.72);
  effs.resize(8,0.84);
//   effs.push_back(0.84);
//   effs.push_back(1.13);
//   effs.push_back(1.32);
//   effs.push_back(1.41);
//   effs.push_back(2.09);

  std::vector<double> errs;
  errs.push_back(0.34);
  errs.push_back(0.24);
  errs.push_back(0.19);
  errs.resize(8,0.14);
//   errs.push_back(0.14);
//   errs.push_back(0.24);
//   errs.push_back(0.35);
//   errs.push_back(0.50);
//   errs.push_back(0.80);

  std::vector<double> entries;
  entries.push_back(46272.);
  entries.push_back(43592.);
  entries.push_back(58746.);
  entries.push_back(78644.);
  entries.push_back(29516.);
  entries.push_back(11668.);
  entries.push_back(5416.);
  entries.push_back(5368.);

  std::vector<double> prescales;
  prescales.push_back(2000.);
  prescales.push_back(1000.);
  prescales.push_back(500.);
  prescales.push_back(125.);
  prescales.push_back(125.);
  prescales.push_back(125.);
  prescales.push_back(125.);
  prescales.push_back(125.);
  
  TCanvas* c = new TCanvas("tmp","tmp",900,600);
  
  TGraphAsymmErrors* gr1 = new TGraphAsymmErrors(8);
  gr1->SetName("Graph1");
  gr1->SetTitle("");
  gr1->SetFillColor(1);
  gr1->SetLineWidth(2);
  gr1->SetMarkerStyle(24);
  gr1->SetMarkerColor(1);
  gr1->SetMarkerSize(2.);

  TGraphAsymmErrors* gr2 = new TGraphAsymmErrors(8);
  gr2->SetName("Graph2");
  gr2->SetTitle("");
  gr2->SetFillColor(1);
  gr2->SetLineWidth(2);
  gr2->SetMarkerStyle(20);
  gr1->SetMarkerColor(1);
  gr2->SetMarkerSize(1.5);

  for ( int i = 0; i < bins.size(); ++i ) {
    double x = bins[i]+widths[i];
    double y = entries[i]*prescales[i];
    double ex = widths[i];
    double ey = sqrt(entries[i])*prescales[i];
    
    gr1->SetPoint(i+1,x,y);
    gr1->SetPointError(i+1,0.,0.,ey,ey);

    y = y / effs[i];
    ey = y * sqrt( (ey/y)*(ey/y) + (errs[i]/effs[i])*(errs[i]/effs[i]) );
    
    gr2->SetPoint(i+1,x,y);
    gr2->SetPointError(i+1,ex,ex,ey,ey);

    std::cout << " HT= " << bins[i] << " yield= " << y << " +/- " << ey << std::endl; 
 
  }
  
  TMultiGraph* mg = new TMultiGraph();
  mg->Add(gr1,"p");
  mg->Add(gr2,"p");
  mg->Draw("ap");
  mg->GetXaxis()->SetTitle("H_{T} (GeV)");
  mg->GetYaxis()->SetTitle("Bulk yields");
  mg->GetYaxis()->SetRangeUser(1.e5,1.e9);
  mg->GetXaxis()->SetRangeUser(275.,975.);

  TF1* fit = new TF1("fit","expo",275.,875.);
  gr2->Fit(fit,"R");
  fit->Draw("same");
  
  TLegend* leg = new TLegend( 0.45, 0.70, 0.85, 0.80 );
  leg->SetFillColor(0);
  leg->SetLineColor(0); 
  leg->SetShadowColor(0); 
  leg->SetTextSize(0.035);
  leg->AddEntry(gr1,"Raw counts weighted by prescales","p");
  leg->AddEntry(gr2,"Trigger efficiency corrected","p");
  leg->Draw("same");

  std::stringstream sss;
  sss << "CMS, 1.5 fb^{-1}, #sqrt{s} = 8 TeV";
  TLatex* tex = new TLatex(0.17,0.88,sss.str().c_str());
  tex->SetNDC();
  tex->SetTextSize(0.035);
  tex->Draw();

  c->SetLogy();

  return;
  
}
Ejemplo n.º 21
0
void pointsed(TString filename = "btagpatanalyzerpy.root", TString check="") {
	TString cmssw;
	// 167
	
	cmssw = "$3.1.0_pre9$";
	
	TFile *f = TFile::Open(filename);
/////////////////////////////////////////////////////////////////////////////////////////
	std::vector< TString > checks;
	checks.push_back("");
	checks.push_back("Corr30_");
	checks.push_back("Corr30t0_");
	checks.push_back("Corr30t1_");
	checks.push_back("Corr30t2_");
	checks.push_back("Corr30t0_nConstituent_");
	checks.push_back("Corr30t1_nConstituent_");
	checks.push_back("Corr30t2_nConstituent_");
	checks.push_back("Uncor10_");
	checks.push_back("Uncor10t0_");
	checks.push_back("Uncor10t1_");
	checks.push_back("Uncor10t2_");
	checks.push_back("Uncor10t0_nConstituent_");
	checks.push_back("Uncor10t1_nConstituent_");
	checks.push_back("Uncor10t2_nConstituent_");
/////////////////////////////////////////////////////////////////////////////////////////
	std::vector< TString > taggers;
	std::vector< TString > labeltag;
        std::vector< int> colorlines;
	taggers.push_back( "TC2" );colorlines.push_back( 1 );labeltag.push_back( "TCHE");
	taggers.push_back( "TC3" );colorlines.push_back( 2 );labeltag.push_back( "TCHP");
	taggers.push_back( "TP"  );colorlines.push_back( 3 );labeltag.push_back( "JP");
	taggers.push_back( "SSV" );colorlines.push_back( 4 );labeltag.push_back( "SSV");
	taggers.push_back( "CSV" );colorlines.push_back( 5 );labeltag.push_back( "CSV");
	taggers.push_back( "MSV" );colorlines.push_back( 6 );labeltag.push_back( "CSVMVAB");
	taggers.push_back( "SMT" );colorlines.push_back( 8 );labeltag.push_back( "SMT");
	taggers.push_back( "BTP" );colorlines.push_back( 9 );labeltag.push_back( "JBP");
	taggers.push_back( "SMTbyIP3d" );colorlines.push_back( 11 );labeltag.push_back( "SMTByIP3d");
	taggers.push_back( "SMTbyPt" );colorlines.push_back( 12 );labeltag.push_back( "SMTByPt");
	taggers.push_back( "SETbyIP3d" );colorlines.push_back( 13 );labeltag.push_back( "SETByIP3d");
	taggers.push_back( "SETbyPt" );colorlines.push_back( 14 );labeltag.push_back( "SETByPt");
//	taggers.push_back( "IPM" );colorlines.push_back( 11 );labeltag.push_back( "IPMVAB");
//	taggers.push_back( "SMNIPT" );colorlines.push_back( 12 );labeltag.push_back( "SMTNoIP");

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////	
//ed	for ( size_t ichks = 0; ichks < checks.size(); ++ichks ) {
//ed		TString check = checks[ichks];
	
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////	
        TString PerfTitle= check;
        if (check == "") PerfTitle="uncorr pt>30";
	if (check == "Corr30_") PerfTitle="pt>30";
	if (check == "Corr30t0_") PerfTitle="pt>30, #tracks > 0";
	if (check == "Corr30t1_") PerfTitle="pt>30, #tracks > 1";
	if (check == "Corr30t2_") PerfTitle="pt>30, #tracks > 2";
	if (check == "Corr30t0_nConstituent_") PerfTitle="pt>30, #tracks > 0 & nConstituents >1";
	if (check == "Corr30t1_nConstituent_") PerfTitle="pt>30, #tracks > 1 & nConstituents >1";
	if (check == "Corr30t2_nConstituent_") PerfTitle="pt>30, #tracks > 2 & nConstituents >1";
	if (check == "Uncor10_") PerfTitle="uncorr pt>10";
	if (check == "Uncor10t0_") PerfTitle="uncorr pt>10 #tracks > 0";
	if (check == "Uncor10t1_") PerfTitle="uncorr pt>10 #tracks > 1";
	if (check == "Uncor10t2_") PerfTitle="uncorr pt>10 #tracks > 2";
	if (check == "Uncor10t0_nConstituent_") PerfTitle="uncorr pt>10 #tracks > 0 & nConstituents >1";
	if (check == "Uncor10t1_nConstituent_") PerfTitle="uncorr pt>10 #tracks > 1 & nConstituents >1";
	if (check == "Uncor10t2_nConstituent_") PerfTitle="uncorr pt>10 #tracks > 2 & nConstituents >1";

	std::vector< TString > discriminators;
        for ( size_t itagger = 0; itagger < taggers.size(); ++itagger ) {
  		discriminators.push_back( check+"disc"+taggers[itagger]+"_udsg" );
	}
//	discriminators.push_back( "discTC3_udsg" );
//	discriminators.push_back( "discTP_udsg" );

	TCanvas *cv = new TCanvas("cv","cv",900,900);
	TMultiGraph *mg =new TMultiGraph();
	TLegend *legend0 = new TLegend(0.68,0.12,0.88,0.32);
        // inverted axis
	TMultiGraph *mginv =new TMultiGraph();
	TLegend *legend1 = new TLegend(0.65,0.18,0.85,0.48);
	std::ofstream salida("BTagPATop3"+check+".txt");
	
	for ( size_t itagger = 0; itagger < taggers.size(); ++itagger ) {

		TString tag    = check+"g"+taggers[itagger]+"_udsg";
		TGraphErrors *agraph = (TGraphErrors*) gDirectory->Get("BTagPATAnalyzer"+taggers[itagger]+"/"+taggers[itagger]+"/"+tag);

		
		TGraph *dgraph = (TGraph*) gDirectory->Get("BTagPATAnalyzer"+taggers[itagger]+"/"+taggers[itagger]+"/"+discriminators[itagger]);
//		TGraph *udsgvsdgraph = new TGraph(dgraph->GetN(),dgraph->GetY(),dgraph->GetX());
		dgraph->Sort();
//		udsgvsdgraph->Sort();

		TGraphErrors *g = new TGraphErrors(agraph->GetN(),agraph->GetY(),agraph->GetX(),agraph->GetEY(),agraph->GetEX());
		g->Sort();
		g->SetLineColor(itagger+1);
                legend0 -> AddEntry(g,taggers[itagger],"l");
		mg->Add(g);

                //inverted axis
		TGraphErrors *ginv = new TGraphErrors(agraph->GetN(),agraph->GetX(),agraph->GetY(),agraph->GetEX(),agraph->GetEY());
		ginv->Sort();
		ginv->SetLineColor(colorlines[itagger]);
		ginv->SetMarkerStyle(8);
		ginv->SetMarkerColor(colorlines[itagger]);
                legend1 -> AddEntry(ginv,labeltag[itagger],"l");
		mginv->Add(ginv);

		std::cout << " Tagger: " << tag << std::endl;
		std::cout << " Loose(10%): " << " cut > " << std::setprecision(4) << dgraph->Eval(0.1) << " b-eff = " << g->Eval(0.1) << std::endl;
		std::cout << " Medium(1%):  " << " cut > " << std::setprecision(4) << dgraph->Eval(0.01) << " b-eff = " << g->Eval(0.01) << std::endl;
		std::cout << " Tight(0.1%) = " << " cut > " << std::setprecision(4) << dgraph->Eval(0.001) << " b-eff = " << g->Eval(0.001) << std::endl;
                salida << " " << taggers[itagger] << endl;
	        salida << " #bin \t b-eff  \t err-beff \t  non-beff \t err-non-b"<< endl;
        	for ( size_t i=0;i< agraph->GetN();i++){ 
			salida	<< "  " << (i+1) << " \t "
				<< agraph->GetX()[i] <<" \t " 
				<< agraph->GetEX()[i]<<" \t "
				<< agraph->GetY()[i] <<" \t "
				<< agraph->GetEY()[i]
                       		<< " "<< endl;
		}

	}
//	cv->SetLogx();
	mg->Draw("ALP");
	mg->GetYaxis()->SetTitle("b-eff");
	mg->GetXaxis()->SetTitle("udsg-mistagging");
	legend0 -> Draw();
        cv-> SetGrid();
	cv-> Print ("BTagPATop"+check+".eps");
	cv-> Print ("BTagPATop"+check+".png");
	cv->cd(0);
	cv->SetLogx();
	mg->Draw("ALP");
	legend0 -> Draw();
	cv-> Print ("BTagPATop1"+check+".eps");
	cv-> Print ("BTagPATop1"+check+".png");
        //inverted axis
	TCanvas *cvinv = new TCanvas("cvinv","cvinv",700,700);
        cvinv->SetLogy(0);
	mginv->Draw("ALP");
	mginv->GetXaxis()->SetTitle("b-eff");
	mginv->GetYaxis()->SetTitle("udsg-mistagging");
	legend1 -> Draw();
        cvinv->SetGrid();
	cvinv-> Print ("BTagPATop2"+check+".eps");
	cvinv-> Print ("BTagPATop2"+check+".png");
	cvinv->cd(0);
//	cvinv->Update();
//	cvinv->SetLogx();
//	mginv->SetXmin(10^-4);
//      axis range using a histogram helper
    TH2D*hpx = new TH2D("hpx",PerfTitle,200,0.0,1.005,200,0.00002,1.05);
        hpx->SetStats(kFALSE);
		hpx->Draw();
	hpx->GetXaxis()->SetTitle("b-eff");
	hpx->GetYaxis()->SetTitle("udsg-mistagging");
	cvinv->SetLogy(1);
	mginv->Draw("AP");
	legend1 -> Draw();
	cvinv-> Print ("BTagPATop3"+check+".eps");
	cvinv-> Print ("BTagPATop3"+check+".png");
	//ed}
}
Ejemplo n.º 22
0
TCanvas * makegraph()
{
	TCanvas	*c1 = new TCanvas();
	// OUR DATA	
	Double_t qsq[5]={0.125,0.375,0.625,0.875,1.125};//X-axis!
	Double_t crosssection[5]={3.32,1.78,0.998,0.601,0.383};
	Double_t xer[5]={0.125,0.125,0.125,0.125,0.125};
	Double_t pfluxerr[5]={4.2,4.8,5.1,4.5,6.3};
	Double_t pmaerr[5]={4.9,11.3,16.2,21.0,20.0};
	Double_t pstaterr[5]={0.02,0.02,0.02,0.03,0.05};
	Double_t fluxerr[5];
	Double_t maerr[5];
	Double_t staterr[5];
	for(int i=0; i<5; i++) fluxerr[i]=pfluxerr[i]*crosssection[i]*0.01;
	for(int i=0; i<5; i++) maerr[i]=pmaerr[i]*crosssection[i]*0.01;
	for(int i=0; i<5; i++) staterr[i]=pstaterr[i]*crosssection[i];

	//sum error in quadrature
	Double_t toterr[5];
	for(int i=0; i<5; i++) toterr[i]=sqrt(	fluxerr[i]*fluxerr[i] /*+ staterr[i]*staterr[i]*/ + maerr[i]*maerr[i]	);	
	TGraphErrors *gr = new TGraphErrors(5,qsq,crosssection,xer,toterr);

	//SCIBOONE
/*	double sciqsq[6] = {0.24,0.294,0.347,0.401,0.454,0.508};
	double scicsc[6] = {1.26,0.59,0.35,0.17,0.13,0.05};
	double scixerh[6] = {0.0268,0.0268,0.0268,0.0268,0.0268,0.0268};
	double scixerl[6] = {0.0268,0.0268,0.0268,0.0268,0.0268,0.0268};
	double sciyerh[6] = {0.42,0.14,0.08,0.04,0.04,0.01};
	double sciyerl[6] = {0.56,0.19,0.1,0.05,0.08,0.03};
	TGraphAsymmErrors *scigr = new TGraphAsymmErrors(6,sciqsq,scicsc,scixerl,scixerh,sciyerl,sciyerh);*/

	//MINIBOONE	
	double minqsq[17] = {0.133,0.201,0.268,0.336,0.404,0.472,0.539,0.607,0.674,0.741,0.809,0.877,0.944,1.012,1.079,1.147,1.214};
	double mincsc[17] = {3.35,2.95,2.5,2.09,1.75,1.42,1.18,0.92,0.77,0.6,0.49,0.39,0.31,0.28,0.22,0.2,0.14};
	double minxer[17] = {0.0338,0.0338,0.0338,0.0338,0.0338,0.0338,0.0338,0.0338,0.0338,0.0338,0.0338,0.0338,0.0338,0.0338,0.0338,0.0338,0.0338};
	double minyer[17] = {0.35,0.4,0.42,0.35,0.25,0.23,0.24,0.22,0.22,0.21,0.21,0.22,0.22,0.21,0.14,0.12,0.1};
	TGraphErrors *mingr = new TGraphErrors(17,minqsq,mincsc,minxer,minyer);

	//BNL
	double bnlqsq[7] = {0.425,0.525,0.625,0.725,0.825,0.925,1.025};
	double bnlcsc[7] = {1.65,1.09,0.8,0.65,0.42,0.29,0.2};
	double bnlxer[7] = {0.05,0.05,0.05,0.05,0.05,0.05,0.05};
	double bnlyer[7] = {0.12,0.09,0.09,0.08,0.08,0.08,0.08};
	TGraphErrors *bnlgr = new TGraphErrors(7,bnlqsq,bnlcsc,bnlxer,bnlyer);

	//Multigraph? maybE?
	TMultiGraph *mg = new TMultiGraph();
	
	//Draw our data
	//Systematix
//	gr->Draw("AP");
	gr->SetFillColor(2);
    gr->SetFillStyle(3001);
	gr->GetXaxis()->SetTitle("Q^{2} / GeV^{2} ");
	gr->GetYaxis()->SetTitle("#frac{d#sigma}{dQ^{2}} 10^{-39} cm^{2}GeV^{-2} ");
//    gr->Draw("a2");
//   gr->Draw("p");

	//statistical errs too!
	TGraphErrors *gstaterr = new TGraphErrors(5,qsq,crosssection,xer,staterr);
//	gstaterr->SetFillColor(4);
//	gstaterr->SetFillStyle(3001);
//	gstaterr->Draw("p");

	//overlay minib0One
	mingr->SetFillColor(kBlue);
	mingr->SetMarkerStyle(20);
	mingr->SetFillStyle(3004);
//	mingr->Draw("samea3");
//	mingr->Draw("same");

	//dont forget about good ol' BNL
	bnlgr->SetFillColor(kGreen);
	bnlgr->SetMarkerColor(50);
	bnlgr->SetFillStyle(3002);

	//MULTIGRAPH, ASSEMBLE!
	mg->Add(gr,"a2");
	mg->Add(gstaterr,"p");
	mg->Add(mingr,"3");
	mg->Add(bnlgr,"3");
	mg->Draw();
	
	TLegend *leg = new TLegend(0.7,0.9,0.9,0.7);
	leg->AddEntry(gr, "Systematic Errors","f");
	leg->AddEntry(gstaterr, "Statistical Errors","lep");
	leg->AddEntry(mingr, "Miniboone","f");
	leg->AddEntry(bnlgr, "BNL","f");
	leg->Draw();
	
//	bnlgr->SetMarkerColor(kRed);
//	bnlgr->SetMarkerStyle(20);
//	bnlgr->Draw("sameP");


//	TGraphErrors *gr1 = new TGraphErrors(5,qsq,crosssection,xer,staterr);
//	gr1->SetMarkerStyle(1);
//	TGraphErrors *gr2 = new TGraphErrors(5,qsq,crosssection,xer,fluxerr);
//	gr2->SetMarkerStyle(1);
//	TGraphErrors *gr3 = new TGraphErrors(5,qsq,crosssection,xer,maerr);
//	gr3->SetMarkerStyle(1);
//
//	TMultiGraph *g = new TMultiGraph();
//	g->Add(gr1);
//	g->Add(gr2);
//	g->Draw("AP");
//	g->SetTitle("Cross-Section Errors");
//	g->GetXaxis()->SetTitle("Q^{2}");
//	g->GetYaxis()->SetTitle("#frac{d#sigma}{dQ^{2}}");
//
//	g->Draw("AP");
	return c1;
}	
Ejemplo n.º 23
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");
  
}
Ejemplo n.º 24
0
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
Ejemplo n.º 25
0
void DeltaPlot::viewGMstar (Char_t const* title)
{
	FFactor GMS(12);
	GMS.LoadParameters(parametersFile);
	GMS.CheckParameters();
	//GMS.PrintParameters();

	const int nPoints = 2500;
	double qMin;
	double qMax;
	double qStep;
	double qA;

	double DX[nPoints], DY[nPoints], RY[nPoints];
	qMin = 0.004;
	qMax = 3.0;
	qStep = (qMax-qMin)/nPoints;
	qA = qMin;

	for (int i = 0; i < nPoints; i++) {
		qA = qMin + i*qStep;
		double qA2 = qA*qA;
		double gen = GMS.AbsGEN(-qA2);
		double gmn = GMS.AbsGMN(-qA2);
		double msq = massDi*massDi - massNucl*massNucl - qA2;
		double abq = sqrt((qA2 + msq*msq)/(4.*massDi*massDi));
		double jsc = (massDi+massNucl)/2./massNucl*(1.-qA2/4./massDi/massDi)*(1.-qA2/4./massNucl/massNucl);
		DX[i] = qA2;
		double mDip = 1. + qA2/0.71;
		double gD = 1./mDip/mDip;
		double gDmn = gD*(-muN);
		DY[i] = sqrt(2.)*2./3.*gDmn*jsc;
		double masst = qA2/(4.*massNucl*massNucl);
		double gmo = (GMS.ScalarOne(-qA2)-GMS.VectorOne(-qA2))/qA2+(GMS.ScalarTwo(-qA2)-GMS.VectorTwo(-qA2))/massN/massN/4.;
		RY[i] = sqrt(2.)*2./3.*gmn*jsc;
	}	
	
	c[k] = new TCanvas (uName("c",k), uName("Graph_",k), x0+k*s, y0+k*s, w, h);
	//c[k]->SetLogy(); // logarithmic scale

	TGraphErrors *g[5];
	TMultiGraph *mg = new TMultiGraph();
	Double_t EX0[100] = {0};

	// 1999-PRL-82-45_Frolov
	Double_t X1[] = {2.8, 4.0};
	Double_t Y1[] = {0.0859, 0.0402};
	Double_t U1[] = {0.0035, 0.0019};
	Double_t D1[] = {0.0035, 0.0019};
	g[1] = new TGraphErrors (2, X1, Y1, EX0, D1);
	g[1]->SetTitle("JLab/Hall C");
	g[1]->SetMarkerColor(2);
	g[1]->SetMarkerStyle(21);
	mg->Add(g[1]);

	// 2006-PRL-97-112003_Ungaro
	Double_t X2[] = {3.0, 3.5, 4.2, 5.0, 6.0};
	Double_t Y2[] = {0.0697, 0.0524, 0.0346, 0.0242, 0.0134};
	Double_t U2[] = {0.0010, 0.0011, 0.0012, 0.0014, 0.0014};
	Double_t D2[] = {0.0010, 0.0011, 0.0012, 0.0014, 0.0014};
	g[2] = new TGraphErrors (5, X2, Y2, EX0, D2);
	g[2]->SetTitle("JLaB/CLAS");
	g[2]->SetMarkerColor(4);
	g[2]->SetMarkerStyle(21);
	mg->Add(g[2]);

	// 1968-PL-28-148B_Bartel
	Double_t X3[] = {0.20, 0.30, 0.40, 0.47, 0.48, 0.50, 0.60, 0.63, 0.63, 0.77, 0.78, 0.79, 0.97, 0.98, 1.15, 1.34, 1.57, 2.34};
	Double_t Y3[] = {1.7700, 1.3800, 1.1700, 0.9780, 0.9610, 0.9640, 0.7660, 0.7350, 0.7190, 0.5700, 0.5720, 0.5530, 0.4460, 0.4460, 0.3260, 0.2690, 0.2090, 0.1020};
	Double_t U3[] = {0.0620, 0.0483, 0.0351, 0.0293, 0.0336, 0.0289, 0.0268, 0.0221, 0.0252, 0.0200, 0.0172, 0.0194, 0.0156, 0.0156, 0.0147, 0.0121, 0.0115, 0.0082};
	Double_t D3[] = {0.0620, 0.0483, 0.0351, 0.0293, 0.0336, 0.0289, 0.0268, 0.0221, 0.0252, 0.0200, 0.0172, 0.0194, 0.0156, 0.0156, 0.0147, 0.0121, 0.0115, 0.0082};
	g[3] = new TGraphErrors (18, X3, Y3, EX0, D3);
	g[3]->SetTitle("DESY");
	g[3]->SetMarkerColor(6);
	g[3]->SetMarkerStyle(22);
	mg->Add(g[3]);

	// 1975-PR-D12-1884_Stein
	Double_t X4[] = {0.09, 0.22, 0.46, 0.78, 1.17, 1.48, 1.82};
	Double_t Y4[] = {2.2448, 1.5824, 0.9147, 0.5007, 0.2708, 0.1728, 0.1122};
	Double_t U4[] = {0.0709, 0.0332, 0.0243, 0.0136, 0.0116, 0.0095, 0.0064};
	Double_t D4[] = {0.0709, 0.0332, 0.0243, 0.0136, 0.0116, 0.0095, 0.0064};
	g[4] = new TGraphErrors (7, X4, Y4, EX0, D4);
	g[4]->SetTitle("SLAC");
	g[4]->SetMarkerColor(4);
	g[4]->SetMarkerStyle(23);
	mg->Add(g[4]);

	for (int i=0; i<4; ++i)
	{
		g[i+1]->SetFillColor(0);
		//g[i+1]->SetLineColor(4);
		g[i+1]->SetMarkerSize(1.2);
	}

	// Formula D
	TGraph *gD = new TGraph (nPoints, DX, DY);
	gD->SetTitle("Dipole formulae");
	gD->SetFillColor(0);
	gD->SetLineWidth(3);
	gD->SetMarkerSize(0.3);
	gD->SetMarkerStyle(21);
	gD->SetMarkerColor(4);
	gD->SetLineColor(4);
	mg->Add(gD);
	
	// Formula A
	TGraph *gA = new TGraph (nPoints, DX, RY);
	gA->SetTitle("Our result");
	gA->SetFillColor(0);
	gA->SetLineWidth(3);
	gA->SetMarkerSize(0.3);
	gA->SetMarkerStyle(21);
	//gA->SetLineColor(3);
	mg->Add(gA);

	mg->Draw("AP");

	//TF1 *fg = new TF1 ("fg", "[1]*x + [0]");
	//mg->Fit("poly5","Fit"); // fg

	TAxis *aX = mg->GetXaxis();
	aX->SetTitle("Q^{2} [GeV^{2}]");
	//aX->SetLimits(0.,10.);
	aX->SetRangeUser(-0.01,7.0);
	aX->SetTitleOffset(1.2);
	aX->CenterTitle();

	TAxis *aY = mg->GetYaxis();
	aY->SetTitle("G_{M}^{*}");
	//aY->SetRangeUser(0.6,1.8);
	aY->SetTitleOffset(1.2);
	aY->CenterTitle();

	gPad->SetFillColor(kWhite);
	
	TLegend *leg = c[k]->BuildLegend();
	leg->SetFillStyle(0);

	c[k]->Modified();

	c[k]->SaveAs("imgGMstar.pdf");
	
	++k;	
}
Ejemplo n.º 26
0
void plotExclusion() {
  //CMSstyle();
  setTDRStyle();
  gROOT->ForceStyle();
  //gStyle->SetOptStat(0);

  TMultiGraph *mg = new TMultiGraph("mg", ";M_{W'} (GeV);W'#rightarrowWZ Coupling");
  TCanvas* c1 = new TCanvas("c1");
  c1->SetLogy(1);

   float masses[15];
   masses[0] = 200;
   masses[1] = 250;
   masses[2] = 300;
   masses[3] = 400;
   masses[4] = 500;
   masses[5] = 600;
   masses[6] = 700;
   masses[7] = 800;
   masses[8] = 900;
   masses[9] = 1000;
   masses[10] = 1100;
   masses[11] = 1200;
   masses[12] = 1300;
   masses[13] = 1400;
   masses[14] = 1500;

   float masses2D[30];
   masses2D[0] = 200;
   masses2D[29] = 200;
   masses2D[1] = 250;
   masses2D[28] = 250;
   masses2D[2] = 300;
   masses2D[27] = 300;
   masses2D[3] = 400;
   masses2D[26] = 400;
   masses2D[4] = 500;
   masses2D[25] = 500;
   masses2D[5] = 600;
   masses2D[24] = 600;
   masses2D[6] = 700;
   masses2D[23] = 700;
   masses2D[7] = 800;
   masses2D[22] = 800;
   masses2D[8] = 900;
   masses2D[21] = 900;
   masses2D[9] = 1000;
   masses2D[20] = 1000;
   masses2D[10] = 1100;
   masses2D[19] = 1100;
   masses2D[11] = 1200;
   masses2D[18] = 1200;
   masses2D[12] = 1300;
   masses2D[17] = 1300;
   masses2D[13] = 1400;
   masses2D[16] = 1400;
   masses2D[14] = 1500;
   masses2D[15] = 1500;
   float exp[15];
   float obs[15];
   float exp1[30];
   float exp2[30];
   exp[0] = 0.258951497072;
   obs[0] = 0.264236507723;
   exp1[0] = 0.302958978755;
   exp1[29] = 0.221380623691;
   exp2[0] = 0.361484816545;
   exp2[29] = 0.134881244455;
   exp[1] = 0.238074875871;
   obs[1] = 0.262501951025;
   exp1[1] = 0.271489954939;
   exp1[28] = 0.212149800065;
   exp2[1] = 0.31212926296;
   exp2[28] = 0.188396377283;
   exp[2] = 0.203941984681;
   obs[2] = 0.195862072551;
   exp1[2] = 0.228775587519;
   exp1[27] = 0.15388234499;
   exp2[2] = 0.258549678245;
   exp2[27] = 0.0761613633144;
   exp[3] = 0.221149265622;
   obs[3] = 0.197161298736;
   exp1[3] = 0.25146417874;
   exp1[26] = 0.195849275574;
   exp2[3] = 0.302745675541;
   exp2[26] = 0.102178773493;
   exp[4] = 0.265859426326;
   obs[4] = 0.281814245586;
   exp1[4] = 0.316136059804;
   exp1[25] = 0.241393072817;
   exp2[4] = 0.39001755547;
   exp2[25] = 0.221096337301;
   exp[5] = 0.318011210571;
   obs[5] = 0.27969609314;
   exp1[5] = 0.37957804241;
   exp1[24] = 0.276992405418;
   exp2[5] = 0.447262299127;
   exp2[24] = 0.222377913436;
   exp[6] = 0.398436976666;
   obs[6] = 0.42176421485;
   exp1[6] = 0.459808375625;
   exp1[23] = 0.364154826684;
   exp2[6] = 0.537189459921;
   exp2[23] = 0.357480425803;
   exp[7] = 0.46411170267;
   obs[7] = 0.481806072966;
   exp1[7] = 0.565467804363;
   exp1[22] = 0.425115372019;
   exp2[7] = 0.672064509509;
   exp2[22] = 0.4120593318;
   exp[8] = 0.563947415859;
   obs[8] = 0.536922403468;
   exp1[8] = 0.672650081221;
   exp1[21] = 0.534487182571;
   exp2[8] = 0.808457381294;
   exp2[21] = 0.514649041607;
   exp[9] = 0.700579859433;
   obs[9] = 0.676280384249;
   exp1[9] = 0.798482092783;
   exp1[20] = 0.674378686191;
   exp2[9] = 1.0120004248;
   exp2[20] = 0.663954563503;
   exp[10] = 0.918970653344;
   obs[10] = 0.889845853577;
   exp1[10] = 1.04923440155;
   exp1[19] = 0.858375432352;
   exp2[10] = 1.24717913491;
   exp2[19] = 0.746731022724;
   exp[11] = 1.19793401961;
   obs[11] = 1.17653186674;
   exp1[11] = 1.39512272299;
   exp1[18] = 1.16185610477;
   exp2[11] = 1.62812001722;
   exp2[18] = 1.01020656441;
   exp[12] = 1.58254134376;
   obs[12] = 1.56834374153;
   exp1[12] = 1.84607923047;
   exp1[17] = 1.51628586669;
   exp2[12] = 2.18103685499;
   exp2[17] = 1.31304946585;
   exp[13] = 2.30981854338;
   obs[13] = 2.30117260535;
   exp1[13] = 2.42189837009;
   exp1[16] = 2.13395645197;
   exp2[13] = 2.92307163497;
   exp2[16] = 2.04337780276;
   exp[14] = 3.19375101546;
   obs[14] = 3.16458908761;
   exp1[14] = 3.28113723449;
   exp1[15] = 2.99139611866;
   exp2[14] = 4.07139223438;
   exp2[15] = 2.84407249777;

  TGraph* grExp = new TGraph(15, masses, exp);
  TGraph* grObs = new TGraph(15, masses, obs);
  TGraph* grExp1 = new TGraph(30, masses2D, exp1);
  TGraph* grExp2 = new TGraph(30, masses2D, exp2);

  grExp->SetLineColor(kBlack);
  grExp->SetMarkerColor(kBlack);
  grExp->SetLineStyle(kDashed);
  grObs->SetLineColor(kBlack);
  grObs->SetMarkerColor(kBlack);
  grObs->SetMarkerStyle(20);
  grExp1->SetFillStyle(1001);
  grExp1->SetFillColor(kGreen);
  grExp2->SetFillStyle(1001);
  grExp2->SetFillColor(kYellow);

  mg->Add(grExp2, "F");
  mg->Add(grExp1, "F");
  mg->Add(grExp,  "L");
  mg->Add(grObs,  "P");
  mg->SetMinimum(0.1);
  mg->SetMaximum(10.);
  mg->Draw("a");

  TLine* line = new TLine(200, 1, 1500, 1);
  line->Draw();

  TLegend* leg = new TLegend(0.2, 0.62, 0.58, 0.92);
  leg->SetTextSize(0.05);
  leg->SetTextFont(42);
  leg->AddEntry(grObs, "Obs. Limit", "p");
  leg->AddEntry(grExp, "Exp. Limit", "l");
  leg->AddEntry(grExp1, "Exp. #pm 1#sigma", "f");
  leg->AddEntry(grExp2, "Exp. #pm 2#sigma", "f");
  leg->AddEntry(line, "W'_{SSM}#rightarrowWZ Coupling", "l");
  leg->SetBorderSize(0);
  leg->SetFillColor(0);
  leg->Draw();

  TLatex latexLabel;
  latexLabel.SetNDC();
  latexLabel.SetTextSize(0.05);
  latexLabel.SetTextFont(42);
  latexLabel.DrawLatex(0.33, 0.96, "CMS Preliminary 2011");
  latexLabel.DrawLatex(0.67, 0.38, "#sqrt{s} = 7 TeV");
  latexLabel.DrawLatex(0.62, 0.25, Form("#intL dt = %.2f fb^{-1}",4.98));


  c1->RedrawAxis();
  c1->Print("wprimewz_limits.C");
  c1->Print("wprimewz_limits.pdf");
  c1->Print("wprimewz_limits.png");
}
Ejemplo n.º 27
0
void long_Ay_nu_05() {
  gROOT->SetStyle("HALLA");
  TCanvas *cn = new TCanvas("cn","cn",540,360);
  cn->Draw();
  cn->UseCurrentStyle();
  TH1F *frm = new TH1F("frm","",100,0.,10.);
  frm->GetXaxis()->SetTitle("#nu (GeV)");
  frm->GetYaxis()->SetTitle("Ay for Q2=0.456 (GeV/c)2");
  frm->SetMinimum(0);
//  frm->SetMinimum(0);
//  frm->SetMaximum(1.0);
  frm->SetMaximum(0.35);
  frm->UseCurrentStyle();
  frm->Draw();
  frm->SetAxisRange(0.120,0.350,"X");
//  frm->SetAxisRange(0.5,1.1,"X");

//  TF1* galster = new TF1("galster","x/(4.*0.938*.938)*1.91/(1.+x/.71)^2/(1.+5.6*x/(4.*.938*.938))",0.,4.);
//  galster->SetLineColor(6);
//  galster->SetLineStyle(3);
//  galster->SetLineWidth(2);


  TF1 *genf = new TF1("genf",genff,1.,10.,1);
  genf->SetLineColor(2);
  genf->SetLineStyle(2);
  genf->SetParameter(0,1.);
  // match to Madey point just below 1.5
  // genf->SetParameter(0,.0411/genf->Eval(1.45));
  genf->SetParameter(0,-0.558645);

//  TF1 *bbba05 = new TF1("BBBA05",gen_bbba05,0.,10.,0);
//  bbba05->SetLineColor(7);
//  bbba05->SetLineStyle(3);

  
  TMultiGraph* mgrDta = new TMultiGraph("Data","G_{E}^{n}");
  TLegend *legDta = new TLegend(.54,.6,.875,.90,"","brNDC");

  TMultiGraph* wgr = mgrDta;
  TLegend *wlg = legDta;

   // the data
  legDta->SetBorderSize(0); // turn off border
  legDta->SetFillStyle(0);
  
  datafile_t *f = datafiles;
  TGraph* gr=0;
  while ( f && f->filename ) {
    gr=OneGraph(f);
    if (gr) {
      if (f->lnpt) {
	mgrDta->Add(gr,f->lnpt);
	legDta->AddEntry(gr,f->label,f->lnpt);
      }
      else if (gr->GetMarkerStyle()>=20) {
	mgrDta->Add(gr,"p");
	legDta->AddEntry(gr,f->label,"p");
      }	
      else {
	mgrDta->Add(gr,"l");
	legDta->AddEntry(gr,f->label,"l");
      }
    }
    f++;
  }
    

  mgrDta->Draw("p");
//  legDta->Draw();
  TF1 *theFit = new TF1("theFit","pol0");
  gr->Fit(theFit);
  theFit->Draw("same");  
  TMultiGraph* mgrThry = new TMultiGraph("Theory","G_{E}^{n}");
  TLegend *legThry = new TLegend(.54,.3,.875,.6,"","brNDC");

  wgr = mgrThry;
  wlg = legThry;

  // the theory
  wlg->SetBorderSize(0); // turn off border
  wlg->SetFillStyle(0);
  
  f = theoryfiles1;
  gr=0;
  while ( f && f->filename ) {
    gr=OneGraph(f);
    if (gr) {
      TGraphAsymmErrors *egr = dynamic_cast<TGraphAsymmErrors*>(gr);
      if (egr && egr->GetN()>1 && egr->GetEYhigh() && egr->GetEYhigh()[1]>0) {
	gr = toerror_band(egr);
	gr->SetFillStyle(3000+f->style);
      }
      if (f->lnpt) {
	wgr->Add(gr,f->lnpt);
	wlg->AddEntry(gr,f->label,f->lnpt);
      }
      else if (gr->GetMarkerStyle()>=20) {
	wgr->Add(gr,"p");
	wlg->AddEntry(gr,f->label,"p");
      }	
      else {
	wgr->Add(gr,"l");
	wlg->AddEntry(gr,f->label,"l");
      }
    }
    f++;
  }

//  genf->Draw("same");
  mgrThry->Draw("c");
//  galster->Draw("same");
//  bbba05->Draw("same");
//  legThry->AddEntry(genf,"F_{2}/F_{1} #propto ln^{2}(Q^{2}/#Lambda^{2})/Q^{2}","l");
//  legThry->AddEntry(galster,"Galster fit","l");
//  legThry->AddEntry(bbba05,"BBBA05","l");
//  legThry->Draw();
//  legDta->Draw();
  
  // draw a line at 1
  cn->Modified();

  cn->Update();
  cn->SaveAs(Form("%s.eps",psfile));
  cn->SaveAs(Form("%s.root",psfile));
  gSystem->Exec(Form("./replace_symbols.pl %s.eps",psfile));

  return;  // LEAVING HERE

  // now an overlay, hopefully matching dimensions

  // remove everything but the graph
  cn->Update();
  TList *clist = cn->GetListOfPrimitives();
  TFrame* frame = cn->GetFrame();
  for (int i=0; i<clist->GetSize(); ) {
    if (clist->At(i) != frame) {
      clist->RemoveAt(i);
    } else i++;
  }
  // draw markers in the corners
  TMarker *mkr = new TMarker(frame->GetX1(),frame->GetY1(),2);
  mkr->Draw();
  mkr = new TMarker(frame->GetX2(),frame->GetY1(),2);
  mkr->Draw();
  mkr = new TMarker(frame->GetX1(),frame->GetY2(),2);
  mkr->Draw();
  mkr = new TMarker(frame->GetX2(),frame->GetY2(),2);
  mkr->Draw();
  frame->SetLineColor(10);
  cn->Update();

  datafile_t miller = { "figure_input/Miller/lattice.GEn.rtf","Miller",
			"[0]","[1]","[1]-[3]","[2]-[1]",0,0,1,3,"F" };

  gr = OneGraph(&miller);
  TGraphAsymmErrors* egr = dynamic_cast<TGraphAsymmErrors*>(gr);
  if (egr && egr->GetEYhigh() && egr->GetEYhigh()[egr->GetN()/2]>0) {
    gr = toerror_band(egr);
    gr->SetLineStyle(1);
    gr->SetFillColor(gr->GetLineColor());
    gr->SetFillStyle(3000+miller.style);
  }
  
  gr->Draw("F");

  cn->Update();
  cn->SaveAs("gen_Miller_Overlay.eps");
  cn->SaveAs("gen_Miller_Overlay.root");
  
}
Ejemplo n.º 28
0
void pionContaminationVeta(){
  
  
	gStyle->SetOptStat(0);
	gStyle->SetOptFit(1);
	gStyle->SetPalette(1);
	
	char hist  [100];
	char hfile [100];
  
	
	sprintf(hfile,"~/Desktop/Research/2012IFF/rootFiles/nsigma20bintest35mil.root");  
  
	TFile* file = TFile::Open(hfile,"read");
	assert(file);
	
	
  double totalYieldWhole = 0;
  double pionYieldWhole = 0;
  double kpYieldWhole = 0;
  double electYieldWhile = 0;
	
	
	double pionFrac  [20];
	double kpFrac    [20];
	double electFrac [20];
	
	double pionCent  [20];
	double kpCent    [20];
	double electCent [20];
	
	double pionMax  [20];
	double kpMax    [20];
	double electMax [20];
	
	double pionSig  [20];
	double kpSig    [20];
	double electSig [20];
	
	
	double etastart[20];
	double etaend[20];
  
	double eta[20];
	
	
	double piYield[20];
	double highestYield = 0;
	
  double totalYeild[20];
	
	
	
  TH1F* hTotal = new TH1F("hTotal","hTotal",300,-10,10);

  
	for (int ihist=0; ihist<20; ihist++)
	{
		/*
     if (ihist != 0 || ihist != 1 || ihist != 2 || ihist != 3 ||)
     {
     cou
     }
     */
		sprintf(hist,"nSigmaPionBin_%i",ihist);
		cout << hist << endl;
		
		TH1F *hNsigma = (TH1F*) file->Get(hist);
	  assert(hNsigma);
    
    hTotal->Add(hNsigma, 1);
    cout << hTotal->GetEntries() << endl;
		
		TF1 *fitFunc = new TF1("fitFunc","gaus(0)+gaus(3)+gaus(6)",-10,10);
    TF1 *piFunc = new TF1("piFunc","gaus(0)",-10,10);
    TF1 *kpFunc = new TF1("kpFunc","gaus(0)",-10,10);
    TF1  *eFunc = new TF1( "eFunc","gaus(0)",-10,10);
    fitFunc->SetParName(0, "A_{#pi}");
    fitFunc->SetParName(1, "#LTn_{#pi}#GT");
    fitFunc->SetParName(2, "#sigma_{#pi}");
    fitFunc->SetParName(3, "A_{K/p}");
    fitFunc->SetParName(4, "#LTn_{K/p}#GT");
    fitFunc->SetParName(5, "#sigma_{K/p}");
    fitFunc->SetParName(6, "A_{e}");
    fitFunc->SetParName(7, "#LTn_{e}#GT");
    fitFunc->SetParName(8, "#sigma_{e}");
		
    fitFunc->SetParameter(0, hNsigma->GetMaximum());
    fitFunc->SetParameter(1, 0.);
    fitFunc->SetParameter(2, 1.);
		
    fitFunc->SetParameter(3, 0.05*hNsigma->GetMaximum());
    fitFunc->SetParameter(4,-3.);
    fitFunc->SetParameter(5, 1.5);
		
    fitFunc->SetParameter(6, 0.05*hNsigma->GetMaximum());
    fitFunc->SetParameter(7, 4.); //was at 5. but it seems like 4. works better
    fitFunc->SetParameter(8, 3.);
		
		hNsigma->Fit("fitFunc");
    
    float  ampPi = fitFunc->GetParameter(0);
    float centPi = fitFunc->GetParameter(1);
    float  sigPi = fitFunc->GetParameter(2);
    piFunc->SetParameters(ampPi,centPi,sigPi);
    piFunc->SetLineColor(kViolet+1);
    
    float  ampKP = fitFunc->GetParameter(3);
    float centKP = fitFunc->GetParameter(4);
    float  sigKP = fitFunc->GetParameter(5);
    kpFunc->SetParameters(ampKP,centKP,sigKP);
    kpFunc->SetLineColor(kGreen+2);
    
    float  ampE  = fitFunc->GetParameter(6);
    float centE  = fitFunc->GetParameter(7);
    float  sigE  = fitFunc->GetParameter(8);
    eFunc->SetParameters(ampE,centE,sigE);
    eFunc->SetLineColor(kBlue);
    
    piFunc->Draw("same");
    kpFunc->Draw("same");
    eFunc->Draw("same");
    
    TLine *l1 = new TLine( 2.5,0, 2.5,0.9*hNsigma->GetMaximum());
    TLine *l2 = new TLine(-1.0,0,-1.0,0.9*hNsigma->GetMaximum());
    l1->SetLineColor(kOrange+2);
    l2->SetLineColor(kOrange+2);
    l1->SetLineWidth(2);
    l2->SetLineWidth(2);
    
    l1->Draw();
    l2->Draw();
		
		//*
    float  totYield = fitFunc->Integral(-1.,2.5);
    float pionYield =  piFunc->Integral(-1.,2.5);
    float   kpYield =  kpFunc->Integral(-1.,2.5);
    float    eYield =   eFunc->Integral(-1.,2.5);
		//*/
		/*
     float  totYield = fitFunc->Integral(-2.,2.);
     float pionYield =  piFunc->Integral(-2.,2.);
     float   kpYield =  kpFunc->Integral(-2.,2.);
     float    eYield =   eFunc->Integral(-2.,2.);
     //*/
    
    
    
    totalYieldWhole += totYield;
    pionYieldWhole += pionYield;
    kpYieldWhole += kpYield;
    electYieldWhile += eYield;
    
    
    printf("\nTotal Yield\tPion Yield\tK/p Yield\tElect Yield\n");
    printf("%e\t%e\t%e\t%e\n",totYield,pionYield,kpYield,eYield);
    printf("Pion Fraction = %e\n",(pionYield/totYield));
    
		
		totalYeild[ihist] = totYield;
		
		pionFrac[ihist]  = pionYield/totYield;
		kpFrac[ihist]    = kpYield/totYield;
		electFrac[ihist] = eYield/totYield;
		
		etastart[ihist] = -2+ihist*0.2;
		etaend[ihist] = -2+(ihist+1)*0.2;
    
		eta[ihist] = (etastart[ihist]+etaend[ihist])*.5;
		
		piYield[ihist] = pionYield;
		
		if (highestYield < pionYield){highestYield = pionYield;}
		
		
	}
	
	
	double normlzd_PiYield[20];
	
	double sumPiYield = 0;
  
	for (int i=0; i<20; i++)
	{
		if (pionFrac[i] != pionFrac[i])
		{
			cout << i << "  " << eta[i] << "  testFailed" << " highyeild " << highestYield << endl;
			pionFrac[i] = -.2;
		}
		else
		{
			cout << i << "  " << eta[i] << "  " << pionFrac[i] << " highyeild " << highestYield << endl;
			
		}
		
		normlzd_PiYield[i] = piYield[i]/highestYield; 
		
    
		sumPiYield += piYield[i];
		
	}
	
  double pionFracErr[20];
  double kpFracErr[20];
  double electFracErr[20];
  
  for (int i=0; i<20; i++)
  {
    pionFracErr[i] = sqrt((1-pionFrac[i])*pionFrac[i]/totalYeild[i]);
    kpFracErr[i] = sqrt((1-kpFrac[i])*kpFrac[i]/totalYeild[i]);
    electFracErr[i] = sqrt((1-electFrac[i])*electFrac[i]/totalYeild[i]);
    
  }  
  
  
  
	
	cout << "total Pion Yield = " << sumPiYield << endl;
	
	
	TGraphErrors* gPionYield = new TGraphErrors(20,eta,normlzd_PiYield,0,0);
	gPionYield->SetMarkerColor(kRed+2);
	gPionYield->SetMarkerStyle(24);
	
	TGraphErrors* gPionFrac = new TGraphErrors(20,eta,pionFrac,0,pionFracErr);
	TGraphErrors* gKpFrac   = new TGraphErrors(20,eta,kpFrac,0,kpFracErr);	
	TGraphErrors* gElecFrac = new TGraphErrors(20,eta,electFrac,0,electFracErr);
	
	
	
	
	gPionFrac->SetMarkerColor(kViolet+1);
  gPionFrac->SetLineColor(kViolet+1);
  gPionFrac->SetLineWidth(2);
	gKpFrac->SetMarkerColor(kGreen+2);
  gKpFrac->SetLineColor(kGreen+2);
  gKpFrac->SetLineWidth(2);
	gKpFrac->SetMarkerStyle(22);	
	gElecFrac->SetMarkerColor(kBlue);
	gElecFrac->SetLineColor(kBlue);
	gElecFrac->SetLineWidth(2);
	gElecFrac->SetMarkerStyle(20);
	
	
	TMultiGraph* multiFracs = new TMultiGraph();
	multiFracs->Add(gPionFrac);
	multiFracs->Add(gKpFrac);
	multiFracs->Add(gElecFrac);
	//multiFracs->Add(gPionYield);
  
	TCanvas* cMultiG = new TCanvas();
	multiFracs->Draw("AP");
	multiFracs->GetXaxis()->SetTitle("#eta^{#pi^{+}#pi^{-}}");
	multiFracs->GetYaxis()->SetTitle("particle Fractions");
	gPad->Modified();
	
	TLegend* leg = new TLegend(0.52,0.17,0.89,0.30);
	leg->AddEntry(gPionFrac,"Pion","P");
	leg->AddEntry(gKpFrac,"K/P","P");
	leg->AddEntry(gElecFrac,"Electron","P");
	//  leg->Draw();
	
	TCanvas* cPiYeild = new TCanvas();
	TGraphErrors* gPionYield = new TGraphErrors(20,eta,piYield,0,0);
	
	
	gPionYield->Draw("AP");
	gPionYield->SetMarkerColor(kRed+2);
	gPionYield->SetMarkerStyle(24);
	gPionYield->GetXaxis()->SetTitle("#eta^{#pi^{+}#pi^{-}}");
	gPionYield->GetYaxis()->SetTitle("Pion Yield");
	
	
	
	
	
	cout << pionYieldWhole/totalYieldWhole << endl;
	
	
	
	
	hTotal->Draw();
	
  TF1 *fitFunc = new TF1("fitFunc","gaus(0)+gaus(3)+gaus(6)",-10,10);
  TF1 *piFunc = new TF1("piFunc","gaus(0)",-10,10);
  TF1 *kpFunc = new TF1("kpFunc","gaus(0)",-10,10);
  TF1  *eFunc = new TF1( "eFunc","gaus(0)",-10,10);
  fitFunc->SetParName(0, "A_{#pi}");
  fitFunc->SetParName(1, "#LTn_{#pi}#GT");
  fitFunc->SetParName(2, "#sigma_{#pi}");
  fitFunc->SetParName(3, "A_{K/p}");
  fitFunc->SetParName(4, "#LTn_{K/p}#GT");
  fitFunc->SetParName(5, "#sigma_{K/p}");
  fitFunc->SetParName(6, "A_{e}");
  fitFunc->SetParName(7, "#LTn_{e}#GT");
  fitFunc->SetParName(8, "#sigma_{e}");
  
  fitFunc->SetParameter(0, hTotal->GetMaximum());
  fitFunc->SetParameter(1, 0.);
  fitFunc->SetParameter(2, 1.);
  
  fitFunc->SetParameter(3, 0.05*hTotal->GetMaximum());
  fitFunc->SetParameter(4,-3.);
  fitFunc->SetParameter(5, 1.5);
  
  fitFunc->SetParameter(6, 0.05*hTotal->GetMaximum());
  fitFunc->SetParameter(7, 4.); //was at 5. but it seems like 4. works better
  fitFunc->SetParameter(8, 3.);
  
	
	
	
  hTotal->Fit("fitFunc");
  
  float  ampPi = fitFunc->GetParameter(0);
  float centPi = fitFunc->GetParameter(1);
  float  sigPi = fitFunc->GetParameter(2);
  piFunc->SetParameters(ampPi,centPi,sigPi);
  piFunc->SetLineColor(kViolet+1);
  
  float  ampKP = fitFunc->GetParameter(3);
  float centKP = fitFunc->GetParameter(4);
  float  sigKP = fitFunc->GetParameter(5);
  kpFunc->SetParameters(ampKP,centKP,sigKP);
  kpFunc->SetLineColor(kGreen+2);
  
  float  ampE  = fitFunc->GetParameter(6);
  float centE  = fitFunc->GetParameter(7);
  float  sigE  = fitFunc->GetParameter(8);
  eFunc->SetParameters(ampE,centE,sigE);
  eFunc->SetLineColor(kBlue);
  
  piFunc->Draw("same");
  kpFunc->Draw("same");
  eFunc->Draw("same");
  
  TLine *l1 = new TLine( 2.5,0, 2.5,0.9*hNsigma->GetMaximum());
  TLine *l2 = new TLine(-1.0,0,-1.0,0.9*hNsigma->GetMaximum());
  l1->SetLineColor(kOrange+2);
  l2->SetLineColor(kOrange+2);
  l1->SetLineWidth(2);
  l2->SetLineWidth(2);
  
  l1->Draw();
  l2->Draw();
  
  //*
  float  totYield = fitFunc->Integral(-1.,2.5);
  float pionYield =  piFunc->Integral(-1.,2.5);
  float   kpYield =  kpFunc->Integral(-1.,2.5);
  float    eYield =   eFunc->Integral(-1.,2.5);
  
  double pionerr = sqrt((1-pionYield/totYield)*pionYield/totYield/totalYeild);

  
	cout << pionYield/totYield << " " << pionerr << endl;
	
	
	
	
	
	
	
	
	
	
	
  
  
  
  
}
void test(int numbersigmas = 0, Bool_t debugtest = true)
{

  using namespace std;

   float ptbinsarray[] = {20.,40.,60.,80.,100.,120.,200.,600.};

  std::vector<float> ptbins(ptbinsarray,ptbinsarray+sizeof(ptbinsarray)/sizeof(ptbinsarray[0]));
  
  std::vector<std::vector<float> > allbins;
  allbins.push_back(ptbins);
  
  std::vector<TString> VarString;
  VarString.push_back("VsPt");
  
  std::vector<TString> HistoNameString;
  HistoNameString.push_back("ptbin");

  std::vector<TString> GraphXTitleString;
  GraphXTitleString.push_back("p_{t} (GeV)");

  std::vector<TString> SideBandDefinitions;
  SideBandDefinitions.push_back("Sideband3_6"); //n=1
  SideBandDefinitions.push_back("Sideband4_7"); //n=2
  SideBandDefinitions.push_back("Sideband4_10");//n=3
  SideBandDefinitions.push_back("Sideband5_8"); //n=4
  SideBandDefinitions.push_back("Sideband5_10"); //n=5

  //   ------------FOR TESTING----------------
  unsigned int sidebandloopmax = 5;//5_10, 5_20, ...

  //----------Open .root Templates 
  TFile *histojetfile = TFile::Open("/afs/cern.ch/user/c/ciperez/CMSSW_7_4_5/src/FakeTemplates_var_SideBands.root"); 
  //--- Write NEW .root Historams for Fake Rate
  TFile *FRhistosfile = new TFile("SameFakeTemplatePlots.root","recreate");
      	
  TMultiGraph *mg = new TMultiGraph();
	TLegend *legendAllGraphs = new TLegend(0.37,0.59,0.57,0.79);
	legendAllGraphs->SetTextSize(0.02);
	legendAllGraphs->SetFillColor(kWhite);
	legendAllGraphs->SetLineColor(kWhite);
	  
	//Begin loop for bins  
  for(unsigned int k = 0;k<allbins[0].size()-1;k++){
	    float binlow = allbins[0][k];
	    float binmax = allbins[0][k+1];

	    TString binstring = TString::Format("%4.2f_%4.2f",binlow,binmax);
	    binstring.ReplaceAll(".00","");
	    binstring.ReplaceAll("-","m");
	    binstring.ReplaceAll(".","p");
	    binstring.ReplaceAll("10000","Inf");
	    cout<<binstring.Data()<<endl;
    
     TCanvas *canvas = new TCanvas("canvas","canvas",900,100,500,500);
  
     // PADS FOR OVERLAYING
    // TPad *pad = new TPad("pad", "",0,0,1,1);
    // pad->Draw();
    // pad->cd(); 


      //---Begin loop for sidebands
      for(unsigned int n =0;n<sidebandloopmax; n++){ 
      
      //PADS FOR OVERLAYING 
     // TPad *pad2 = new TPad("pad2","",0,0,1,1);
     // pad2->SetFillStyle(4000); //will be transparent

      //****** HERE WE OVERLAY THE TEMPLATES FOR THE SAME PT FOR DIFFERENT SIDEBANDS      
      //Get histograms from each of the histojetfiles declared earlier 
      TH1F *h1[sidebandloopmax]; 
      h1[n] = (TH1F*)histojetfile->Get(("histoSininWithPixelSeedVsCHFakeJetptbin"+binstring+SideBandDefinitions[n]).Data());
     // h1->Draw("same");
      
      h1[n]->Print();
     
	    //avoiding 0 entries in the histograms
	    //fake and real mc histos are the most critical
	    for(int bincount = 1; bincount <= h1[n]->GetNbinsX();bincount++){
	      if(h1[n]->GetBinContent(bincount) == 0.) h1[n]->SetBinContent(bincount,1.e-6);
	    }

	    canvas->cd();
      canvas->SetGridx(true);
      canvas->SetGridy(true);

      //Getting the Maximum range of the histogram plots so everything fits
     // float padmax = pad2->GetMaximum();
      //pad2->GetYaxis()->SetRangeUser(1.e-1,1.1*padmax);
      float padmax = h1[n]->GetMaximum();
      h1[n]->GetYaxis()->SetRangeUser(1.e-1,2.2*padmax);
      h1[n]->Draw("same");
	    /*xframe->GetXaxis()->SetRangeUser(0.,0.1);
	    float xframemax = xframe->GetMaximum();
	    xframe->GetYaxis()->SetRangeUser(1.e-1,1.1*xframemax);
      xframe->Draw();
     */
      // ----- DEFINE LEGENDS and their position
	    TLegend *legend = new TLegend(0.62,0.65,0.82,0.85); //Why these values? 
	    legend->SetTextSize(0.02);
	    legend->SetFillColor(kWhite);
	    legend->SetLineColor(kWhite);
             
      //TObjecs for legends
      TObject *band3_6;
      TObject *band4_7;
      TObject *band4_10;
      TObject *band5_8;
      TObject *band5_10;
    
        
      //Legend Header which tells the bin
	    //TString legendheader = "Pt:["+ binstring+"],["+SideBandDefinitions[n]+" GeV";

	   /* legendheader.ReplaceAll("_",",");
	    legendheader.ReplaceAll("m","-");
	    legendheader.ReplaceAll("p",".");
	    legendheader.Append("]");
     */

	   // cout<<"legend "<<legendheader.Data()<<endl;
	   // legend->SetHeader(legendheader.Data());
      legend->AddEntry(h1[n],SideBandDefinitions[n],"l"); 
     // legend->AddEntry(h1[2],SideBandDefinitions[1],"l"); 
     // legend->AddEntry(h1[3],SideBandDefinitions[2],"l"); 
     // legend->AddEntry(h1[4],SideBandDefinitions[3],"l"); 
      //legend->AddEntry(h1[5],SideBandDefinitions[4],"l"); 
   
      //------DRAWING AND LEGENDS --------
     // h1->SetLineColor(n+1);
      h1[1]->SetLineStyle(5-n);
      legend->Draw("same");//make them overlap for comparison
      h1[1]->Draw("same");      
      
     // canvas->Print(("Endcapfits_SideBand_"+SideBandDefinitions[n]+binstring+".C").Data());
 
	if(numbersigmas != 0){
	  mg->Draw();
	  legendAllGraphs->Draw("same");
	}
      }//end of loop over all sidebands
   canvas->Print(("PNGSameFakeTemps"+binstring+".png").Data());
  }//end of loop over all bins

    histojetfile->cd();
    histojetfile->Close();
    
    FRhistosfile->cd();
    FRhistosfile->Close();

}//end of method
Ejemplo n.º 30
0
void start(const char *basename, const double offset = 0.0)
{

  TFile *file1 = TFile::Open(Form("Data/ROOT/%s_VMIN_SIPM1_meanHistSub_projections.root",basename));
  TFile *file2 = TFile::Open(Form("Data/ROOT/%s_VMIN_SIPM2_meanHistSub_projections.root",basename));

  if(file1==NULL) {cout<<"cannot find file1"<<endl;return;}
  if(file2==NULL) {cout<<"cannot find file2"<<endl;return;}

  calc(file1,file2,basename,0);
  calc(file1,file2,basename,1);
  calc(file1,file2,basename,2);
  calc(file1,file2,basename,3);
  calc(file1,file2,basename,4);
  calc(file1,file2,basename,5);
  calc(file1,file2,basename,6);
  calc(file1,file2,basename,7);
  calc(file1,file2,basename,8);

  ofstream fout(Form("Data/Text/%s_Asymmetries.txt"));
  double pn[9];
  for(int i=0; i<9; i++)
    {
      fout<<frac1[i]<<" "
	  <<frac2[i]<<" "
	  <<fracAv[i]<<" "
	  <<fracAs[i]<<" "
	  <<endl;
      //pn[i] = i+0.5; // projection number
      pn[i] = -2.0 + i/2.0; // distance
      pn[i] += offset;
    }

  TGraph *tg1 = new TGraph(9,pn,frac1);
  TGraph *tg2 = new TGraph(9,pn,frac2);
  TGraph *tgAv = new TGraph(9,pn,fracAv);
  TGraph *tgAs = new TGraph(9,pn,fracAs);
  tg1->SetMarkerStyle(kFullCircle);
  tg2->SetMarkerStyle(kFullCircle);
  tgAv->SetMarkerStyle(kOpenCircle);
  tgAs->SetMarkerStyle(kFullSquare);
  tg1->SetMarkerColor(kBlue);
  tg2->SetMarkerColor(kRed);
  tgAv->SetMarkerColor(kBlack);
  tgAs->SetMarkerColor(kBlack);
  TMultiGraph *tmg = new TMultiGraph();
  tmg->Add(tgAs);
  tmg->Add(tg1);
  tmg->Add(tg2);
  tmg->Add(tgAv);
  tmg->Draw("ap");
  tmg->SetMaximum(1.0);
  tmg->SetMinimum(0.0);
  tmg->GetXaxis()->SetLimits(-2.25+offset,2.25+offset);
  //tmg->GetXaxis()->SetLimits(0.0,9.0); // projection number
  tmg->GetXaxis()->SetTitle("Distance from fiber (cm)");
  tmg->GetYaxis()->SetTitle("f_{core} from different methods");
  TLegend *leg1 = new TLegend(0.18,0.18,0.28,0.38);
  leg1->AddEntry(tg1,"SiPM1","p");
  leg1->AddEntry(tg2,"SiPM2","p");
  leg1->AddEntry(tgAv,"Average SiPM1+SiPM2","p");
  leg1->AddEntry(tgAs,"Asymmetry","p");
  leg1->SetFillStyle(0);
  leg1->SetTextSize(0.05);
  leg1->Draw();

  c1->Print(Form("Figures/%s_AsymmetryComparison.png",basename));
  c1->Print(Form("Figures/%s_AsymmetryComparison.pdf",basename));

}