{

Double_t pHeight = 1.5;
Double_t bMargin = 0.1;
Double_t tMargin = 0.01;
Double_t xAxisHeight = 0.18;
Double_t Height;
Height = 3*pHeight + tMargin + bMargin + xAxisHeight;
Double_t pWidth = 2.5;
Double_t rMargin = 0.01;
Double_t lMargin = 0.06;
Double_t yAxisWidth = 0.2;
Double_t Width;
Width = 2*pWidth + rMargin + yAxisWidth;

TFile fresA("/twist/data15/analysis/andr_analysis_fits/standard/nominal_A/nominal_A_standard.root");
fresA->cd();
TH1D* hpresA;
hpresA = (TH1D*)residuals_y->Clone();
TFile fresB("/twist/data15/analysis/andr_analysis_fits/standard/nominal_B/nominal_B_standard.root");
fresB->cd();
TH1D* hpresB;
hpresB = (TH1D*)residuals_y->Clone();
TFile fresLF("/twist/data15/analysis/andr_analysis_fits/standard/low_field/low_field_standard.root");
fresLF->cd();
TH1D* hpresLF;
hpresLF = (TH1D*)residuals_y->Clone();
TFile fresHF("/twist/data15/analysis/andr_analysis_fits/standard/high_field/high_field_standard.root");
fresHF->cd();
TH1D* hpresHF;
hpresHF = (TH1D*)residuals_y->Clone();
TFile fresCl("/twist/data15/analysis/andr_analysis_fits/standard/cloud/cloud_standard.root");
fresCl->cd();
TH1D* hpresCl;
hpresCl = (TH1D*)residuals_y->Clone();
TFile fresWB("/home/andr/analysis/twt.20040904/datav.std/fit3.consistency/fit3_set2an9_to_gen147an1_deriv_ec122.root");
fresWB->cd();
TH1D* hpresWB;
hpresWB = (TH1D*)residuals_y->Clone();


Double_t Lbl = 0.10;

hpresA->SetTitle("");
hpresA->GetXaxis()->SetLabelSize(0);
hpresA->GetXaxis()->SetNdivisions(505,kTRUE);
hpresA->GetYaxis()->SetLabelSize(Lbl*pHeight/(pHeight+tMargin));
hpresA->GetYaxis()->SetNdivisions(205,kTRUE);
hpresA->SetMaximum(3.9);
hpresA->SetMinimum(-3.9);
hpresA->GetXaxis()->SetRangeUser(-0.94,0.94);

hpresB->SetTitle("");
hpresB->GetXaxis()->SetLabelSize(0);
hpresB->GetXaxis()->SetNdivisions(505,kTRUE);
hpresB->GetYaxis()->SetLabelSize(0);
hpresB->GetYaxis()->SetNdivisions(205,kTRUE);
hpresB->SetMaximum(3.9);
hpresB->SetMinimum(-3.9);
hpresB->GetXaxis()->SetRangeUser(-0.94,0.94);

hpresLF->SetTitle("");
hpresLF->GetXaxis()->SetLabelSize(0);
hpresLF->GetXaxis()->SetNdivisions(505,kTRUE);
hpresLF->GetYaxis()->SetLabelSize(Lbl);
hpresLF->GetYaxis()->SetNdivisions(205,kTRUE);
hpresLF->SetMaximum(3.9);
hpresLF->SetMinimum(-3.9);
hpresLF->GetXaxis()->SetRangeUser(-0.94,0.94);

hpresHF->SetTitle("");
hpresHF->GetXaxis()->SetLabelSize(0);
hpresHF->GetXaxis()->SetNdivisions(505,kTRUE);
hpresHF->GetYaxis()->SetLabelSize(0);
hpresHF->GetYaxis()->SetNdivisions(205,kTRUE);
hpresHF->SetMaximum(3.9);
hpresHF->SetMinimum(-3.9);
hpresHF->GetXaxis()->SetRangeUser(-0.94,0.94);

hpresCl->SetTitle("");
hpresCl->GetXaxis()->SetLabelSize(Lbl*pHeight/(pHeight+bMargin));
hpresCl->GetXaxis()->SetNdivisions(505,kTRUE);
hpresCl->GetYaxis()->SetLabelSize(Lbl*pHeight/(pHeight+bMargin));
hpresCl->GetYaxis()->SetNdivisions(205,kTRUE);
hpresCl->SetMaximum(3.9);
hpresCl->SetMinimum(-3.9);
hpresCl->GetXaxis()->SetRangeUser(-0.94,0.94);

hpresWB->SetTitle("");
hpresWB->GetXaxis()->SetLabelSize(Lbl*pHeight/(pHeight+bMargin));
hpresWB->GetXaxis()->SetNdivisions(505,kTRUE);
hpresWB->GetYaxis()->SetLabelSize(0);
hpresWB->GetYaxis()->SetNdivisions(205,kTRUE);
hpresWB->SetMaximum(3.9);
hpresWB->SetMinimum(-3.9);
hpresWB->GetXaxis()->SetRangeUser(-0.94,0.94);

TCanvas *cpres;
cpres = new TCanvas("cpres","Fit residuals vs. momentum",150*Width,150*Height);
cpres->SetFillColor(0);
cpres->SetBorderSize(0.0);
cpres->SetBorderMode(0);
cpres->SetFrameBorderMode(0);
cpres->Divide(1,8);
//----------------------------------------------------------------
cpres->cd(1);
TPad *p1;
p1 = gPad;
p1->SetPad("p1","Nominal A",yAxisWidth/Width,(2*pHeight+bMargin+xAxisHeight)/Height,(yAxisWidth+pWidth)/Width,1.0);
p1->SetFillColor(0);
p1->SetBorderMode(0);
p1->SetBorderSize(0);
p1->SetFrameBorderMode(0);
p1->SetTopMargin(tMargin);
p1->SetRightMargin(0.0);
p1->SetLeftMargin(lMargin);
p1->SetBottomMargin(0.0);
TPaveText *plA;
plA = new TPaveText(-0.5,2,0.5,4);
plA->SetFillStyle(0);
plA->SetBorderSize(0);
plA->SetTextSize(Lbl*pHeight/(pHeight+tMargin));
TText *lA = plA->AddText("Nominal A");
//----------------------------------------------------------------
cpres->cd(2);
TPad *p2;
p2 = gPad;
p2->SetPad("p2","Nominal B",(yAxisWidth+pWidth)/Width,(2*pHeight+bMargin+xAxisHeight)/Height,1.0,1.0);
p2->SetFillColor(0);
p2->SetBorderMode(0);
p2->SetBorderSize(0);
p2->SetFrameBorderMode(0);
p2->SetTopMargin(tMargin);
p2->SetRightMargin(rMargin);
p2->SetLeftMargin(0.0);
p2->SetBottomMargin(0.0);
TPaveText *plB;
plB = new TPaveText(-0.5,2,0.5,4);
plB->SetFillStyle(0);
plB->SetBorderSize(0);
plB->SetTextSize(Lbl*pHeight/(pHeight+tMargin));
TText *lB = plB->AddText("Nominal B");
//----------------------------------------------------------------
cpres->cd(3);
TPad *p3;
p3 = gPad;
p3->SetPad("p3","Test",0.0,0.0,1.0,1.0);
p3->SetPad("p3","Low Field",yAxisWidth/Width,(pHeight+bMargin+xAxisHeight)/Height,(yAxisWidth+pWidth)/Width,(2*pHeight+bMargin+xAxisHeight)/Height);
p3->SetFillColor(0);
p3->SetBorderMode(0);
p3->SetBorderSize(0);
p3->SetFrameBorderMode(0);
p3->SetTopMargin(0.0);
p3->SetRightMargin(0.0);
p3->SetLeftMargin(lMargin);
p3->SetBottomMargin(0.0);
TPaveText *plLF;
plLF = new TPaveText(-0.5,2,0.5,4);
plLF->SetFillStyle(0);
plLF->SetBorderSize(0);
plLF->SetTextSize(Lbl);
TText *lLF = plLF->AddText("Low Field");
//----------------------------------------------------------------
cpres->cd(4);
TPad *p4;
p4 = gPad;
p4->SetPad("p4","High Field",(yAxisWidth+pWidth)/Width,(pHeight+bMargin+xAxisHeight)/Height,1.0,(2*pHeight+bMargin+xAxisHeight)/Height);
p4->SetFillColor(0);
p4->SetBorderMode(0);
p4->SetBorderSize(0);
p4->SetFrameBorderMode(0);
p4->SetTopMargin(0.0);
p4->SetRightMargin(rMargin);
p4->SetLeftMargin(0.0);
p4->SetBottomMargin(0.0);
TPaveText *plHF;
plHF = new TPaveText(-0.5,2,0.5,4);
plHF->SetFillStyle(0);
plHF->SetBorderSize(0);
plHF->SetTextSize(Lbl);
TText *lHF = plHF->AddText("High Field");
//----------------------------------------------------------------
cpres->cd(5);
TPad *p5;
p5 = gPad;
p5->SetPad("p5","Cloud",yAxisWidth/Width,xAxisHeight/Height,(yAxisWidth+pWidth)/Width,(pHeight+bMargin+xAxisHeight)/Height);
p5->SetFillColor(0);
p5->SetBorderMode(0);
p5->SetBorderSize(0);
p5->SetFrameBorderMode(0);
p5->SetTopMargin(0.0);
p5->SetRightMargin(0.0);
p5->SetLeftMargin(lMargin);
p5->SetBottomMargin(bMargin);
TPaveText *plCl;
plCl = new TPaveText(-0.5,2,0.5,4);
plCl->SetFillStyle(0);
plCl->SetBorderSize(0);
plCl->SetTextSize(Lbl*pHeight/(pHeight+bMargin));
TText *lCl = plCl->AddText("Cloud");
//----------------------------------------------------------------
cpres->cd(6);
TPad *p6;
p6 = gPad;
p6->SetPad("p6","Verification",(yAxisWidth+pWidth)/Width,xAxisHeight/Height,1.0,(pHeight+bMargin+xAxisHeight)/Height);
p6->SetFillColor(0);
p6->SetBorderMode(0);
p6->SetBorderSize(0);
p6->SetFrameBorderMode(0);
p6->SetTopMargin(0.0);
p6->SetRightMargin(rMargin);
p6->SetLeftMargin(0.0);
p6->SetBottomMargin(bMargin);
TPaveText *plwb;
plWB = new TPaveText(-0.5,2,0.5,4);
plWB->SetFillStyle(0);
plWB->SetBorderSize(0);
plWB->SetTextSize(Lbl*pHeight/(pHeight+bMargin));
TText *lWB = plWB->AddText("Verification");

//----------------------------------------------------------------
cpres->cd(7);
TPad *p7;
p7 = gPad;
p7->SetPad("p7","y axis",0.0,0.0,yAxisWidth/Width,1.0);
p7->SetFillColor(0);
p7->SetBorderMode(0);
p7->SetBorderSize(0);
p7->SetFrameBorderMode(0);
p7->Range(0.0,0.0,1.0,1.0);
TPaveText *plyAxis;
plyAxis = new TPaveText(0.0,0.524,1.0,0.525);
plyAxis->SetFillStyle(0);
plyAxis->SetBorderSize(0);
plyAxis->SetTextSize(9.5*Lbl);
TText *lyAxis = plyAxis->AddText("(Data-Fit)/#sigma");
lyAxis->SetTextAngle(90);
//----------------------------------------------------------------
cpres->cd(8);
TPad *p8;
p8 = gPad;
p8->SetPad("p8","x axis",yAxisWidth/Width,0.0,1.0,xAxisHeight/Height);
p8->SetFillColor(0);
p8->SetBorderMode(0);
p8->SetBorderSize(0);
p8->SetFrameBorderMode(0);
p8->Range(0.0,0.0,1.0,1.0);
TPaveText *plxAxis;
plxAxis = new TPaveText(0.0,0.49,1.0,0.51);
plxAxis->SetFillStyle(0);
plxAxis->SetBorderSize(0);
plxAxis->SetTextSize(10*Lbl);
TText *lxAxis = plxAxis->AddText("cos #theta");

cpres->cd(1);
hpresA->Draw();
plA->Draw();
cpres->cd(2);
hpresB->Draw();
plB->Draw();
cpres->cd(3);
hpresLF->Draw();
plLF->Draw();
cpres->cd(4);
hpresHF->Draw();
plHF->Draw();
cpres->cd(5);
hpresCl->Draw();
plCl->Draw();
cpres->cd(6);
hpresWB->Draw();
plWB->Draw();
cpres->cd(7);
plyAxis->Draw();
cpres->cd(8);
plxAxis->Draw();

}