#include #include "StandardLabels.C" void E_vs_t(void) { double t_offset = 16.0; double beta = 16.75/30.0; double Rlayer2 = 65.0 + 1.3*1.5; // guess double Lbcal =390.0; TCanvas *c1 = new TCanvas("c1"); new TFile("../degrees12.root"); TTree *degrees12 = (TTree*)gROOT->FindObject("DBCALHit"); new TFile("../degrees15.root"); TTree *degrees15 = (TTree*)gROOT->FindObject("DBCALHit"); new TFile("../degrees20.root"); TTree *degrees20 = (TTree*)gROOT->FindObject("DBCALHit"); new TFile("../degrees30.root"); TTree *degrees30 = (TTree*)gROOT->FindObject("DBCALHit"); TH2D *axes = new TH2D("axes", "", 100, 26.0, 60.0, 100, 0.0, 10000.0); axes->SetStats(0); axes->SetYTitle("E_{measured} (arbitrary units)"); axes->SetXTitle("time (ns)"); TH2D *axes2 = (TH2D*)axes->Clone("axes2"); axes->SetTitle("BCAL Timewalk from M.C. Downstream"); axes2->SetTitle("BCAL Timewalk from M.C. Upstream"); degrees12->SetMarkerColor(kRed); degrees15->SetMarkerColor(kGreen); degrees20->SetMarkerColor(kBlue); degrees30->SetMarkerColor(kMagenta); degrees12->SetLineColor(degrees12->GetMarkerColor()); degrees15->SetLineColor(degrees15->GetMarkerColor()); degrees20->SetLineColor(degrees20->GetMarkerColor()); degrees30->SetLineColor(degrees30->GetMarkerColor()); degrees12->SetLineWidth(5); degrees15->SetLineWidth(5); degrees20->SetLineWidth(5); degrees30->SetLineWidth(5); degrees12->SetTitle("#theta = 12 degrees"); degrees15->SetTitle("#theta = 15 degrees"); degrees20->SetTitle("#theta = 20 degrees"); degrees30->SetTitle("#theta = 30 degrees"); TLegend *leg = new TLegend(0.655, 0.432, 0.887, 0.871); leg->SetFillColor(kWhite); leg->AddEntry(degrees12); leg->AddEntry(degrees15); leg->AddEntry(degrees20); leg->AddEntry(degrees30); c1->Divide(1,2); c1->cd(1); gPad->SetTicks(); gPad->SetGrid(); axes->Draw(); degrees12->Draw("E:t", "layer==2 && end==\"downstream\"", "same"); degrees15->Draw("E:t", "layer==2 && end==\"downstream\"", "same"); degrees20->Draw("E:t", "layer==2 && end==\"downstream\"", "same"); degrees30->Draw("E:t", "layer==2 && end==\"downstream\"", "same"); leg->Draw(); // Draw lines at calculated times double z12 = Lbcal - (Rlayer2/tan(12.0/57.3)+(65.0-17.0)); double z15 = Lbcal - (Rlayer2/tan(15.0/57.3)+(65.0-17.0)); double z20 = Lbcal - (Rlayer2/tan(20.0/57.3)+(65.0-17.0)); double z30 = Lbcal - (Rlayer2/tan(30.0/57.3)+(65.0-17.0)); double tof12 = Rlayer2/sin(12.0/57.3)/(30.0); double tof15 = Rlayer2/sin(15.0/57.3)/(30.0); double tof20 = Rlayer2/sin(20.0/57.3)/(30.0); double tof30 = Rlayer2/sin(30.0/57.3)/(30.0); double t12 = z12/(beta*30.0) + tof12 + t_offset; double t15 = z15/(beta*30.0) + tof15 + t_offset; double t20 = z20/(beta*30.0) + tof20 + t_offset; double t30 = z30/(beta*30.0) + tof30 + t_offset; TLine *lin12 = new TLine(t12, 0.0, t12, 10000.0); TLine *lin15 = new TLine(t15, 0.0, t15, 10000.0); TLine *lin20 = new TLine(t20, 0.0, t20, 10000.0); TLine *lin30 = new TLine(t30, 0.0, t30, 10000.0); lin12->SetLineColor(degrees12->GetLineColor()); lin15->SetLineColor(degrees15->GetLineColor()); lin20->SetLineColor(degrees20->GetLineColor()); lin30->SetLineColor(degrees30->GetLineColor()); lin12->SetLineStyle(2); lin15->SetLineStyle(2); lin20->SetLineStyle(2); lin30->SetLineStyle(2); lin12->SetLineWidth(2); lin15->SetLineWidth(2); lin20->SetLineWidth(2); lin30->SetLineWidth(2); lin12->Draw(); lin15->Draw(); lin20->Draw(); lin30->Draw(); TLatex *t = new TLatex(40.0, 10100.0, "LAYER 2 only"); t->SetTextSize(0.05); t->Draw(); // Energies label string estr("0.100GeV #leq E_{#gamma} #leq 4.0GeV (discrete values)"); StandardLabels(axes); c1->cd(2); gPad->SetTicks(); gPad->SetGrid(); axes2->Draw(); degrees12->Draw("E:t", "layer==2 && end==\"upstream\"", "same"); degrees15->Draw("E:t", "layer==2 && end==\"upstream\"", "same"); degrees20->Draw("E:t", "layer==2 && end==\"upstream\"", "same"); degrees30->Draw("E:t", "layer==2 && end==\"upstream\"", "same"); leg->Draw(); // Draw lines at calculated times double z12 = Rlayer2/tan(12.0/57.3)+(65.0-17.0); double z15 = Rlayer2/tan(15.0/57.3)+(65.0-17.0); double z20 = Rlayer2/tan(20.0/57.3)+(65.0-17.0); double z30 = Rlayer2/tan(30.0/57.3)+(65.0-17.0); double t12 = z12/(beta*30.0) + tof12 + t_offset; double t15 = z15/(beta*30.0) + tof15 + t_offset; double t20 = z20/(beta*30.0) + tof20 + t_offset; double t30 = z30/(beta*30.0) + tof30 + t_offset; TLine *lin12 = new TLine(t12, 0.0, t12, 10000.0); TLine *lin15 = new TLine(t15, 0.0, t15, 10000.0); TLine *lin20 = new TLine(t20, 0.0, t20, 10000.0); TLine *lin30 = new TLine(t30, 0.0, t30, 10000.0); lin12->SetLineColor(degrees12->GetLineColor()); lin15->SetLineColor(degrees15->GetLineColor()); lin20->SetLineColor(degrees20->GetLineColor()); lin30->SetLineColor(degrees30->GetLineColor()); lin12->SetLineStyle(2); lin15->SetLineStyle(2); lin20->SetLineStyle(2); lin30->SetLineStyle(2); lin12->SetLineWidth(2); lin15->SetLineWidth(2); lin20->SetLineWidth(2); lin30->SetLineWidth(2); lin12->Draw(); lin15->Draw(); lin20->Draw(); lin30->Draw(); t->Draw(); if(estr.length()>0)t->DrawLatex(50.0, 10100.0, estr.c_str()); c1->SaveAs("E_vs_t.png"); c1->SaveAs("E_vs_t.pdf"); }