#include "StandardLabels.C" //----------------------- // fiducial_by_package //----------------------- void fiducial_by_package(void) { TColor::CreateColorWheel(); // Create minimum angle curves for each package TGraph *fdc1 = MakeGraph(184.5, 3.0, kBlue); TGraph *fdc2 = MakeGraph(242.9, 3.0, kMagenta); TGraph *fdc3 = MakeGraph(301.4, 3.9, kOrange); TGraph *fdc4 = MakeGraph(339.8, 3.9, kRed); // Get min angle histogram TFile *f = new TFile("../pi_min_theta.root"); TH1D *min_theta = (TH1D*)gROOT->FindObject("min_theta"); // Create integral fraction histo TH1D *imin_theta = (TH1D*)min_theta->Clone("imin_theta"); for(int ibin=2; ibin<=imin_theta->GetNbinsX(); ibin++){ imin_theta->SetBinContent(ibin, imin_theta->GetBinContent(ibin-1) + imin_theta->GetBinContent(ibin)); } double Itot = imin_theta->GetBinContent(imin_theta->GetNbinsX()); for(int ibin=1; ibin<=imin_theta->GetNbinsX(); ibin++){ imin_theta->SetBinContent(ibin, imin_theta->GetBinContent(ibin)/Itot); } // Create a new set of TGraphs mapping the fiducial angles to integral fractions TGraph *ifdc1 = MakeIntFractionGraph(fdc1, imin_theta); TGraph *ifdc2 = MakeIntFractionGraph(fdc2, imin_theta); TGraph *ifdc3 = MakeIntFractionGraph(fdc3, imin_theta); TGraph *ifdc4 = MakeIntFractionGraph(fdc4, imin_theta); TCanvas *c1 = new TCanvas("c1"); c1->SetTicks(); c1->SetGridy(); TH2D *axes = new TH2D("axes", "FDC package acceptance vs. z-vertex", 100, 1.0, 80.0, 100, 0.0, 1.0); axes->SetStats(0); axes->SetXTitle("z vertex (cm)"); axes->Draw(); ifdc1->Draw("Lsame"); ifdc2->Draw("Lsame"); ifdc3->Draw("Lsame"); ifdc4->Draw("Lsame"); TLegend *leg = new TLegend(0.139, 0.129, 0.489, 0.357); leg->SetFillColor(kWhite); leg->AddEntry(ifdc1, "FDC package 1"); leg->AddEntry(ifdc2, "FDC package 2"); leg->AddEntry(ifdc3, "FDC package 3"); leg->AddEntry(ifdc4, "FDC package 4"); leg->Draw(); StandardLabels(axes, "", "", ""); c1->SaveAs("fiducial_by_package.pdf"); c1->SaveAs("fiducial_by_package.png"); } //----------------------- // MakeGraph //----------------------- TGraph* MakeGraph(double z_first_wire, double r_dead_zone, int color) { double z[80]; double theta[80]; for(int i=1; i<=80; i++){ z[i-1] = (double)i; double dZ = z_first_wire - z[i-1]; theta[i-1] = atan(r_dead_zone/dZ)*57.3; } TGraph *g = new TGraph(80, z, theta); g->SetLineColor(color); g->SetMarkerColor(color); g->SetFillColor(kWhite); g->SetLineWidth(3); return g; } //----------------------- // MakeIntFractionGraph //----------------------- TGraph* MakeIntFractionGraph(TGraph *g, TH1D *imin_theta) { double z[80]; double ifrac[80]; for(int i=1; i<=80; i++){ z[i-1] = (double)i; double theta = g->Eval(z[i-1], 0, "S"); int ibin = imin_theta->FindBin(theta); ifrac[i-1] = 1.0 - imin_theta->GetBinContent(ibin); } TGraph *ig = new TGraph(80, z, ifrac); ig->SetLineColor(g->GetLineColor()); ig->SetMarkerColor(g->GetMarkerColor()); ig->SetFillColor(g->GetFillColor()); ig->SetLineWidth(g->GetLineWidth()); return ig; }