Skip to content

Commit

Permalink
Merge pull request #8 from robervalwalsh/develop
Browse files Browse the repository at this point in the history
Developments for 2017 trigger studies 80X/90X
  • Loading branch information
robervalwalsh authored Apr 25, 2017
2 parents f307b31 + a73bb30 commit f18bb67
Show file tree
Hide file tree
Showing 18 changed files with 47,316 additions and 18 deletions.
35 changes: 27 additions & 8 deletions macros/HLTRatesData.C
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
void HLTRatesData()
void HLTRatesData(const std::string & trigger, const std::string & file)
{
double nbx = 2500;
TFile * inFile = new TFile("../test/80x/BTagMu20/mssmhbb_triggers_data_btagmu20.root","old");
// TFile * inFile = new TFile("../test/80x/HighPU/mssmhbb_triggers_data_zerobiasbt.root","old");
// All hadronic
// trigger = "HLT_2CaloJets100_2CaloBTagCSV084_2PFJets100_psw";
// trigger = "HLT_2CaloJets100_2CaloBTagCSV092_2PFJets100_psw";
// trigger = "HLT_2CaloJets100_2CaloBTagCSV092_2PFJets100_Eta2p1_psw";
// trigger = "HLT_2CaloJets100_2CaloBTagCSV092_2PFJets100_Eta2p1_dEta1p5_psw";

// trigger = "HLT_2CaloJets30_Muon12_2CaloBTagCSV084_2PFJets40_psw";
// trigger = "HLT_2CaloJets30_Muon12_2CaloBTagCSV092_2PFJets40_psw";
// trigger = "HLT_2CaloJets30_Muon12_2CaloBTagCSV092_2PFJets50e40_Eta2p1_psw";
// trigger = "HLT_2CaloJets30_Muon12_2CaloBTagCSV092_2PFJets50e40_Eta2p1_dEta1p5_psw";



double nbx = 2600;
TFile * inFile = new TFile(file.c_str(),"old");
// TFile * inFile = new TFile("../test/80x/BTagCSV/mssmhbb_triggers_data_BTagCSV.root","old");
TH1F * hLumis = (TH1F*) inFile -> Get("Lumis");
TH1F * hsemilep = (TH1F*) inFile -> Get("h_nHLT_2CaloJets30_Muon12_2CaloBTagCSV092_2PFJets50e40_Eta2p1_dEta1p5_psw");
TH1F * hpath = (TH1F*) inFile -> Get(Form("h_n%s",trigger.c_str()));

double pileup[100];
double pileupErr[100];
Expand All @@ -16,12 +29,12 @@ void HLTRatesData()
for ( int i = 0; i < hLumis->GetNbinsX(); ++i )
{
double pu = hLumis->GetBinCenter(i+1);
if ( pu < 14 ) continue;
if ( pu < 14 || pu == 32.5 || pu > 44 ) continue;
pileup[n] = pu;
pileupErr[n] = 0;
double nlumi = hLumis->GetBinContent(i+1);
double nevts = hsemilep->GetBinContent(i+1);
double nevtsErr = hsemilep->GetBinError(i+1);
double nevts = hpath->GetBinContent(i+1);
double nevtsErr = hpath->GetBinError(i+1);
rate[n] = nevts*nbx/nlumi/23.31;
rateErr[n]= nevtsErr*nbx/nlumi/23.31;
// if ( nlumi == 0 || pu > 42 ) break;
Expand All @@ -32,9 +45,15 @@ void HLTRatesData()
}

TGraphErrors * gRate = new TGraphErrors(n,pileup,rate,pileupErr,rateErr);
gRate -> SetName("rate_total");
gRate -> SetMarkerStyle(20);
gRate -> Draw("AP");

TFile * out = new TFile(Form("data_%d_bx_%s.root",int(nbx),trigger.c_str()),"recreate");
gRate -> Write();

out -> Close();


}

36 changes: 26 additions & 10 deletions macros/HLTRatesMC.C
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
int HLTRatesMC(const std::string & trigger)
//int HLTRatesMC()
{
int nBX = 2544;

// std::string trigger;

// All hadronic
// trigger = "HLT_2CaloJets100_2CaloBTagCSV084_2PFJets100";
// trigger = "HLT_2CaloJets100_2CaloBTagCSV092_2PFJets100";
// trigger = "HLT_2CaloJets100_2CaloBTagCSV092_2PFJets100_Eta2p1";
// trigger = "HLT_2CaloJets100_2CaloBTagCSV092_2PFJets100_Eta2p1_dEta1p5";

// trigger = "HLT_2CaloJets30_Muon12_2CaloBTagCSV084_2PFJets40";
// trigger = "HLT_2CaloJets30_Muon12_2CaloBTagCSV092_2PFJets40";
// trigger = "HLT_2CaloJets30_Muon12_2CaloBTagCSV092_2PFJets50e40_Eta2p1";
// trigger = "HLT_2CaloJets30_Muon12_2CaloBTagCSV092_2PFJets50e40_Eta2p1_dEta1p5";


int nBX = 2600;
double mBX = 3564;
double tBX = 24.95E-9;
double fBX = (double(nBX)/mBX)/tBX;
Expand All @@ -11,14 +27,14 @@ int HLTRatesMC(const std::string & trigger)
std::vector<TGraphAsymmErrors *> g_eff;
std::vector<TGraphAsymmErrors *> g_rate;

f.push_back(new TFile("../test/80x/QCD/QCD_Pt_15to30/mssmhbb_triggers_QCD_Pt_15to30.root","old"));
f.push_back(new TFile("../test/80x/QCD/QCD_Pt_30to50/mssmhbb_triggers_QCD_Pt_30to50.root","old"));
f.push_back(new TFile("../test/80x/QCD/QCD_Pt_50to80/mssmhbb_triggers_QCD_Pt_50to80.root","old"));
f.push_back(new TFile("../test/80x/QCD/QCD_Pt_80to120/mssmhbb_triggers_QCD_Pt_80to120.root","old"));
f.push_back(new TFile("../test/80x/QCD/QCD_Pt_120to170/mssmhbb_triggers_QCD_Pt_120to170.root","old"));
f.push_back(new TFile("../test/80x/QCD/QCD_Pt_170to300/mssmhbb_triggers_QCD_Pt_170to300.root","old"));
f.push_back(new TFile("../test/80x/QCD/QCD_Pt_300to470/mssmhbb_triggers_QCD_Pt_300to470.root","old"));
f.push_back(new TFile("../test/80x/QCD/QCD_Pt_470to600/mssmhbb_triggers_QCD_Pt_470to600.root","old"));
f.push_back(new TFile("../test/90x/QCD/QCD_Pt_15to30/mssmhbb_triggers_QCD_Pt_15to30.root","old"));
f.push_back(new TFile("../test/90x/QCD/QCD_Pt_30to50/mssmhbb_triggers_QCD_Pt_30to50.root","old"));
f.push_back(new TFile("../test/90x/QCD/QCD_Pt_50to80/mssmhbb_triggers_QCD_Pt_50to80.root","old"));
f.push_back(new TFile("../test/90x/QCD/QCD_Pt_80to120/mssmhbb_triggers_QCD_Pt_80to120.root","old"));
f.push_back(new TFile("../test/90x/QCD/QCD_Pt_120to170/mssmhbb_triggers_QCD_Pt_120to170.root","old"));
f.push_back(new TFile("../test/90x/QCD/QCD_Pt_170to300/mssmhbb_triggers_QCD_Pt_170to300.root","old"));
f.push_back(new TFile("../test/90x/QCD/QCD_Pt_300to470/mssmhbb_triggers_QCD_Pt_300to470.root","old"));
f.push_back(new TFile("../test/90x/QCD/QCD_Pt_470to600/mssmhbb_triggers_QCD_Pt_470to600.root","old"));

std::vector<bool> mask;
mask.resize(f.size());
Expand Down Expand Up @@ -129,7 +145,7 @@ int HLTRatesMC(const std::string & trigger)

// c1 -> SaveAs(Form("Rates_%s.png",trigger.c_str()));

TFile * out = new TFile(Form("qcd_%d_bx_%s.root",nBX,trigger.c_str()),"recreate");
TFile * out = new TFile(Form("qcd90x_%d_bx_%s.root",nBX,trigger.c_str()),"recreate");
g_totRate -> Write();
for ( size_t i = 0 ; i < f.size() ; ++i ) // loop over files
{
Expand Down
22 changes: 22 additions & 0 deletions macros/PlotsBTagCSV.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
void PlotsBTagCSV()
{
TFile * f1 = new TFile("data_2600_bx_HLT_2CaloJets100_2CaloBTagCSV084_2PFJets100_psw.root","old");
TFile * f2 = new TFile("data_2600_bx_HLT_2CaloJets100_2CaloBTagCSV092_2PFJets100_psw.root","old");
TFile * f3 = new TFile("data_2600_bx_HLT_2CaloJets100_2CaloBTagCSV092_2PFJets100_Eta2p1_psw.root","old");
TFile * f4 = new TFile("data_2600_bx_HLT_2CaloJets100_2CaloBTagCSV092_2PFJets100_Eta2p1_dEta1p5_psw.root","old");

TGraphAsymmErrors * g1 = (TGraphAsymmErrors*) f1 -> Get("Graph");
TGraphAsymmErrors * g2 = (TGraphAsymmErrors*) f2 -> Get("Graph");
TGraphAsymmErrors * g3 = (TGraphAsymmErrors*) f3 -> Get("Graph");
TGraphAsymmErrors * g4 = (TGraphAsymmErrors*) f4 -> Get("Graph");

TMultiGraph * mg = new TMultiGraph();

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

mg -> Draw("ap");

}
22 changes: 22 additions & 0 deletions macros/PlotsBTagCSV_MC.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
void PlotsBTagCSV_MC()
{
TFile * f1 = new TFile("qcd_2600_bx_HLT_2CaloJets100_2CaloBTagCSV084_2PFJets100.root","old");
TFile * f2 = new TFile("qcd_2600_bx_HLT_2CaloJets100_2CaloBTagCSV092_2PFJets100.root","old");
TFile * f3 = new TFile("qcd_2600_bx_HLT_2CaloJets100_2CaloBTagCSV092_2PFJets100_Eta2p1.root","old");
TFile * f4 = new TFile("qcd_2600_bx_HLT_2CaloJets100_2CaloBTagCSV092_2PFJets100_Eta2p1_dEta1p5.root","old");

TGraphAsymmErrors * g1 = (TGraphAsymmErrors*) f1 -> Get("rate_total");
TGraphAsymmErrors * g2 = (TGraphAsymmErrors*) f2 -> Get("rate_total");
TGraphAsymmErrors * g3 = (TGraphAsymmErrors*) f3 -> Get("rate_total");
TGraphAsymmErrors * g4 = (TGraphAsymmErrors*) f4 -> Get("rate_total");

TMultiGraph * mg = new TMultiGraph();

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

mg -> Draw("ap");

}
23 changes: 23 additions & 0 deletions macros/PlotsBTagMu.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
void PlotsBTagMu()
{
TFile * f1 = new TFile("data_2600_bx_HLT_2CaloJets30_Muon12_2CaloBTagCSV084_2PFJets40_psw.root","old");
TFile * f2 = new TFile("data_2600_bx_HLT_2CaloJets30_Muon12_2CaloBTagCSV092_2PFJets40_psw.root","old");
TFile * f3 = new TFile("data_2600_bx_HLT_2CaloJets30_Muon12_2CaloBTagCSV092_2PFJets50e40_Eta2p1_psw.root ","old");
TFile * f4 = new TFile("data_2600_bx_HLT_2CaloJets30_Muon12_2CaloBTagCSV092_2PFJets50e40_Eta2p1_dEta1p5_psw.root","old");


TGraphAsymmErrors * g1 = (TGraphAsymmErrors*) f1 -> Get("Graph");
TGraphAsymmErrors * g2 = (TGraphAsymmErrors*) f2 -> Get("Graph");
TGraphAsymmErrors * g3 = (TGraphAsymmErrors*) f3 -> Get("Graph");
TGraphAsymmErrors * g4 = (TGraphAsymmErrors*) f4 -> Get("Graph");

TMultiGraph * mg = new TMultiGraph();

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

mg -> Draw("ap");

}
23 changes: 23 additions & 0 deletions macros/PlotsBTagMu_MC.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
void PlotsBTagMu_MC()
{
TFile * f1 = new TFile("qcd_2600_bx_HLT_2CaloJets30_Muon12_2CaloBTagCSV084_2PFJets40.root","old");
TFile * f2 = new TFile("qcd_2600_bx_HLT_2CaloJets30_Muon12_2CaloBTagCSV092_2PFJets40.root","old");
TFile * f3 = new TFile("qcd_2600_bx_HLT_2CaloJets30_Muon12_2CaloBTagCSV092_2PFJets50e40_Eta2p1.root ","old");
TFile * f4 = new TFile("qcd_2600_bx_HLT_2CaloJets30_Muon12_2CaloBTagCSV092_2PFJets50e40_Eta2p1_dEta1p5.root","old");


TGraphAsymmErrors * g1 = (TGraphAsymmErrors*) f1 -> Get("rate_total");
TGraphAsymmErrors * g2 = (TGraphAsymmErrors*) f2 -> Get("rate_total");
TGraphAsymmErrors * g3 = (TGraphAsymmErrors*) f3 -> Get("rate_total");
TGraphAsymmErrors * g4 = (TGraphAsymmErrors*) f4 -> Get("rate_total");

TMultiGraph * mg = new TMultiGraph();

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

mg -> Draw("ap");

}
80 changes: 80 additions & 0 deletions macros/Plots_2x.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
void Plots_2x()
{
// All had
// TFile * f1 = new TFile("data_2600_bx_HLT_2CaloJets100_2CaloBTagCSV084_2PFJets100_psw.root","old");
// TFile * f2 = new TFile("data_2600_bx_HLT_2CaloJets100_2CaloBTagCSV092_2PFJets100_psw.root","old");
// All had MC
// TFile * f1 = new TFile("qcd_2600_bx_HLT_2CaloJets100_2CaloBTagCSV084_2PFJets100_psw.root","old");
// TFile * f2 = new TFile("qcd_2600_bx_HLT_2CaloJets100_2CaloBTagCSV092_2PFJets100_psw.root","old");

// Semilep
TFile * f1 = new TFile("data_2600_bx_HLT_2CaloJets30_Muon12_2CaloBTagCSV084_2PFJets40_psw.root","old");
TFile * f2 = new TFile("data_2600_bx_HLT_2CaloJets30_Muon12_2CaloBTagCSV092_2PFJets40_psw.root","old");
// Semilep MC
// TFile * f1 = new TFile("qcd_2600_bx_HLT_2CaloJets30_Muon12_2CaloBTagCSV084_2PFJets40_psw.root","old");
// TFile * f2 = new TFile("qcd_2600_bx_HLT_2CaloJets30_Muon12_2CaloBTagCSV092_2PFJets40_psw.root","old");


TGraphAsymmErrors * g1 = (TGraphAsymmErrors*) f1 -> Get("rate_total");
g1 -> SetName("rate1");
TGraphAsymmErrors * g2 = (TGraphAsymmErrors*) f2 -> Get("rate_total");
g2 -> SetName("rate2");

int n = 2;
double x[2] = {0,70};
double y[2] = {0,0};
TGraph * gdummy = new TGraph(n,x,y);

g1 -> SetMarkerStyle(25);
g2 -> SetMarkerStyle(25);
g1 -> SetMarkerStyle(20);
g2 -> SetMarkerStyle(20);
g2 -> SetMarkerColor(kRed);
g2 -> SetLineColor(kRed);

double minfit = 15;
double maxfit = 40;

TCanvas * c1 = new TCanvas("c1","", 700,600);
// c1->SetLeftMargin(0.15);

TF1 * pol1_1 = new TF1("pol1_1","pol1",minfit,70);
pol1_1 -> SetLineColor(kBlack);
pol1_1 -> SetLineStyle(1);
TFitResultPtr fit1 = g1 -> Fit(pol1_1,"S","",minfit,maxfit);

TF1 * pol1_2 = new TF1("pol1_2","pol1",minfit,70);
pol1_2 -> SetLineColor(kRed);
pol1_2 -> SetLineStyle(1);
TFitResultPtr fit2 = g2 -> Fit(pol1_2,"S","",minfit,maxfit);


TMultiGraph * mg = new TMultiGraph();

mg -> Add(g1);
mg -> Add(g2);
mg -> Add(gdummy);


mg -> Draw("ap");

pol1_1 -> Draw("same");
pol1_2 -> Draw("same");

TLegend * leg = new TLegend(0.15,0.75,0.6,0.9);
leg->AddEntry(g1,"Data 2016 hltCSV > 0.84","p");
leg->AddEntry(g2,"Data 2016 hltCSV > 0.92","p");

leg -> Draw();
mg -> GetXaxis() -> SetRangeUser(10,70);
mg -> GetYaxis() -> SetTitle("rate (Hz)");
mg -> GetXaxis() -> SetTitle("pile up");
// mg -> GetYaxis() -> SetTitleOffset(2);

mg -> SetMinimum(0);
mg -> SetMaximum(90);
gPad->Modified();

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

}
63 changes: 63 additions & 0 deletions macros/Plots_2xData.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
void Plots_2xData()
{
// All had
TFile * f1 = new TFile("data_2600_bx_HLT_2CaloJets100_2CaloBTagCSV084_2PFJets100_psw.root","old");
TFile * f2 = new TFile("data_2600_bx_HLT_2CaloJets100_2CaloBTagCSV092_2PFJets100_psw.root","old");

// Semilep
// TFile * f1 = new TFile("data_2600_bx_HLT_2CaloJets30_Muon12_2CaloBTagCSV084_2PFJets40_psw.root","old");
// TFile * f2 = new TFile("data_2600_bx_HLT_2CaloJets30_Muon12_2CaloBTagCSV092_2PFJets40_psw.root","old");


TGraphAsymmErrors * g1 = (TGraphAsymmErrors*) f1 -> Get("rate_total");
g1 -> SetName("rate1");
TGraphAsymmErrors * g2 = (TGraphAsymmErrors*) f2 -> Get("rate_total");
g2 -> SetName("rate2");

int n = 2;
double x[2] = {0,70};
double y[2] = {0,0};
TGraph * gdummy = new TGraph(n,x,y);

g1 -> SetMarkerStyle(20);
g2 -> SetMarkerStyle(20);
g2 -> SetMarkerColor(kRed);
g2 -> SetLineColor(kRed);


TCanvas * c1 = new TCanvas("c1","", 700,600);
// c1->SetLeftMargin(0.15);

TF1 * pol1_1 = new TF1("pol1_1","pol1",15,70);
pol1_1 -> SetLineColor(kBlack);
TFitResultPtr fit1 = g1 -> Fit(pol1_1,"S","",15,40);

TF1 * pol1_2 = new TF1("pol1_2","pol1",15,70);
pol1_2 -> SetLineColor(kRed);
TFitResultPtr fit2 = g2 -> Fit(pol1_2,"S","",15,40);


TMultiGraph * mg = new TMultiGraph();

mg -> Add(g1);
mg -> Add(g2);
mg -> Add(gdummy);


mg -> Draw("ap");

pol1_1 -> Draw("same");
pol1_2 -> Draw("same");

mg -> GetXaxis() -> SetRangeUser(10,70);
mg -> GetYaxis() -> SetTitle("rate (Hz)");
mg -> GetXaxis() -> SetTitle("pile up");
// mg -> GetYaxis() -> SetTitleOffset(2);

mg -> SetMinimum(0);
mg -> SetMaximum(40);
gPad->Modified();

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

}
Loading

0 comments on commit f18bb67

Please sign in to comment.