#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_0_7("summary_0_7.txt"); ifstream infile_3("summary_3nA.txt"); ifstream infile_6("summary_6nA.txt"); ifstream infile_7("summary_7nA.txt"); ifstream infile_10("summary_10nA.txt"); ifstream infile_14("summary_14nA.txt"); float Run[8], HV[8], PreAmp[8], Navg[8], PedAve[7], PedRMS[7], nonLin[8], nonLinpV[7], Error[8], Chi2p6df[7]; Double_t myHV[8][points], mynonLin[8][points], erx[8][points], ery[8][points], mynonLinpV[8][points], myPreAmp[8][points]; char header[256]; for(int h = 0; h<10; h++) {//read the header info infile_0_3 >> header; infile_0_5 >> header; infile_0_7 >> header; infile_6 >> header; infile_7 >> header; infile_10 >> header; infile_14 >> header; } for(int h = 0; h<7; h++) { //read the header info infile_3 >> header; } for(int i=0; i<24; 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<24; 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<12; i++){ infile_0_7 >> 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]; cout << Run[2] << " " << HV[2] << " " << PreAmp[2] <<" "<< Navg[2] << endl; } for(int i=0; i<5; i++){ infile_3 >> Run[3] >> HV[3] >> PreAmp[3] >> Navg[3] >> nonLin[3] >> Error[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]; } for(int i=0; i<28; i++){ infile_6 >> Run[4] >> HV[4] >> PreAmp[4] >> Navg[4] >> PedAve[4] >> PedRMS[4] >> nonLin[4] >> Error[4] >> nonLinpV[4] >> Chi2p6df[4]; myHV[4][i] = HV[4]; mynonLin[4][i] = nonLin[4]; erx[4][i] = 0; ery[4][i] = Error[4]; mynonLinpV[4][i] = nonLinpV[4]; myPreAmp[4][i] = PreAmp[4]; } for(int i=0; i<28; i++){ infile_10 >> Run[6] >> HV[6] >> PreAmp[6] >> Navg[6] >> PedAve[6] >> PedRMS[6] >> nonLin[6] >> Error[6] >> nonLinpV[6] >> Chi2p6df[6]; myHV[6][i] = HV[6]; mynonLin[6][i] = nonLin[6]; erx[6][i] = 0; ery[6][i] = Error[6]; mynonLinpV[6][i] = nonLinpV[6]; myPreAmp[6][i] = PreAmp[6]; } for(int i=0; i<16; i++){ infile_7 >> Run[5] >> HV[5] >> PreAmp[5] >> Navg[5] >> PedAve[5] >> PedRMS[5] >> nonLin[5] >> Error[5] >> nonLinpV[5] >> Chi2p6df[5]; myHV[5][i] = HV[5]; mynonLin[5][i] = nonLin[5]; erx[5][i] = 0; ery[5][i] = Error[5]; mynonLinpV[5][i] = nonLinpV[5]; myPreAmp[5][i] = PreAmp[5]; } for(int i=0; i<15; i++){ infile_14 >> Run[7] >> HV[7] >> PreAmp[7] >> Navg[7] >> PedAve[7] >> PedRMS[7] >> nonLin[7] >> Error[7] >> nonLinpV[7] >> Chi2p6df[7]; myHV[7][i] = HV[7]; mynonLin[7][i] = nonLin[7]; erx[7][i] = 0; ery[7][i] = Error[7]; mynonLinpV[7][i] = nonLinpV[7]; myPreAmp[7][i] = PreAmp[7]; } infile_0_3.close(); infile_0_5.close(); infile_0_7.close(); infile_3.close(); infile_6.close(); infile_7.close(); infile_10.close(); infile_14.close(); TCanvas *c = new TCanvas("c","nonLinearity vs HV",0,0,900,600); gPad->SetLogy(0); gPad->SetLogx(0); gStyle->SetOptStat(kFALSE); sprintf(graphname1,""); TH2F *hr1; hr1 = new TH2F("hr1",graphname1,100,-1200,-400,100,-5,2); 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(); TGraphErrors *gr1 = new TGraphErrors(24,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(24,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 *gr3 = new TGraphErrors(points,myHV[2],mynonLin[2],erx[2],ery[2]); gr3->SetLineColor(3); gr3->SetMarkerStyle(20); gr3->SetMarkerColor(3); gr3->SetMarkerSize(0.55); gr3->Draw("P"); TGraphErrors *gr4 = new TGraphErrors(points,myHV[3],mynonLin[3],erx[3],ery[3]); gr4->SetLineColor(4); gr4->SetMarkerStyle(20); gr4->SetMarkerColor(4); gr4->SetMarkerSize(0.55); gr4->Draw("P"); TGraphErrors *gr5 = new TGraphErrors(points,myHV[4],mynonLin[4],erx[4],ery[4]); gr5->SetLineColor(6); gr5->SetMarkerStyle(20); gr5->SetMarkerColor(6); gr5->SetMarkerSize(0.55); gr5->Draw("P"); TGraphErrors *gr6 = new TGraphErrors(points,myHV[5],mynonLin[5],erx[5],ery[5]); gr6->SetLineColor(7); gr6->SetMarkerStyle(20); gr6->SetMarkerColor(7); gr6->SetMarkerSize(0.55); gr6->Draw("P"); TGraphErrors *gr7 = new TGraphErrors(points,myHV[6],mynonLin[6],erx[6],ery[6]); gr7->SetLineColor(8); gr7->SetMarkerStyle(20); gr7->SetMarkerColor(8); gr7->SetMarkerSize(0.55); gr7->Draw("P"); TGraphErrors *gr8 = new TGraphErrors(points,myHV[7],mynonLin[7],erx[7],ery[7]); gr8->SetLineColor(9); gr8->SetMarkerStyle(20); gr8->SetMarkerColor(9); gr8->SetMarkerSize(0.55); gr8->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(gr3,"0.7 nA LL","EP"); leg1->AddEntry(gr4,"3 nA LL","EP"); leg1->AddEntry(gr5,"6 nA LL","EP"); leg1->AddEntry(gr6,"7 nA LL","EP"); leg1->AddEntry(gr7,"10 nA LL","EP"); leg1->AddEntry(gr8,"14 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",graphname1,100,-1200,-400,100,-2,1); 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(); TGraphErrors *gr1 = new TGraphErrors(24,myHV[0],mynonLinpV[0]); gr1->SetLineColor(1); gr1->SetMarkerStyle(20); gr1->SetMarkerColor(1); gr1->SetMarkerSize(0.55); gr1->Draw("P"); TGraphErrors *gr2 = new TGraphErrors(24,myHV[1],mynonLinpV[1]); gr2->SetLineColor(2); gr2->SetMarkerStyle(20); gr2->SetMarkerColor(2); gr2->SetMarkerSize(0.55); gr2->Draw("P"); TGraphErrors *gr3 = new TGraphErrors(points,myHV[2],mynonLinpV[2]); gr3->SetLineColor(3); gr3->SetMarkerStyle(20); gr3->SetMarkerColor(3); gr3->SetMarkerSize(0.55); gr3->Draw("P"); TGraphErrors *gr5 = new TGraphErrors(points,myHV[4],mynonLinpV[4]); gr5->SetLineColor(6); gr5->SetMarkerStyle(20); gr5->SetMarkerColor(6); gr5->SetMarkerSize(0.55); gr5->Draw("P"); TGraphErrors *gr6 = new TGraphErrors(points,myHV[5],mynonLinpV[5]); gr6->SetLineColor(7); gr6->SetMarkerStyle(20); gr6->SetMarkerColor(7); gr6->SetMarkerSize(0.55); gr6->Draw("P"); TGraphErrors *gr7 = new TGraphErrors(points,myHV[6],mynonLinpV[6]); gr7->SetLineColor(8); gr7->SetMarkerStyle(20); gr7->SetMarkerColor(8); gr7->SetMarkerSize(0.55); gr7->Draw("P"); TGraphErrors *gr8 = new TGraphErrors(points,myHV[7],mynonLinpV[7]); gr8->SetLineColor(9); gr8->SetMarkerStyle(20); gr8->SetMarkerColor(9); gr8->SetMarkerSize(0.55); gr8->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(gr3,"0.7 nA LL","EP"); leg1->AddEntry(gr5,"6 nA LL","EP"); leg1->AddEntry(gr6,"7 nA LL","EP"); leg1->AddEntry(gr7,"10 nA LL","EP"); leg1->AddEntry(gr8,"14 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",graphname1,100,0,11,100,-5,2); 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(); TGraphErrors *gr1 = new TGraphErrors(points,myPreAmp[0],mynonLin[0]); gr1->SetLineColor(1); gr1->SetMarkerStyle(20); gr1->SetMarkerColor(1); gr1->SetMarkerSize(0.55); gr1->Draw("P"); TGraphErrors *gr2 = new TGraphErrors(points,myPreAmp[1],mynonLin[1]); gr2->SetLineColor(2); gr2->SetMarkerStyle(20); gr2->SetMarkerColor(2); gr2->SetMarkerSize(0.55); gr2->Draw("P"); TGraphErrors *gr3 = new TGraphErrors(points,myPreAmp[2],mynonLin[2]); gr3->SetLineColor(3); gr3->SetMarkerStyle(20); gr3->SetMarkerColor(3); gr3->SetMarkerSize(0.55); gr3->Draw("P"); TGraphErrors *gr4 = new TGraphErrors(points,myPreAmp[3],mynonLin[3]); gr4->SetLineColor(4); gr4->SetMarkerStyle(20); gr4->SetMarkerColor(4); gr4->SetMarkerSize(0.55); gr4->Draw("P"); TGraphErrors *gr5 = new TGraphErrors(points,myPreAmp[4],mynonLin[4]); gr5->SetLineColor(6); gr5->SetMarkerStyle(20); gr5->SetMarkerColor(6); gr5->SetMarkerSize(0.55); gr5->Draw("P"); TGraphErrors *gr6 = new TGraphErrors(points,myPreAmp[5],mynonLin[5]); gr6->SetLineColor(7); gr6->SetMarkerStyle(20); gr6->SetMarkerColor(7); gr6->SetMarkerSize(0.55); gr6->Draw("P"); TGraphErrors *gr7 = new TGraphErrors(points,myPreAmp[6],mynonLin[6]); gr7->SetLineColor(8); gr7->SetMarkerStyle(20); gr7->SetMarkerColor(8); gr7->SetMarkerSize(0.55); gr7->Draw("P"); TGraphErrors *gr8 = new TGraphErrors(points,myPreAmp[7],mynonLin[7]); gr8->SetLineColor(9); gr8->SetMarkerStyle(20); gr8->SetMarkerColor(9); gr8->SetMarkerSize(0.55); gr8->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(gr3,"0.7 nA LL","EP"); leg1->AddEntry(gr4,"3 nA LL","EP"); leg1->AddEntry(gr5,"6 nA LL","EP"); leg1->AddEntry(gr6,"7 nA LL","EP"); leg1->AddEntry(gr7,"10 nA LL","EP"); leg1->AddEntry(gr8,"14 nA LL","EP"); leg1->Draw(); sprintf(printname,"nonLinearity_vs_PreAmp.png"); c2->Print(printname); return ; }