#include #include #include #include void graphmulticol(){ //Define parameters common to all analysis configurations const Int_t points = 28; char printname[256]; char graphname1[256]; char xTitle[256]; char yTitle[256]; char GraphText1[256]; char histTitle[256]; char output_line[256]; gStyle->SetStatColor(0);//All this stuff makes backgrounds, etc. gStyle->SetTitleColor(0);//transparent for printing purposes... gStyle->SetCanvasColor(0); gStyle->SetPadColor(0); gStyle->SetPadBorderMode(0); gStyle->SetCanvasBorderMode(0); gStyle->SetFrameBorderMode(0); gStyle->SetPalette(1); gStyle->SetOptStat(kFALSE); gStyle->SetOptStat(11); gStyle->SetOptFit(1111); gStyle->SetPadGridX(kTRUE); gStyle->SetPadGridY(kTRUE); TGaxis::SetMaxDigits(4); ifstream infile_0_3("summary_0_3nA.txt"); ifstream infile_0_5("summary_0_5nA.txt"); ifstream infile_6("summary_6nA.txt"); ifstream infile_10("summary_10nA.txt"); float Run[4], HV[4], PreAmp[4], Navg[4], PedAve[4], PedRMS[4], nonLin[4], nonLinpV[4], Error[4], Chi2p6df[4]; Double_t myHV[4][points], mynonLin[4][points], erx[4][points], ery[4][points], mynonLinpV[4][points], myPreAmp[4][points]; char header[256]; for(int h = 0; h<10; h++) {//read the header info infile_0_3 >> header; infile_0_5 >> header; infile_6 >> header; infile_10 >> header; } for(int i=0; i<28; i++){ infile_0_3 >> Run[0] >> HV[0] >> PreAmp[0] >> Navg[0] >> PedAve[0] >> PedRMS[0] >> nonLin[0] >> Error[0] >> nonLinpV[0] >> Chi2p6df[0]; myHV[0][i] = HV[0]; mynonLin[0][i] = nonLin[0]; erx[0][i] = 0; ery[0][i] = Error[0]; mynonLinpV[0][i] = nonLinpV[0]; myPreAmp[0][i] = PreAmp[0]; } for(int i=0; i<28; i++){ infile_0_5 >> Run[1] >> HV[1] >> PreAmp[1] >> Navg[1] >> PedAve[1] >> PedRMS[1] >> nonLin[1] >> Error[1] >> nonLinpV[1] >> Chi2p6df[1]; myHV[1][i] = HV[1]; mynonLin[1][i] = nonLin[1]; erx[1][i] = 0; ery[1][i] = Error[1]; mynonLinpV[1][i] = nonLinpV[1]; myPreAmp[1][i] = PreAmp[1]; } for(int i=0; i<28; i++){ infile_6 >> Run[2] >> HV[2] >> PreAmp[2] >> Navg[2] >> PedAve[2] >> PedRMS[2] >> nonLin[2] >> Error[2] >> nonLinpV[2] >> Chi2p6df[2]; myHV[2][i] = HV[2]; mynonLin[2][i] = nonLin[2]; erx[2][i] = 0; ery[2][i] = Error[2]; mynonLinpV[2][i] = nonLinpV[2]; myPreAmp[2][i] = PreAmp[2]; } for(int i=0; i<24; i++){ infile_10 >> Run[3] >> HV[3] >> PreAmp[3] >> Navg[3] >> PedAve[3] >> PedRMS[3] >> nonLin[3] >> Error[3] >> nonLinpV[3] >> Chi2p6df[3]; myHV[3][i] = HV[3]; mynonLin[3][i] = nonLin[3]; erx[3][i] = 0; ery[3][i] = Error[3]; mynonLinpV[3][i] = nonLinpV[3]; myPreAmp[3][i] = PreAmp[3]; } infile_0_3.close(); infile_0_5.close(); infile_6.close(); infile_10.close(); TCanvas *c = new TCanvas("c","nonLinearity vs HV",0,0,900,600); gPad->SetLogy(0); gPad->SetLogx(0); gStyle->SetOptStat(kFALSE); TH2F *hr1; hr1 = new TH2F("hr1","",100,-1250,-350,100,-2.5,1); gStyle->SetTitleX(0.18); sprintf(xTitle,"HV (V)"); sprintf(yTitle,"nonLinearity (%)"); hr1->GetYaxis()->SetLabelColor(1); hr1->GetYaxis()->SetTitleColor(1); hr1->SetYTitle(yTitle); hr1->GetXaxis()->CenterTitle(); hr1->GetYaxis()->CenterTitle(); hr1->GetYaxis()->SetTitleOffset(1.3); hr1->GetXaxis()->SetLabelColor(1); hr1->GetXaxis()->SetTitleColor(1); hr1->SetXTitle(xTitle); hr1->Draw(); TPaveLabel *title1 = new TPaveLabel(0.20,0.91,0.60,0.96,"nonLinearity vs HV for PMT#2","NDC"); title1->SetBorderSize(0); title1->SetTextColor(kBlack); title1->SetTextSize(0.80); title1->SetFillColor(0); title1->Draw(); TGraphErrors *gr1 = new TGraphErrors(28,myHV[0],mynonLin[0],erx[0],ery[0]); gr1->SetLineColor(1); gr1->SetMarkerStyle(20); gr1->SetMarkerColor(1); gr1->SetMarkerSize(0.55); gr1->Draw("P"); TGraphErrors *gr2 = new TGraphErrors(28,myHV[1],mynonLin[1],erx[1],ery[1]); gr2->SetLineColor(2); gr2->SetMarkerStyle(20); gr2->SetMarkerColor(2); gr2->SetMarkerSize(0.55); gr2->Draw("P"); TGraphErrors *gr5 = new TGraphErrors(28,myHV[2],mynonLin[2],erx[2],ery[2]); gr5->SetLineColor(6); gr5->SetMarkerStyle(20); gr5->SetMarkerColor(6); gr5->SetMarkerSize(0.55); gr5->Draw("P"); TGraphErrors *gr7 = new TGraphErrors(24,myHV[3],mynonLin[3],erx[3],ery[3]); gr7->SetLineColor(8); gr7->SetMarkerStyle(20); gr7->SetMarkerColor(8); gr7->SetMarkerSize(0.55); gr7->Draw("P"); TLegend *leg1 = new TLegend(0.15,0.15,0.25,0.45); leg1->SetBorderSize(0); leg1->SetFillStyle(0); leg1->AddEntry(gr1,"0.3 nA LL","EP"); leg1->AddEntry(gr2,"0.5 nA LL","EP"); leg1->AddEntry(gr5,"6 nA LL","EP"); leg1->AddEntry(gr7,"10 nA LL","EP"); leg1->Draw(); sprintf(printname,"nonLinearity_vs_HV.png"); c->Print(printname); TCanvas *c1 = new TCanvas("c1","nonLinearity per volt vs HV",0,0,900,600); gPad->SetLogy(0); gPad->SetLogx(0); gStyle->SetOptStat(kFALSE); sprintf(graphname1,""); TH2F *hr2; hr2 = new TH2F("hr2","",100,-1250,-350,100,-0.5,0.2); gStyle->SetTitleX(0.18); sprintf(xTitle,"HV (V)"); sprintf(yTitle,"nonLinearity (%) per volt"); hr2->GetYaxis()->SetLabelColor(1); hr2->GetYaxis()->SetTitleColor(1); hr2->SetYTitle(yTitle); hr2->GetXaxis()->CenterTitle(); hr2->GetYaxis()->CenterTitle(); hr2->GetYaxis()->SetTitleOffset(1.3); hr2->GetXaxis()->SetLabelColor(1); hr2->GetXaxis()->SetTitleColor(1); hr2->SetXTitle(xTitle); hr2->Draw(); TPaveLabel *title2 = new TPaveLabel(0.20,0.91,0.60,0.96,"nonLinearity per volt vs HV for PMT#2","NDC"); title2->SetBorderSize(0); title2->SetTextColor(kBlack); title2->SetTextSize(0.80); title2->SetFillColor(0); title2->Draw(); TGraphErrors *gr1 = new TGraphErrors(28,myHV[0],mynonLinpV[0]); gr1->SetLineColor(1); gr1->SetMarkerStyle(20); gr1->SetMarkerColor(1); gr1->SetMarkerSize(0.55); gr1->Draw("P"); TGraphErrors *gr2 = new TGraphErrors(28,myHV[1],mynonLinpV[1]); gr2->SetLineColor(2); gr2->SetMarkerStyle(20); gr2->SetMarkerColor(2); gr2->SetMarkerSize(0.55); gr2->Draw("P"); TGraphErrors *gr5 = new TGraphErrors(28,myHV[2],mynonLinpV[2]); gr5->SetLineColor(6); gr5->SetMarkerStyle(20); gr5->SetMarkerColor(6); gr5->SetMarkerSize(0.55); gr5->Draw("P"); TGraphErrors *gr7 = new TGraphErrors(24,myHV[3],mynonLinpV[3]); gr7->SetLineColor(8); gr7->SetMarkerStyle(20); gr7->SetMarkerColor(8); gr7->SetMarkerSize(0.55); gr7->Draw("P"); TLegend *leg1 = new TLegend(0.15,0.15,0.25,0.45); leg1->SetBorderSize(0); leg1->SetFillStyle(0); leg1->AddEntry(gr1,"0.3 nA LL","EP"); leg1->AddEntry(gr2,"0.5 nA LL","EP"); leg1->AddEntry(gr5,"6 nA LL","EP"); leg1->AddEntry(gr7,"10 nA LL","EP"); leg1->Draw(); sprintf(printname,"nonLinearity_per_volt_vs_HV.png"); c1->Print(printname); TCanvas *c2 = new TCanvas("c2","nonLinearity vs PreAmp",0,0,900,600); gPad->SetLogy(0); gPad->SetLogx(0); gStyle->SetOptStat(kFALSE); sprintf(graphname1,""); TH2F *hr3; hr3 = new TH2F("hr3","",100,0,11,100,-2,1); gStyle->SetTitleX(0.18); sprintf(xTitle,"PreAmp (MOhm)"); sprintf(yTitle,"nonLinearity (%)"); hr3->GetYaxis()->SetLabelColor(1); hr3->GetYaxis()->SetTitleColor(1); hr3->SetYTitle(yTitle); hr3->GetXaxis()->CenterTitle(); hr3->GetYaxis()->CenterTitle(); hr3->GetYaxis()->SetTitleOffset(1.3); hr3->GetXaxis()->SetLabelColor(1); hr3->GetXaxis()->SetTitleColor(1); hr3->SetXTitle(xTitle); hr3->Draw(); TPaveLabel *title3 = new TPaveLabel(0.20,0.91,0.60,0.96,"nonLinearity vs preAmp for PMT#2","NDC"); title3->SetBorderSize(0); title3->SetTextColor(kBlack); title3->SetTextSize(0.80); title3->SetFillColor(0); title3->Draw(); TGraphErrors *gr1 = new TGraphErrors(28,myPreAmp[0],mynonLin[0]); gr1->SetLineColor(1); gr1->SetMarkerStyle(20); gr1->SetMarkerColor(1); gr1->SetMarkerSize(0.55); gr1->Draw("P"); TGraphErrors *gr2 = new TGraphErrors(28,myPreAmp[1],mynonLin[1]); gr2->SetLineColor(2); gr2->SetMarkerStyle(20); gr2->SetMarkerColor(2); gr2->SetMarkerSize(0.55); gr2->Draw("P"); TGraphErrors *gr5 = new TGraphErrors(28,myPreAmp[2],mynonLin[2]); gr5->SetLineColor(6); gr5->SetMarkerStyle(20); gr5->SetMarkerColor(6); gr5->SetMarkerSize(0.55); gr5->Draw("P"); TGraphErrors *gr7 = new TGraphErrors(24,myPreAmp[3],mynonLin[3]); gr7->SetLineColor(8); gr7->SetMarkerStyle(20); gr7->SetMarkerColor(8); gr7->SetMarkerSize(0.55); gr7->Draw("P"); TLegend *leg1 = new TLegend(0.65,0.15,0.85,0.45); leg1->SetBorderSize(0); leg1->SetFillStyle(0); leg1->AddEntry(gr1,"0.3 nA LL","EP"); leg1->AddEntry(gr2,"0.5 nA LL","EP"); leg1->AddEntry(gr5,"6 nA LL","EP"); leg1->AddEntry(gr7,"10 nA LL","EP"); leg1->Draw(); sprintf(printname,"nonLinearity_vs_PreAmp.png"); c2->Print(printname); return ; }