//#include "StandardLabels.C" //#include "GlueX_boundaries.C" void AddLabel(double x, double y, string str, int color); void step_size_vs_r_vs_z(void) { gROOT->Reset(); gStyle->SetPalette(1); TCanvas *c1 = new TCanvas("c1"); c1->SetTicks(); c1->SetGrid(); c1->SetRightMargin(0.125); TFile *f = new TFile("bfield.root"); TH2D *dBtot_vs_r_vs_z = (TH2D*)gROOT->FindObject("dBtot_vs_r_vs_z"); TH2D *step_size_vs_r_vs_z = (TH2D*)dBtot_vs_r_vs_z->Clone("step_size_vs_r_vs_z"); // Convert from Tesla/cm to Gauss/cm step_size_vs_r_vs_z->Scale(10000.0); int Nrbins = step_size_vs_r_vs_z->GetYaxis()->GetNbins(); int Nzbins = step_size_vs_r_vs_z->GetXaxis()->GetNbins(); for(int ir=1; ir<=Nrbins; ir++){ for(int iz=1; iz<=Nzbins; iz++){ double val = step_size_vs_r_vs_z->GetBinContent(iz, ir); double step_size = 200.0/val; step_size_vs_r_vs_z->SetBinContent(iz, ir, step_size); } } step_size_vs_r_vs_z->SetTitle("Step size for B-field mapping"); step_size_vs_r_vs_z->SetXTitle("z (cm)"); step_size_vs_r_vs_z->SetYTitle("r (cm)"); step_size_vs_r_vs_z->SetZTitle("cm"); step_size_vs_r_vs_z->SetStats(0); step_size_vs_r_vs_z->GetXaxis()->SetRangeUser(-100.0, 450.0); step_size_vs_r_vs_z->GetYaxis()->SetRangeUser(0.0, 90.0); step_size_vs_r_vs_z->GetZaxis()->SetRangeUser(0.0, 10.0); step_size_vs_r_vs_z->SetContour(6); step_size_vs_r_vs_z->SetContourLevel(1, 0.5); step_size_vs_r_vs_z->SetContourLevel(2, 1.0); step_size_vs_r_vs_z->SetContourLevel(3, 2.0); step_size_vs_r_vs_z->SetContourLevel(4, 4.0); step_size_vs_r_vs_z->SetContourLevel(5, 8.0); step_size_vs_r_vs_z->SetContourLevel(6, 16.0); step_size_vs_r_vs_z->Draw("colz"); AddLabel(160.0, 15.0, "10cm", kWhite); AddLabel(95.0, 12.0, "8cm", kBlack); AddLabel(50.0, 10.0, "4cm", kBlack); AddLabel(-10.0, 7.0, "2cm", kBlack); AddLabel(-7.6, 65.0, "1cm", kBlack); AddLabel(351, 87.0, "5mm", kWhite); //StandardLabels1D(grad,"solenoid_1500_poisson_20090814_01"); // Save c1->SaveAs("step_size_vs_r_vs_z.pdf"); c1->SaveAs("step_size_vs_r_vs_z.png"); } void AddLabel(double x, double y, string str, int color) { TLatex *lab = new TLatex(x, y, str.c_str()); lab->SetTextSize(0.04); lab->SetTextAlign(22); lab->SetTextColor(color); lab->Draw(); }