File indexing completed on 2024-04-06 12:20:26
0001 #include "TMath.h"
0002 #include "TFile.h"
0003 #include "TTree.h"
0004 #include "TH1D.h"
0005 #include "TH2D.h"
0006 #include "TCanvas.h"
0007 #include "TStyle.h"
0008 #include "TGraph.h"
0009 #include "TLegend.h"
0010 #include "TLatex.h"
0011 #include "TMultiGraph.h"
0012
0013 #include <iostream>
0014
0015 #include "L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeDataFormat.h"
0016
0017 TH1F * hset(TH1F * h, int color){
0018 h->SetLineWidth(2);
0019 h->SetLineColor(color);
0020 h->SetMarkerStyle(23);
0021 h->SetMarkerColor(color);
0022 return h;
0023 }
0024
0025 TH1F * norm(TH1F * h){
0026 double n = h->GetEntries();
0027 if (n>0.0){
0028 h->Scale(1.0/n);
0029 }
0030 h->SetMaximum(1.0);
0031 h->SetMinimum(0);
0032 return h;
0033 }
0034
0035 void kin(const char * rootfile="L1Ntuple.root",const char * treepath="l1UpgradeEmuTree/L1UpgradeTree"){
0036 gStyle->SetOptStat(0);
0037
0038
0039 TFile * file = new TFile(rootfile);
0040 TTree * treeL1Up = (TTree*) file->Get(treepath);
0041 if (! treeL1Up){
0042 cout << "ERROR: could not open tree\n";
0043 return;
0044 }
0045 treeL1Up->Print();
0046
0047
0048
0049
0050
0051 TH1F* muEt = hset(new TH1F("muEt", "", 50, 0.0, 40.0), kBlue);
0052 TH1F* muPhi = hset(new TH1F("muPhi", "", 50, -3.0, 3.0), kBlue);
0053 TH1F* muEta = hset(new TH1F("muEta", "", 50, -3.0, 3.0), kBlue);
0054
0055 TH1F* jetEt = hset(new TH1F("jetEt", "", 50, 0.0, 40.0), kRed);
0056 TH1F* jetPhi = hset(new TH1F("jetPhi", "", 50, -3.0, 3.0), kRed);
0057 TH1F* jetEta = hset(new TH1F("jetEta", "", 50, -3.0, 3.0), kRed);
0058
0059 TH1F* egEt = hset(new TH1F("egEt", "", 50, 0.0, 40.0), kGreen);
0060 TH1F* egPhi = hset(new TH1F("egPhi", "", 50, -3.0, 3.0), kGreen);
0061 TH1F* egEta = hset(new TH1F("egEta", "", 50, -3.0, 3.0), kGreen);
0062
0063 TH1F* tauEt = hset(new TH1F("tauEt", "", 50, 0.0, 40.0), kOrange);
0064 TH1F* tauPhi = hset(new TH1F("tauPhi", "", 50, -3.0, 3.0), kOrange);
0065 TH1F* tauEta = hset(new TH1F("tauEta", "", 50, -3.0, 3.0), kOrange);
0066
0067 TCanvas * c0 = new TCanvas();
0068 treeL1Up->Draw("muonEt>>muEt", "muonQual>=8");
0069 treeL1Up->Draw("muonPhi>>muPhi", "muonQual>=8");
0070 treeL1Up->Draw("muonEta>>muEta", "muonQual>=8");
0071 treeL1Up->Draw("jetEt>>jetEt");
0072 treeL1Up->Draw("jetPhi>>jetPhi");
0073 treeL1Up->Draw("jetEta>>jetEta");
0074 treeL1Up->Draw("egEt>>egEt");
0075 treeL1Up->Draw("egPhi>>egPhi");
0076 treeL1Up->Draw("egEta>>egEta");
0077 treeL1Up->Draw("tauEt>>tauEt");
0078 treeL1Up->Draw("tauPhi>>tauPhi");
0079 treeL1Up->Draw("tauEta>>tauEta");
0080 delete c0;
0081
0082 norm(muEt); norm(jetEt); norm(tauEt); norm(egEt);
0083 norm(muPhi); norm(jetPhi); norm(tauPhi); norm(egPhi);
0084 norm(muEta); norm(jetEta); norm(tauEta); norm(egEta);
0085
0086 TCanvas* c1 = new TCanvas;
0087 muEt->SetMaximum(0.4);
0088 muEt->SetXTitle("Et [GeV]");
0089 muEt->Draw("H");
0090 jetEt->Draw("HSAME");
0091 tauEt->Draw("HSAME");
0092 egEt->Draw("HSAME");
0093
0094 TLegend* leg1 = new TLegend(0.4,0.5,0.6,0.9);
0095 leg1->SetFillColor(0);
0096 leg1->AddEntry(egEt,"EGamma","lp");
0097 leg1->AddEntry(tauEt,"Tau","lp");
0098 leg1->AddEntry(jetEt,"Jets","lp");
0099 leg1->AddEntry(muEt,"Muons","lp");
0100 leg1->SetBorderSize(0);
0101 leg1->SetFillStyle(0);
0102 leg1->Draw();
0103 c1->SaveAs("et.pdf");
0104
0105 TCanvas* c2 = new TCanvas;
0106 muEta->SetMaximum(0.2);
0107 muEta->SetXTitle("Eta");
0108 muEta->Draw("H");
0109 jetEta->Draw("HSAME");
0110 tauEta->Draw("HSAME");
0111 egEta->Draw("HSAME");
0112 leg1->Draw();
0113 c2->SaveAs("eta.pdf");
0114
0115 TCanvas* c3 = new TCanvas;
0116 muPhi->SetXTitle("Phi");
0117 muPhi->SetMaximum(0.07);
0118 muPhi->Draw("H");
0119 jetPhi->Draw("HSAME");
0120 tauPhi->Draw("HSAME");
0121 egPhi->Draw("HSAME");
0122
0123 TLegend* leg3 = new TLegend(0.2,0.5,0.4,0.9);
0124 leg3->SetFillColor(0);
0125 leg3->AddEntry(egEt,"EGamma","lp");
0126 leg3->AddEntry(tauEt,"Tau","lp");
0127 leg3->AddEntry(jetEt,"Jets","lp");
0128 leg3->AddEntry(muEt,"Muons","lp");
0129 leg3->SetBorderSize(0);
0130 leg3->SetFillStyle(0);
0131 leg3->Draw();
0132 c3->SaveAs("phi.pdf");
0133
0134
0135 }