#include #include "TH1D.h" #include #include #include #include #include "TLegend.h" #include "TClassTable.h" #include "TBrowser.h" #include "TROOT.h" #include #include #include #include #include #include TCanvas* c1; TCanvas* c2; TCanvas* c3; TCanvas* c4,*c5; TCanvas* c6[8]; TCanvas* c7; TH1D *DifferenceHist[8]; TGraph *tempKeithleyGraph[8],*TerminalGraph[8],*CompareGraph[8]; TMultiGraph *multiGraph[8]; void RootViewer () { TFile *fin = new TFile("VoltageVariation12Hr.root","READ"); c1 = new TCanvas("c1","Correspondence of Voltage"); c2 = new TCanvas("c2","Differences in Voltage"); c3 = new TCanvas("c3","Voltages Measured by Keithley"); c4 = new TCanvas("c4","Voltage Measured at Terminal"); c5 = new TCanvas("c5","Overlay"); c7 = new TCanvas("c7","Plot"); for (int i=0;i<8;i++){ ostringstream tempPlotTitleStream; tempPlotTitleStream << "Channel_" << i; string tempPlotTitle=tempPlotTitleStream.str(); ostringstream tempPlotNameStream; tempPlotNameStream << "c[" << i << "]"; string tempPlotName=tempPlotNameStream.str(); c6[i] = new TCanvas(tempPlotName.c_str(),tempPlotTitle.c_str()); } c1->Divide(3,3); c2->Divide(3,3); c3->Divide(3,3); c4->Divide(3,3); c5->Divide(3,3); for (int i=0;i<8;i++){ cout << i << endl; ostringstream tempChannelStream; ostringstream tempTerminalStream,tempKeithleyStream,temp2DStream,tempDifferenceStream; tempChannelStream << "Channel_" << i; tempTerminalStream << "V_T" << i << ":EventNumber"; tempKeithleyStream << "V_K" << i << ":EventNumber"; temp2DStream << "V_K" << i << ":" << "V_T" << i; //tempDifferenceStream << "V_K" << i << "-" << "V_T" << i; tempDifferenceStream << "V_T" << i; string tempChannelName=tempChannelStream.str(); string tempTerminalName=tempTerminalStream.str(); string tempKeithleyName=tempKeithleyStream.str(); string temp2DName=temp2DStream.str(); string tempDifferenceName=tempDifferenceStream.str(); c1->cd(i+1); ((TTree *) fin->Get(tempChannelName.c_str()))->Draw(temp2DName.c_str(),""); cout << "HERE" << endl; //CompareGraph[i] = (TGraph*)gPad->GetPrimitive("Graph"); //c7->cd(); //c6[i]->cd(); //CompareGraph[i]->GetXaxis()->SetTitle("Keithley Measurment (V)"); //CompareGraph[i]->Draw(); //c6[i]->Clear(); //c7->Clear(); cout << "HERE" << endl; c2->cd(i+1); ((TTree *) fin->Get(tempChannelName.c_str()))->Draw(tempDifferenceName.c_str(),""); //DifferenceHist[i] = (TH1D*)gPad->GetPrimitive("htemp"); //c6[i]->cd(); //DifferenceHist[i]->Draw(); //c6[i]->Clear(); c3->cd(i+1); ((TTree *) fin->Get(tempChannelName.c_str()))->Draw(tempKeithleyName.c_str(),""); tempKeithleyGraph[i] = (TGraph*)gPad->GetPrimitive("Graph"); //c7->cd(); //c6[i]->cd(); //tempKeithleyGraph[i]->Draw(); //c7->Clear(); //c6[i]->Clear(); c4->cd(i+1)->DrawFrame(0,-0.063,1200,0.08); ((TTree *) fin->Get(tempChannelName.c_str()))->Draw(tempTerminalName.c_str(),""); TerminalGraph[i] = (TGraph*)gPad->GetPrimitive("Graph"); //TerminalGraph[i]->SetMarkerColor(kBlue); TerminalGraph[i]->GetYaxis()->SetTitleOffset(1.3); TerminalGraph[i]->GetYaxis()->CenterTitle(true); TerminalGraph[i]->GetXaxis()->CenterTitle(true); TerminalGraph[i]->GetYaxis()->SetTitle("Terminal Voltage - (58 + Channel#) (V)"); //TerminalGraph[i]->GetYaxis()->SetLimits(-0.063,0.08); //Int_t ymin = TerminalGraph[i]->GetYaxis()->GetFirst(); //Int_t ymax = TerminalGraph[i]->GetYaxis()->GetLast(); //Int_t ydelta = ymax-ymin; //TerminalGraph[i]->GetYaxis()->SetRangeUser(-0.063,0.08); //TerminalGraph[i]->GetYaxis()->SetRange(ymin-ydelta,ymin+ydelta); //((TTree *) fin->Get(tempChannelName.c_str()))->GetHistogram(); //tempKeithleyGraph[i]->Draw("CP"); //c7->cd(); //c6[i]->cd(); //TerminalGraph[i]->Draw(); //c7->Clear(); //c6[i]->Clear(); //tempKeithleyGraph[i]->SetLineColor(kBlack); //c4->Modified(); //c4->Update(); c5->cd(i+1); multiGraph[i] = new TMultiGraph(); multiGraph[i]->Add(TerminalGraph[i],"p"); multiGraph[i]->Add(tempKeithleyGraph[i],"p"); multiGraph[i]->Draw("a"); //c6[i]->cd(); //multiGraph[i]->Draw("a"); } }