9 #include <TGraphErrors.h>
19 TFile *fin =
new TFile(jetfilename,
"OPEN");
21 TTree* jets = (TTree*)fin->Get(
"jets");
27 vector< TCut > v_cuts_eta;
28 v_cuts_eta.push_back( TCut(
"(jet_truth_eta>-4&&jet_truth_eta<-2)") );
29 v_cuts_eta.push_back( TCut(
"(jet_truth_eta>-1&&jet_truth_eta<1)") );
30 v_cuts_eta.push_back( TCut(
"(jet_truth_eta>2&&jet_truth_eta<4)") );
33 vector< TCut > v_cuts_energy;
34 v_cuts_energy.push_back( TCut(
"(jet_truth_e>0&&jet_truth_e<10)") );
35 v_cuts_energy.push_back( TCut(
"(jet_truth_e>10&&jet_truth_e<20)") );
36 v_cuts_energy.push_back( TCut(
"(jet_truth_e>20&&jet_truth_e<50)") );
39 TCanvas *ctemp =
new TCanvas(
"**Scratch**");
45 TH2F* h_jets_energy_vs_eta =
new TH2F(
"h_jets_energy_vs_eta",
";#eta_{jet}^{truth};E_{jet}^{truth}",36,-4.5,4.5,25,0,100);
46 jets->Draw(
"jet_truth_e : jet_truth_eta >> h_jets_energy_vs_eta",
"",
"colz");
48 TCanvas *c4 =
new TCanvas();
49 h_jets_energy_vs_eta->Draw(
"colz");
51 c4->Print(
"plots/plot_truth_jet_energy_vs_Eta.eps");
56 TH1F* h_jets_energy_eta1 =
new TH1F(
"h_jets_energy_eta1",
";E_{jet}^{truth} (GeV);counts",100,0,50);
57 TH1F* h_jets_energy_eta2 = (TH1F*)h_jets_energy_eta1->Clone(
"h_jets_energy_eta2");
58 TH1F* h_jets_energy_eta3 = (TH1F*)h_jets_energy_eta1->Clone(
"h_jets_energy_eta3");
60 h_jets_energy_eta1->SetLineColor(kBlue);
61 h_jets_energy_eta2->SetLineColor(kRed);
62 h_jets_energy_eta3->SetLineColor(kGreen+1);
64 jets->Draw(
"jet_truth_e >> h_jets_energy_eta1", v_cuts_eta.at(0),
"");
65 jets->Draw(
"jet_truth_e >> h_jets_energy_eta2", v_cuts_eta.at(1),
"");
66 jets->Draw(
"jet_truth_e >> h_jets_energy_eta3", v_cuts_eta.at(2),
"");
68 TCanvas *
c2 =
new TCanvas();
69 h_jets_energy_eta2->Draw(
"");
70 h_jets_energy_eta1->Draw(
"same");
71 h_jets_energy_eta3->Draw(
"same");
72 c2->Print(
"plots/plot_hist_etruth_etaranges.eps");
77 TH2F* h_eres_vs_e =
new TH2F(
"h_eres_vs_e",
";E_{jet}^{truth};(E_{jet}^{smear}-E_{jet}^{truth}) / E_{jet}^{truth}",2*12,2.5,62.5,2*20,-2,4);
78 jets->Draw(
"(jet_smear_e-jet_truth_e)/jet_truth_e:jet_truth_e >> h_eres_vs_e", cut_base);
80 TCanvas *c5 =
new TCanvas();
81 h_eres_vs_e->Draw(
"colz");
82 c5->Print(
"plots/plot_eres_vs_e_all.eps");
87 TH2F* h_eres_vs_eta =
new TH2F(
"h_eres_vs_eta",
";#eta_{jet}^{truth};(E_{jet}^{smear}-E_{jet}^{truth}) / E_{jet}^{truth}",2*18,-4.5,4.5,2*20,-2,4);
88 jets->Draw(
"(jet_smear_e-jet_truth_e)/jet_truth_e:jet_truth_eta >> h_eres_vs_eta", cut_base);
90 TCanvas *c6 =
new TCanvas();
91 h_eres_vs_eta->Draw(
"colz");
92 c6->Print(
"plots/plot_eres_vs_eta_all.eps");
104 TH1F* h_frame_emean =
new TH1F(
"h_frame_emean",
"", 10,2.5,52.5);
105 h_frame_emean->GetYaxis()->SetRangeUser(-0.4,0.4);
106 h_frame_emean->GetXaxis()->SetTitle(
"E_{jet}^{truth} [GeV]");
107 h_frame_emean->GetYaxis()->SetTitle(
"(E_{jet}^{smear}-E_{jet}^{truth}) / E_{jet}^{truth}");
109 TH1F* h_frame_esigma =
new TH1F(
"h_frame_esigma",
"", 10,2.5,52.5);
110 h_frame_esigma->GetYaxis()->SetRangeUser(0.1,0.4);
111 h_frame_esigma->GetXaxis()->SetTitle(
"E_{jet}^{truth} [GeV]");
112 h_frame_esigma->GetYaxis()->SetTitle(
"#sigma ( (E_{jet}^{smear}-E_{jet}^{truth}) / E_{jet}^{truth} )");
114 for (
unsigned etaidx = 0; etaidx < v_cuts_eta.size(); etaidx++ )
116 TH2F* h_eres_etacut =
new TH2F(TString::Format(
"h_eres_etacut%d",etaidx),
";E_{jet}^{truth};(E_{jet}^{smear}-E_{jet}^{truth}) / E_{jet}^{truth}",10,2.5,52.5,20,-1,1);
117 Int_t nbins_x_etacut = h_eres_etacut->GetXaxis()->GetNbins();
119 TGraphErrors* g_emean_etacut =
new TGraphErrors( nbins_x_etacut );
120 TGraphErrors* g_esigma_etacut =
new TGraphErrors( nbins_x_etacut );
122 TCanvas *c_evseta_1 =
new TCanvas(TString::Format(
"etarange_%d", etaidx ), (TString::Format(
"Pseudorapidity range: %s", v_cuts_eta.at(etaidx).GetTitle() )));
123 jets->Draw(TString::Format(
"(jet_smear_e-jet_truth_e)/jet_truth_e:jet_truth_e >> h_eres_etacut%d",etaidx), cut_base && v_cuts_eta.at(etaidx) );
124 h_eres_etacut->Draw(
"COLZ");
125 c_evseta_1->Print(TString::Format(
"plots/plot_%s.eps", c_evseta_1->GetName() ));
128 for ( Int_t
i = 0;
i < nbins_x_etacut;
i++ )
132 TH1D* h_proj = h_eres_etacut->ProjectionY(
"py",
i+1,
i+1);
135 if ( h_proj->GetEntries() < 100 )
139 h_proj->Fit(
"gaus",
"Q");
140 TF1*
fit = h_proj->GetFunction(
"gaus");
142 TCanvas *cstore =
new TCanvas();
144 TString proj_name = TString::Format(
"Projection_etacut%d_bincenter_%.01fGeV", etaidx, h_eres_etacut->GetXaxis()->GetBinCenter(
i+1) );
146 cstore->SetName(proj_name);
147 cstore->SetTitle(proj_name);
148 h_proj->DrawClone(
"clone");
149 cstore->Print(TString::Format(
"plots/plot_%s.eps", cstore->GetName() ));
151 cout <<
"RMS: " << h_eres_etacut->GetXaxis()->GetBinCenter(
i+1) <<
" --> " << h_proj->GetRMS() << endl;
155 cout <<
"FIT: " << h_eres_etacut->GetXaxis()->GetBinCenter(
i+1) <<
" --> " << fit->GetParameter(2) << endl;
156 g_emean_etacut->SetPoint(
i, h_eres_etacut->GetXaxis()->GetBinCenter(
i+1), fit->GetParameter(1));
157 g_emean_etacut->SetPointError(
i, 0, fit->GetParError(1));
159 g_esigma_etacut->SetPoint(
i, h_eres_etacut->GetXaxis()->GetBinCenter(
i+1), fit->GetParameter(2));
160 g_esigma_etacut->SetPointError(
i, 0, fit->GetParError(2));
167 TCanvas *c_evseta_2 =
new TCanvas(TString::Format(
"mean_vs_e_etarange%d", etaidx ), (TString::Format(
"Pseudorapidity range: %s", v_cuts_eta.at(etaidx).GetTitle() )));
168 h_frame_emean->Draw();
169 g_emean_etacut->Draw(
"Psame");
170 c_evseta_2->Print(TString::Format(
"plots/plot_%s.eps", c_evseta_2->GetName() ));
172 TCanvas *c_evseta_3 =
new TCanvas(TString::Format(
"sigma_vs_e_etarange%d", etaidx), (TString::Format(
"Pseudorapidity range: %s", v_cuts_eta.at(etaidx).GetTitle() )));
173 h_frame_esigma->Draw();
174 g_esigma_etacut->Draw(
"Psame");
175 c_evseta_3->Print(TString::Format(
"plots/plot_%s.eps", c_evseta_3->GetName() ));
181 TH1F* h_frame_energycut_emean =
new TH1F(
"h_frame_energycut_emean",
"", 32,-4,4);
182 h_frame_energycut_emean->GetYaxis()->SetRangeUser(-0.4,0.4);
183 h_frame_energycut_emean->GetXaxis()->SetTitle(
"#eta_{jet}^{truth}");
184 h_frame_energycut_emean->GetYaxis()->SetTitle(
"(E_{jet}^{smear}-E_{jet}^{truth}) / E_{jet}^{truth}");
186 TH1F* h_frame_energycut_esigma =
new TH1F(
"h_frame_energycut_esigma",
"", 32,-4,4);
187 h_frame_energycut_esigma->GetYaxis()->SetRangeUser(0.1,0.4);
188 h_frame_energycut_esigma->GetXaxis()->SetTitle(
"#eta_{jet}^{truth}");
189 h_frame_energycut_esigma->GetYaxis()->SetTitle(
"#sigma ( (E_{jet}^{smear}-E_{jet}^{truth}) / E_{jet}^{truth} )");
191 for (
unsigned energyidx = 0; energyidx < v_cuts_energy.size(); energyidx++ )
193 TH2F* h_eres_energycut =
new TH2F(TString::Format(
"h_eres_energycut%d",energyidx),
";E_{jet}^{truth};(E_{jet}^{smear}-E_{jet}^{truth}) / E_{jet}^{truth}",32,-4,4,20,-1,1);
194 Int_t nbins_x_energycut = h_eres_energycut->GetXaxis()->GetNbins();
196 TGraphErrors* g_emean_energycut =
new TGraphErrors( nbins_x_energycut );
197 TGraphErrors* g_esigma_energycut =
new TGraphErrors( nbins_x_energycut );
199 TCanvas *c_evseta_1 =
new TCanvas(TString::Format(
"energyrange_%d", energyidx ), (TString::Format(
"Energy range: %s", v_cuts_energy.at(energyidx).GetTitle() )));
200 jets->Draw(TString::Format(
"(jet_smear_e-jet_truth_e)/jet_truth_e:jet_truth_eta >> h_eres_energycut%d",energyidx), cut_base && v_cuts_energy.at(energyidx) );
201 h_eres_energycut->Draw(
"COLZ");
202 c_evseta_1->Print(TString::Format(
"plots/plot_%s.eps", c_evseta_1->GetName() ));
205 for ( Int_t
i = 0;
i < nbins_x_energycut;
i++ )
209 TH1D* h_proj = h_eres_energycut->ProjectionY(
"py",
i+1,
i+1);
212 if ( h_proj->GetEntries() < 100 )
216 h_proj->Fit(
"gaus",
"Q");
217 TF1*
fit = h_proj->GetFunction(
"gaus");
219 TCanvas *cstore =
new TCanvas();
221 TString proj_name = TString::Format(
"Projection_energycut%d_bincenter_%.01fEta", energyidx, h_eres_energycut->GetXaxis()->GetBinCenter(
i+1) );
223 cstore->SetName(proj_name);
224 cstore->SetTitle(proj_name);
225 h_proj->DrawClone(
"clone");
226 cstore->Print(TString::Format(
"plots/plot_%s.eps", cstore->GetName() ));
228 cout <<
"RMS: " << h_eres_energycut->GetXaxis()->GetBinCenter(
i+1) <<
" --> " << h_proj->GetRMS() << endl;
232 cout <<
"FIT: " << h_eres_energycut->GetXaxis()->GetBinCenter(
i+1) <<
" --> " << fit->GetParameter(2) << endl;
233 g_emean_energycut->SetPoint(
i, h_eres_energycut->GetXaxis()->GetBinCenter(
i+1), fit->GetParameter(1));
234 g_emean_energycut->SetPointError(
i, 0, fit->GetParError(1));
236 g_esigma_energycut->SetPoint(
i, h_eres_energycut->GetXaxis()->GetBinCenter(
i+1), fit->GetParameter(2));
237 g_esigma_energycut->SetPointError(
i, 0, fit->GetParError(2));
242 TCanvas *c_evseta_2 =
new TCanvas(TString::Format(
"mean_vs_e_energyrange%d", energyidx ), (TString::Format(
"Energy range: %s", v_cuts_energy.at(energyidx).GetTitle() )));
243 h_frame_energycut_emean->Draw();
244 g_emean_energycut->Draw(
"Psame");
245 c_evseta_2->Print(TString::Format(
"plots/plot_%s.eps", c_evseta_2->GetName() ));
247 TCanvas *c_evseta_3 =
new TCanvas(TString::Format(
"sigma_vs_e_energyrange%d", energyidx), (TString::Format(
"Energy range: %s", v_cuts_energy.at(energyidx).GetTitle() )));
248 h_frame_energycut_esigma->Draw();
249 g_esigma_energycut->Draw(
"Psame");
250 c_evseta_3->Print(TString::Format(
"plots/plot_%s.eps", c_evseta_3->GetName() ));