// Draw a graph with text attached to each point. // The text is drawn in a TExec function, therefore if the text is // moved interactively, it will be automatically updated. void graphmulticol() { const Int_t n = 8; ifstream infile("hw_sum.txt"); Double_t Run[n], HV[n], PreAmp[n], Navg[n], PedAve[n], PedRMS[n], nonLin[n], nonLinpV[n], Error[n], Chi2p6df[n], I_out[n]; Double_t RelativeWidth[n], my_hv[n], my_nonLin[n], Chi2[n], erX[n], erY[n], my_PreAmp[n], my_Navg[n], Vout[n], my_nonLinpV[n], my_Iout[n]; char header[256]; for(int h = 0; h<11; h++) { //read the header info infile >> header; } Double_t Vperch = 76.29E-6; //Volts per channel for(int i=0;i> Run[i] >> HV[i] >> PreAmp[i] >> Navg[i] >> PedAve[i] >> PedRMS[i] >> nonLin[i] >> Error[i] >> nonLinpV[i] >> Chi2p6df[i] >> I_out[i]; RelativeWidth[i] = PedRMS[i]/PedAve[i]; my_hv[i] = HV[i]; my_nonLin[i] = nonLin[i]; my_nonLinpV[i] = nonLinpV[i]; Chi2[i] = Chi2p6df[i]; my_PreAmp[i] = PreAmp[i]; erX[i] = 0.0; erY[i] = Error[i]; my_Navg[i] = Navg[i]; Vout[i] = Navg[i]*Vperch; my_Iout[i] = I_out[i]; cout << Run[i]<<" "<SetGrid(); TGraphErrors *gr = new TGraphErrors(n,my_hv,my_nonLin,erX,erY); gr->SetTitle("non-Linearity vs HV;HV;non-Linearity"); gr->SetMarkerStyle(20); TExec *ex = new TExec("ex","drawtext();"); gr->GetListOfFunctions()->Add(ex); gr->Draw("AP"); char flip[256], text[256]; sprintf(flip,"LED flash rate: 240 Hz , with LL: 7.0 nA, PMT# 3"); TPaveLabel *pt_ff = new TPaveLabel(0.17,0.85,0.50,0.89,flip,"NDC"); pt_ff->SetBorderSize(0); pt_ff->SetTextColor(kBlack); pt_ff->SetTextSize(0.80); pt_ff->SetFillColor(0); pt_ff->Draw(); sprintf(text,"preAmp and I_anode are shown for each data point"); TPaveLabel *pt_ff = new TPaveLabel(0.30,0.15,0.60,0.19,text,"NDC"); pt_ff->SetBorderSize(0); pt_ff->SetTextColor(kBlack); pt_ff->SetTextSize(0.80); pt_ff->SetFillColor(0); pt_ff->Draw(); char plotname[256]; sprintf(plotname,"./nonLin_vs_HV.png"); c1->Print(plotname); TCanvas *c2 = new TCanvas("c2","non-Linearity vs preAmp",1000,700); c2->SetGrid(); TGraphErrors *gr = new TGraphErrors(n,my_PreAmp,my_nonLin,erX,erY); gr->SetTitle("non-Linearity vs PreAmp;PreAmp;non-Linearity"); gr->SetMarkerStyle(20); TExec *ex = new TExec("ex","HVoltage();"); gr->GetListOfFunctions()->Add(ex); gr->Draw("AP"); char flip[256], text[256]; sprintf(flip,"LED flash rate: 240 Hz , with LL: 7.0 nA, PMT# 3"); TPaveLabel *pt_ff = new TPaveLabel(0.17,0.85,0.50,0.89,flip,"NDC"); pt_ff->SetBorderSize(0); pt_ff->SetTextColor(kBlack); pt_ff->SetTextSize(0.80); pt_ff->SetFillColor(0); pt_ff->Draw(); sprintf(text,"HV and I_anode are shown for each data point"); TPaveLabel *pt_ff = new TPaveLabel(0.30,0.15,0.60,0.19,text,"NDC"); pt_ff->SetBorderSize(0); pt_ff->SetTextColor(kBlack); pt_ff->SetTextSize(0.80); pt_ff->SetFillColor(0); pt_ff->Draw(); char plotname[256]; sprintf(plotname,"./nonLin_vs_PreAmp.png"); c2->Print(plotname); TCanvas *c3 = new TCanvas("c3","non-Linearity vs Navg",1000,700); c3->SetGrid(); TGraphErrors *gr = new TGraphErrors(n,my_Navg,my_nonLin,erX,erY); gr->SetTitle("non-Linearity vs Navg;Navg;non-Linearity"); gr->SetMarkerStyle(20); TExec *ex = new TExec("ex","HVoltage();"); gr->GetListOfFunctions()->Add(ex); gr->Draw("AP"); char flip[256], text[256]; sprintf(flip,"LED flash rate: 240 Hz , with LL: 7.0 nA, PMT# 3"); TPaveLabel *pt_ff = new TPaveLabel(0.17,0.85,0.50,0.89,flip,"NDC"); pt_ff->SetBorderSize(0); pt_ff->SetTextColor(kBlack); pt_ff->SetTextSize(0.80); pt_ff->SetFillColor(0); pt_ff->Draw(); sprintf(text,"HV and I_anode are shown for each data point"); TPaveLabel *pt_ff = new TPaveLabel(0.30,0.15,0.60,0.19,text,"NDC"); pt_ff->SetBorderSize(0); pt_ff->SetTextColor(kBlack); pt_ff->SetTextSize(0.80); pt_ff->SetFillColor(0); pt_ff->Draw(); char plotname[256]; sprintf(plotname,"./nonLin_vs_Navg.png"); c3->Print(plotname); TCanvas *c4 = new TCanvas("c4","non-Linearity vs RelativeWidth",1000,700); c4->SetGrid(); TGraphErrors *gr = new TGraphErrors(n,RelativeWidth,my_nonLin,erX,erY); gr->SetTitle("non-Linearity vs RelativeWidth;RelativeWidth;non-Linearity"); gr->SetMarkerStyle(20); TExec *ex = new TExec("ex","HVoltage();"); gr->GetListOfFunctions()->Add(ex); gr->Draw("AP"); char flip[256], text[256]; sprintf(flip,"LED flash rate: 240 Hz , with LL: 7.0 nA, PMT# 3"); TPaveLabel *pt_ff = new TPaveLabel(0.17,0.85,0.50,0.89,flip,"NDC"); pt_ff->SetBorderSize(0); pt_ff->SetTextColor(kBlack); pt_ff->SetTextSize(0.80); pt_ff->SetFillColor(0); pt_ff->Draw(); sprintf(text,"HV and I_anode are shown for each data point"); TPaveLabel *pt_ff = new TPaveLabel(0.30,0.15,0.60,0.19,text,"NDC"); pt_ff->SetBorderSize(0); pt_ff->SetTextColor(kBlack); pt_ff->SetTextSize(0.80); pt_ff->SetFillColor(0); pt_ff->Draw(); char plotname[256]; sprintf(plotname,"./nonLin_vs_RelativeWidth.png"); c4->Print(plotname); TCanvas *c5 = new TCanvas("c5","non-Linearity vs ADC Signal",1000,700); c5->SetGrid(); TGraphErrors *gr = new TGraphErrors(n,Vout,my_nonLin,erX,erY); gr->SetTitle("non-Linearity vs ADC Signal;ADC Signal;non-Linearity"); gr->SetMarkerStyle(20); TExec *ex = new TExec("ex","HVoltage();"); gr->GetListOfFunctions()->Add(ex); gr->Draw("AP"); char flip[256], text[256]; sprintf(flip,"LED flash rate: 240 Hz , with LL: 7.0 nA, PMT# 3"); TPaveLabel *pt_ff = new TPaveLabel(0.17,0.85,0.50,0.89,flip,"NDC"); pt_ff->SetBorderSize(0); pt_ff->SetTextColor(kBlack); pt_ff->SetTextSize(0.80); pt_ff->SetFillColor(0); pt_ff->Draw(); sprintf(text,"HV and I_anode are shown for each data point"); TPaveLabel *pt_ff = new TPaveLabel(0.30,0.15,0.60,0.19,text,"NDC"); pt_ff->SetBorderSize(0); pt_ff->SetTextColor(kBlack); pt_ff->SetTextSize(0.80); pt_ff->SetFillColor(0); pt_ff->Draw(); char plotname[256]; sprintf(plotname,"./nonLin_vs_ADCSignal.png"); c5->Print(plotname); TCanvas *c6 = new TCanvas("c6","non-Linearity per volt vs HV",1000,700); c6->SetGrid(); TGraphErrors *gr = new TGraphErrors(n,my_hv,my_nonLinpV); gr->SetTitle("non-Linearity per volt vs HV;HV;non-Linearity/V"); gr->SetMarkerStyle(20); TExec *ex = new TExec("ex","drawtext();"); gr->GetListOfFunctions()->Add(ex); gr->Draw("AP"); char flip[256], text[256]; sprintf(flip,"LED flash rate: 240 Hz , with LL: 7.0 nA, PMT# 3"); TPaveLabel *pt_ff = new TPaveLabel(0.17,0.85,0.50,0.89,flip,"NDC"); pt_ff->SetBorderSize(0); pt_ff->SetTextColor(kBlack); pt_ff->SetTextSize(0.80); pt_ff->SetFillColor(0); pt_ff->Draw(); sprintf(text,"preAmp and I_anode are shown for each data point"); TPaveLabel *pt_ff = new TPaveLabel(0.30,0.15,0.60,0.19,text,"NDC"); pt_ff->SetBorderSize(0); pt_ff->SetTextColor(kBlack); pt_ff->SetTextSize(0.80); pt_ff->SetFillColor(0); pt_ff->Draw(); char plotname[256]; sprintf(plotname,"./nonLin_perV_vs_HV.png"); c6->Print(plotname); TCanvas *c7 = new TCanvas("c7","non-Linearity per Volt vs preAmp",1000,700); c7->SetGrid(); TGraphErrors *gr = new TGraphErrors(n,my_PreAmp,my_nonLinpV); gr->SetTitle("non-Linearity per Volt vs PreAmp;PreAmp;non-Linearity/V"); gr->SetMarkerStyle(20); TExec *ex = new TExec("ex","HVoltage();"); gr->GetListOfFunctions()->Add(ex); gr->Draw("AP"); char flip[256], text[256]; sprintf(flip,"LED flash rate: 240 Hz , with LL: 7.0 nA, PMT# 3"); TPaveLabel *pt_ff = new TPaveLabel(0.17,0.85,0.50,0.89,flip,"NDC"); pt_ff->SetBorderSize(0); pt_ff->SetTextColor(kBlack); pt_ff->SetTextSize(0.80); pt_ff->SetFillColor(0); pt_ff->Draw(); sprintf(text,"HV and I_anode are shown for each data point"); TPaveLabel *pt_ff = new TPaveLabel(0.30,0.15,0.60,0.19,text,"NDC"); pt_ff->SetBorderSize(0); pt_ff->SetTextColor(kBlack); pt_ff->SetTextSize(0.80); pt_ff->SetFillColor(0); pt_ff->Draw(); char plotname[256]; sprintf(plotname,"./nonLin_perV_vs_PreAmp.png"); c7->Print(plotname); TCanvas *c8 = new TCanvas("c8","non-Linearity per Volt vs ADC Signal",1000,700); c8->SetGrid(); TGraphErrors *gr = new TGraphErrors(n,Vout,my_nonLinpV); gr->SetTitle("non-Linearity per Volt vs ADC Signal;ADC Signal;non-Linearity/Volt"); gr->SetMarkerStyle(20); TExec *ex = new TExec("ex","HVoltage();"); gr->GetListOfFunctions()->Add(ex); gr->Draw("AP"); char flip[256], text[256]; sprintf(flip,"LED flash rate: 240 Hz , with LL: 7.0 nA, PMT# 3"); TPaveLabel *pt_ff = new TPaveLabel(0.17,0.85,0.50,0.89,flip,"NDC"); pt_ff->SetBorderSize(0); pt_ff->SetTextColor(kBlack); pt_ff->SetTextSize(0.80); pt_ff->SetFillColor(0); pt_ff->Draw(); sprintf(text,"HV and I_anode are shown for each data point"); TPaveLabel *pt_ff = new TPaveLabel(0.30,0.15,0.60,0.19,text,"NDC"); pt_ff->SetBorderSize(0); pt_ff->SetTextColor(kBlack); pt_ff->SetTextSize(0.80); pt_ff->SetFillColor(0); pt_ff->Draw(); char plotname[256]; sprintf(plotname,"./nonLin_perV_vs_ADCSignal.png"); c8->Print(plotname); TCanvas *c9 = new TCanvas("c9","Chi Square vs HV",1000,700); c9->SetGrid(); TGraphErrors *gr = new TGraphErrors(n,my_hv,Chi2); gr->SetTitle("Chi Square vs HV;HV;Chi Square"); gr->SetMarkerStyle(20); TExec *ex = new TExec("ex","drawtext();"); gr->GetListOfFunctions()->Add(ex); gr->Draw("AP"); char flip[256], text[256]; sprintf(flip,"LED flash rate: 240 Hz , with LL: 7.0 nA, PMT# 3"); TPaveLabel *pt_ff = new TPaveLabel(0.17,0.85,0.50,0.89,flip,"NDC"); pt_ff->SetBorderSize(0); pt_ff->SetTextColor(kBlack); pt_ff->SetTextSize(0.80); pt_ff->SetFillColor(0); pt_ff->Draw(); sprintf(text,"PreAmp and I_anode are shown for each data point"); TPaveLabel *pt_ff = new TPaveLabel(0.30,0.15,0.60,0.19,text,"NDC"); pt_ff->SetBorderSize(0); pt_ff->SetTextColor(kBlack); pt_ff->SetTextSize(0.80); pt_ff->SetFillColor(0); pt_ff->Draw(); char plotname[256]; sprintf(plotname,"./Chi_Sq_vs_HV.png"); c9->Print(plotname); TCanvas *c10 = new TCanvas("c10","Chi Square vs PreAmp",1000,700); c10->SetGrid(); TGraphErrors *gr = new TGraphErrors(n,my_PreAmp,Chi2); gr->SetTitle("Chi Square vs PreAmp;PreAmp;Chi Square"); gr->SetMarkerStyle(20); TExec *ex = new TExec("ex","HVoltage();"); gr->GetListOfFunctions()->Add(ex); gr->Draw("AP"); char flip[256], text[256]; sprintf(flip,"LED flash rate: 240 Hz , with LL: 7.0 nA, PMT# 3"); TPaveLabel *pt_ff = new TPaveLabel(0.17,0.85,0.50,0.89,flip,"NDC"); pt_ff->SetBorderSize(0); pt_ff->SetTextColor(kBlack); pt_ff->SetTextSize(0.80); pt_ff->SetFillColor(0); pt_ff->Draw(); sprintf(text,"HV and I_anode are shown for each data point"); TPaveLabel *pt_ff = new TPaveLabel(0.30,0.15,0.60,0.19,text,"NDC"); pt_ff->SetBorderSize(0); pt_ff->SetTextColor(kBlack); pt_ff->SetTextSize(0.80); pt_ff->SetFillColor(0); pt_ff->Draw(); char plotname[256]; sprintf(plotname,"./Chi_Sq_vs_PreAmp.png"); c10->Print(plotname); TCanvas *c11 = new TCanvas("c11","RelativeWidth vs HV",1000,700); c11->SetGrid(); TGraphErrors *gr = new TGraphErrors(n,my_hv,RelativeWidth); gr->SetTitle("RelativeWidth vs HV;HV;RelativeWidth"); gr->SetMarkerStyle(20); TExec *ex = new TExec("ex","drawtext();"); gr->GetListOfFunctions()->Add(ex); gr->Draw("AP"); char flip[256], text[256]; sprintf(flip,"LED flash rate: 240 Hz , with LL: 7.0 nA, PMT# 3"); TPaveLabel *pt_ff = new TPaveLabel(0.17,0.85,0.50,0.89,flip,"NDC"); pt_ff->SetBorderSize(0); pt_ff->SetTextColor(kBlack); pt_ff->SetTextSize(0.80); pt_ff->SetFillColor(0); pt_ff->Draw(); sprintf(text,"PreAmp and I_anode are shown for each data point"); TPaveLabel *pt_ff = new TPaveLabel(0.30,0.15,0.60,0.19,text,"NDC"); pt_ff->SetBorderSize(0); pt_ff->SetTextColor(kBlack); pt_ff->SetTextSize(0.80); pt_ff->SetFillColor(0); pt_ff->Draw(); char plotname[256]; sprintf(plotname,"./RelativeWidth_vs_HV.png"); c11->Print(plotname); TCanvas *c12 = new TCanvas("c12","RelativeWidth vs PreAmp",1000,700); c12->SetGrid(); TGraphErrors *gr = new TGraphErrors(n,my_PreAmp,RelativeWidth); gr->SetTitle("RelativeWidth vs PreAmp;PreAmp;RelativeWidth"); gr->SetMarkerStyle(20); TExec *ex = new TExec("ex","HVoltage();"); gr->GetListOfFunctions()->Add(ex); gr->Draw("AP"); char flip[256], text[256]; sprintf(flip,"LED flash rate: 240 Hz , with LL: 7.0 nA, PMT# 3"); TPaveLabel *pt_ff = new TPaveLabel(0.17,0.85,0.50,0.89,flip,"NDC"); pt_ff->SetBorderSize(0); pt_ff->SetTextColor(kBlack); pt_ff->SetTextSize(0.80); pt_ff->SetFillColor(0); pt_ff->Draw(); sprintf(text,"HV and I_anode are shown for each data point"); TPaveLabel *pt_ff = new TPaveLabel(0.30,0.15,0.60,0.19,text,"NDC"); pt_ff->SetBorderSize(0); pt_ff->SetTextColor(kBlack); pt_ff->SetTextSize(0.80); pt_ff->SetFillColor(0); pt_ff->Draw(); char plotname[256]; sprintf(plotname,"./RelativeWidth_vs_PreAmp.png"); c12->Print(plotname); } void drawtext() { Int_t i,n; Double_t x,y; TLatex *l; TGraphErrors *g = (TGraphErrors*)gPad->GetListOfPrimitives()->FindObject("Graph"); n = g->GetN(); for (i=0; iGetPoint(i,x,y); TMarker *m; m = new TMarker(x,y,29); if(i==0){ m->SetMarkerColor(1); l = new TLatex(x,y+0.00,Form("0.1M#Omega(SNS), 50.66#muA")); l->SetTextColor(1); }else if(i==1){ m->SetMarkerColor(2); l = new TLatex(x,y+0.00,Form("0.21M#Omega(SNS), 34.92#muA")); l->SetTextColor(2); }else if(i==2){ m->SetMarkerColor(3); l = new TLatex(x,y+0.00,Form("0.21M#Omega(SNS), 27.75#muA")); l->SetTextColor(3); }else if(i==3){ m->SetMarkerColor(4); l = new TLatex(x,y+0.00,Form("0.3M#Omega(SNS), 21.67#muA")); l->SetTextColor(4); }else if (i==4){ m->SetMarkerColor(6); l = new TLatex(x,y+0.00,Form("0.5M#Omega(SNS), 13.92#muA")); l->SetTextColor(6); }else if (i==5){ m->SetMarkerColor(7); l = new TLatex(x,y+0.01,Form("0.5M#Omega(SNS), 10.46#muA")); l->SetTextColor(7); }else if (i==6){ m->SetMarkerColor(8); l = new TLatex(x,y+0.00,Form("1.0M#Omega(SNS), 7.02#muA")); l->SetTextColor(8); }else{ m->SetMarkerColor(9); l = new TLatex(x,y+0.01,Form("1.0M#Omega(SNS), 5.10#muA")); l->SetTextColor(9); } m->Paint(); l->SetTextSize(0.02); l->SetTextFont(62); l->SetTextAlign(21); l->Paint(); } } void HVoltage() { Int_t i,n; Double_t x,y; TLatex *l; TGraphErrors *g = (TGraphErrors*)gPad->GetListOfPrimitives()->FindObject("Graph"); n = g->GetN(); for (i=0; iGetPoint(i,x,y); TMarker *m; m = new TMarker(x,y,29); if(i==0){ m->SetMarkerColor(1); l = new TLatex(x,y+0.00,Form("750V, 50.66#muA")); l->SetTextColor(1); }else if(i==1){ m->SetMarkerColor(2); l = new TLatex(x,y+0.00,Form("700V, 34.92#muA")); l->SetTextColor(2); }else if(i==2){ m->SetMarkerColor(3); l = new TLatex(x,y+0.00,Form("670V, 27.75#muA")); l->SetTextColor(3); }else if(i==3){ m->SetMarkerColor(4); l = new TLatex(x,y+0.00,Form("640V, 21.67#muA")); l->SetTextColor(4); }else if (i==4){ m->SetMarkerColor(6); l = new TLatex(x,y+0.00,Form("590V, 13.92#muA")); l->SetTextColor(6); }else if (i==5){ m->SetMarkerColor(7); l = new TLatex(x,y+0.01,Form("560V, 10.46#muA")); l->SetTextColor(7); }else if (i==6){ m->SetMarkerColor(8); l = new TLatex(x,y+0.00,Form("520V, 7.02#muA")); l->SetTextColor(8); }else{ m->SetMarkerColor(9); l = new TLatex(x,y+0.01,Form("490V, 5.10#muA")); l->SetTextColor(9); } m->Paint(); l->SetTextSize(0.02); l->SetTextFont(62); l->SetTextAlign(21); l->Paint(); } }