Exemple #1
0
void
Screen::transport(Ion& ion)
{
	fillHistogram(ion.x(),ion.y());
	if( m_next != NULL ){
		m_next->transport(ion);
	}
}
void makePlot(TCanvas* canvas, const std::string& outputFileName, TTree* testTree, const std::string& varName, 
	      unsigned numBinsX, double xMin, double xMax)
{
  std::cout << "creating histogramTauIdPassed..." << std::endl;
  TString histogramTauIdPassedName = TString("histogramTauIdPassed").Append("_").Append(varName.data());
  TH1* histogramTauIdPassed = fillHistogram(testTree, varName, "type==1", "",
					    histogramTauIdPassedName.Data(), numBinsX, xMin, xMax);
  std::cout << "--> histogramTauIdPassed = " << histogramTauIdPassed << ":" 
	    << " integral = " << histogramTauIdPassed->Integral() << std::endl;

  std::cout << "creating histogramTauIdFailed..." << std::endl;
  TString histogramTauIdFailedName = TString("histogramTauIdFailed").Append("_").Append(varName.data());
  TH1* histogramTauIdFailed = fillHistogram(testTree, varName, "type==0", "",
					    histogramTauIdFailedName.Data(), numBinsX, xMin, xMax);
  std::cout << "--> histogramTauIdFailed = " << histogramTauIdFailed 
	    << " integral = " << histogramTauIdFailed->Integral() << std::endl;

  std::cout << "creating histogramTauIdDenominator..." << std::endl;
  TString histogramTauIdDenominatorName = TString("histogramTauIdDenominator").Append("_").Append(varName.data());
  TH1* histogramTauIdDenominator = new TH1F(histogramTauIdDenominatorName.Data(), 
					    histogramTauIdDenominatorName.Data(), numBinsX, xMin, xMax);
  histogramTauIdDenominator->Add(histogramTauIdPassed);
  histogramTauIdDenominator->Add(histogramTauIdFailed);
  std::cout << "--> histogramTauIdDenominator = " << histogramTauIdDenominator 
	    << " integral = " << histogramTauIdDenominator->Integral() << std::endl;

  std::cout << "creating histogramFakeRate..." << std::endl;
  TString histogramFakeRateName = TString("histogramFakeRate").Append("_").Append(varName.data());
  TH1* histogramFakeRate = new TH1F(histogramFakeRateName.Data(), 
				    histogramFakeRateName.Data(), numBinsX, xMin, xMax);
  histogramFakeRate->Add(histogramTauIdPassed);
  histogramFakeRate->Divide(histogramTauIdDenominator);
  std::cout << "--> histogramFakeRate = " << histogramFakeRate 
	    << " integral = " << histogramFakeRate->Integral() << std::endl;

  std::cout << "creating histogramFakeRateWeighted..." << std::endl;
  TString histogramFakeRateWeightedName = TString("histogramFakeRateWeighted").Append("_").Append(varName.data());
  TH1* histogramFakeRateWeighted = fillHistogram(testTree, varName, "", "MVA_KNN", 
						 histogramFakeRateWeightedName.Data(), numBinsX, xMin, xMax);
  histogramFakeRateWeighted->Divide(histogramTauIdDenominator);
  std::cout << "--> histogramFakeRateWeighted = " << histogramFakeRateWeighted 
	    << " entries = " << histogramFakeRateWeighted->GetEntries() << ","
	    << " integral = " << histogramFakeRateWeighted->Integral() << std::endl;
  // Scale the weighted fake rate histogram

  histogramFakeRate->SetTitle(varName.data());
  histogramFakeRate->SetStats(false);
  histogramFakeRate->SetMinimum(1.e-4);
  histogramFakeRate->SetMaximum(1.e+1);
  histogramFakeRate->SetLineColor(2);
  histogramFakeRate->SetLineWidth(2);
  histogramFakeRate->SetMarkerStyle(20);
  histogramFakeRate->SetMarkerColor(2);
  histogramFakeRate->SetMarkerSize(1);
  histogramFakeRate->Draw("e1p");

  histogramFakeRateWeighted->SetLineColor(4);
  histogramFakeRateWeighted->SetLineWidth(2);
  histogramFakeRateWeighted->SetMarkerStyle(24);
  histogramFakeRateWeighted->SetMarkerColor(4);
  histogramFakeRateWeighted->SetMarkerSize(1);
  histogramFakeRateWeighted->Draw("e1psame");

  TLegend legend(0.11, 0.73, 0.31, 0.89);
  legend.SetBorderSize(0);
  legend.SetFillColor(0);
  legend.AddEntry(histogramFakeRate, "Tau id. discr.", "p");
  legend.AddEntry(histogramFakeRateWeighted, "Fake-Rate weight", "p");
  legend.Draw();

  canvas->Update();
  canvas->Print(outputFileName.data());
}
Exemple #3
0
void select_pgs()
{


  gStyle->SetOptStat(0);
  gStyle->SetOptTitle(0);
  gStyle->SetLineWidth(2);

  Float_t bins[5] = {500, 700,  1100, 1600, 2000};
  
//   TH1 *histMjjNoMatching = new TH1F("mjj_no_matching", "m_jj", 10, 0.0, 1000.);
//   TH1 *histMjjMatching = new TH1F("mjj_matching", "m_jj", 10, 0.0, 1000.);
//   TH1 *histMjjNoMatchingDown = new TH1F("mjj_no_matching_down", "m_jj", 10, 0.0, 1000.);
//   TH1 *histMjjNoMatchingUp = new TH1F("mjj_no_matching_up", "m_jj", 10, 0.0, 1000.);
//   TH1 *histMjjMatchingDown = new TH1F("mjj_matching_down", "m_jj", 10, 0.0, 1000.);
//   TH1 *histMjjMatchingUp = new TH1F("mjj_matching_up", "m_jj", 10, 0.0, 1000.);

  TH1F *histMjjNoMatching = new TH1F("mjj_no_matching", "m_jj", 4, bins);
  TH1F *histMjjMatching = new TH1F("mjj_matching", "m_jj", 4, bins);
  TH1F *histMjjNoMatchingDown = new TH1F("mjj_no_matching_down", "m_jj", 4, bins);
  TH1F *histMjjNoMatchingUp = new TH1F("mjj_no_matching_up", "m_jj", 4, bins);
  TH1F *histMjjMatchingDown = new TH1F("mjj_matching_down", "m_jj", 4, bins);
  TH1F *histMjjMatchingUp = new TH1F("mjj_matching_up", "m_jj", 4, bins);


  fillHistogram(histMjjMatching, "/scratch3/anlevin/MG5_aMC_v2_0_0/ww_qed_4_qcd_99_pythia_matching/Events/run_01/tag_1_pgs_events.root",0.0215);
  fillHistogram(histMjjMatchingUp, "/scratch3/anlevin/MG5_aMC_v2_0_0/ww_qed_4_qcd_99_pythia_matching_up/Events/run_01/tag_1_pgs_events.root",0.01852);
  fillHistogram(histMjjMatchingDown, "/scratch3/anlevin/MG5_aMC_v2_0_0/ww_qed_4_qcd_99_pythia_matching_down/Events/run_01/tag_1_pgs_events.root",0.02547);
  fillHistogram(histMjjNoMatching, "/scratch3/anlevin/MG5_aMC_v2_0_0/ww_qed_4_qcd_99_pythia_no_matching/Events/run_01/tag_1_pgs_events.root",0.01625);
  fillHistogram(histMjjNoMatchingUp,"/scratch3/anlevin/MG5_aMC_v2_0_0/ww_qed_4_qcd_99_pythia_no_matching_up/Events/run_01/tag_1_pgs_events.root",0.01386);
  fillHistogram(histMjjNoMatchingDown, "/scratch3/anlevin/MG5_aMC_v2_0_0/ww_qed_4_qcd_99_pythia_no_matching_down/Events/run_01/tag_1_pgs_events.root",0.01939 );


  histMjjNoMatching->SetLineColor(kBlack);
  histMjjMatching->SetLineColor(kBlue);
  histMjjNoMatchingDown->SetLineColor(kBlack);
  histMjjNoMatchingUp->SetLineColor(kBlack);
  histMjjMatchingDown->SetLineColor(kBlue);
  histMjjMatchingUp->SetLineColor(kBlue);

  histMjjNoMatching->SetLineWidth(2);
  histMjjMatching->SetLineWidth(2);
  histMjjNoMatchingDown->SetLineWidth(2);
  histMjjNoMatchingUp->SetLineWidth(2);
  histMjjMatchingDown->SetLineWidth(2);
  histMjjMatchingUp->SetLineWidth(2);


    


  histMjjMatchingDown->SetMinimum(0);



  histMjjMatchingDown->GetXaxis()->SetTitle("m_{jj} (GeV)");

  histMjjMatchingDown->Draw("E");

  histMjjNoMatchingDown->Draw("ESAME");
  histMjjNoMatchingUp->Draw("ESAME");
  histMjjNoMatching->Draw("ESAME");
  histMjjMatching->Draw("ESAME");
  histMjjMatchingUp->Draw("ESAME");

  TLegend *legend = new TLegend(0.532,0.64,0.874,0.86);
  legend->AddEntry(histMjjMatching,"with matching","L");
  legend->AddEntry(histMjjNoMatching,"without matching","L");
  legend->SetFillStyle(0);
  legend->Draw("SAME");

}