Rev 167 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 167 | Rev 172 | ||
|---|---|---|---|
| Line 586... | Line 586... | ||
| 586 | int startTab = mainTab->GetCurrent(); |
586 | int startTab = mainTab->GetCurrent(); |
| 587 | int newTab = mainTab->GetNumberOfTabs(); |
587 | int newTab = mainTab->GetNumberOfTabs(); |
| 588 | if(DBGSIG > 1) printf("TempAnalysisTab(): Current tab = %d, Nr. of tabs = %d\n", startTab, newTab ); |
588 | if(DBGSIG > 1) printf("TempAnalysisTab(): Current tab = %d, Nr. of tabs = %d\n", startTab, newTab ); |
| 589 | 589 | ||
| 590 | double numform[6]; |
590 | double numform[6]; |
| - | 591 | double numform2[6]; |
|
| 591 | 592 | ||
| 592 | int subgroup[2]; |
593 | int subgroup[2]; |
| 593 | subgroup[0] = mainTab->GetWidth()-10; |
594 | subgroup[0] = mainTab->GetWidth()-10; |
| 594 | subgroup[1] = mainTab->GetHeight()-10; |
595 | subgroup[1] = mainTab->GetHeight()-10; |
| 595 | 596 | ||
| Line 613... | Line 614... | ||
| 613 | tempAnalysisCanvas = new TRootEmbeddedCanvas("tempAnalysisCanvas",fV1,3*subgroup[0]/4,3*subgroup[1]/4); |
614 | tempAnalysisCanvas = new TRootEmbeddedCanvas("tempAnalysisCanvas",fV1,3*subgroup[0]/4,3*subgroup[1]/4); |
| 614 | fV1->AddFrame(tempAnalysisCanvas, f1expandXpad); |
615 | fV1->AddFrame(tempAnalysisCanvas, f1expandXpad); |
| 615 | } |
616 | } |
| 616 | tempAnalysisCanvas->GetCanvas()->SetGrid(); |
617 | tempAnalysisCanvas->GetCanvas()->SetGrid(); |
| 617 | 618 | ||
| 618 | // Specific options for plotting (analtype: 0 = Normal integration, 1 = Edge scans, 2 = Relative PDE,...) |
619 | // Specific options for plotting (analtype: 0 = Normal integration, 1 = Edge scans, 2 = Relative PDE, 3 = Breakdown voltage, 4 = Surface scan, 5 = Timing,...) |
| 619 | // Normal integration |
620 | // Normal integration |
| 620 | if(analtype == 0) |
621 | if(analtype == 0) |
| 621 | { |
622 | { |
| 622 | } |
623 | } |
| 623 | // Edge scans |
624 | // Edge scans |
| Line 651... | Line 652... | ||
| 651 | if(secondAxis->TGLabelNEntry(fV1, subgroup[0]/2-24, 30, "Scale second axis:", 0, numform, "center")) |
652 | if(secondAxis->TGLabelNEntry(fV1, subgroup[0]/2-24, 30, "Scale second axis:", 0, numform, "center")) |
| 652 | fV1->AddFrame(secondAxis->outsidebox, f1expandXpad); |
653 | fV1->AddFrame(secondAxis->outsidebox, f1expandXpad); |
| 653 | 654 | ||
| 654 | runningAver->widgetNE[0]->Connect("ValueSet(Long_t)", "TGAppMainFrame", this, "ApplyRunningAver()"); |
655 | runningAver->widgetNE[0]->Connect("ValueSet(Long_t)", "TGAppMainFrame", this, "ApplyRunningAver()"); |
| 655 | runningOff->widgetNE[0]->Connect("ValueSet(Long_t)", "TGAppMainFrame", this, "ApplyRunningAver()"); |
656 | runningOff->widgetNE[0]->Connect("ValueSet(Long_t)", "TGAppMainFrame", this, "ApplyRunningAver()"); |
| - | 657 | ||
| - | 658 | ToolTipSetRelativePDE(); |
|
| - | 659 | } |
|
| - | 660 | // Breakdown voltage |
|
| - | 661 | else if(analtype == 3) |
|
| - | 662 | { |
|
| - | 663 | } |
|
| - | 664 | // Surface scan |
|
| - | 665 | else if(analtype == 4) |
|
| - | 666 | { |
|
| - | 667 | fH1 = new TGCompositeFrame(fV1, subgroup[0], subgroup[1], kHorizontalFrame); |
|
| - | 668 | ||
| - | 669 | // Values to create a crop of the graph |
|
| - | 670 | if(DBGSIG > 1) printf("TempAnalysisTab(): Creating TSubStructure *xCrop -> Set how many X parts of the surface scan to crop.\n"); |
|
| - | 671 | xCrop = new TSubStructure(); |
|
| - | 672 | for(int i = 0; i < 6; i++) { numform[i] = 0; numform2[i] = 0; } |
|
| - | 673 | if(posUnitsPlot->widgetCB->GetSelected() == 0) { numform[0] = 8; numform[2] = 2; numform2[0] = 8; numform2[2] = 2; } |
|
| - | 674 | else if(posUnitsPlot->widgetCB->GetSelected() == 1) { numform[0] = 8; numform[1] = 2; numform[2] = 2; numform2[0] = 8; numform2[1] = 2; numform2[2] = 2; } |
|
| - | 675 | if(xCrop->TGLabelDoubleNEntry(fH1, subgroup[0]/4-50, 30, "X axis crop values:", 0, numform, 0, numform2, "center")) |
|
| - | 676 | fH1->AddFrame(xCrop->outsidebox, f1expandXpad); |
|
| - | 677 | ||
| - | 678 | if(DBGSIG > 1) printf("TempAnalysisTab(): Creating TSubStructure *yCrop -> Set how many Y parts of the surface scan to crop.\n"); |
|
| - | 679 | yCrop = new TSubStructure(); |
|
| - | 680 | for(int i = 0; i < 6; i++) { numform[i] = 0; numform2[i] = 0; } |
|
| - | 681 | if(posUnitsPlot->widgetCB->GetSelected() == 0) { numform[0] = 8; numform[2] = 2; numform2[0] = 8; numform2[2] = 2; } |
|
| - | 682 | else if(posUnitsPlot->widgetCB->GetSelected() == 1) { numform[0] = 8; numform[1] = 2; numform[2] = 2; numform2[0] = 8; numform2[1] = 2; numform2[2] = 2; } |
|
| - | 683 | if(yCrop->TGLabelDoubleNEntry(fH1, subgroup[0]/4-50, 30, "Y axis crop values:", 0, numform, 0, numform2, "center")) |
|
| - | 684 | fH1->AddFrame(yCrop->outsidebox, f1expandXpad); |
|
| - | 685 | ||
| - | 686 | if(DBGSIG > 1) printf("TempAnalysisTab(): Creating TSubStructure *interpolSize -> Set the interpolation step size of the 2D graph.\n"); |
|
| - | 687 | interpolSize = new TSubStructure(); |
|
| - | 688 | for(int i = 0; i < 6; i++) { numform[i] = 0; numform2[i] = 0; } |
|
| - | 689 | if(posUnitsPlot->widgetCB->GetSelected() == 0) { numform[0] = 8; numform[2] = 2; numform2[0] = 8; numform2[2] = 2; } |
|
| - | 690 | else if(posUnitsPlot->widgetCB->GetSelected() == 1) { numform[0] = 8; numform[1] = 2; numform[2] = 2; numform2[0] = 8; numform2[1] = 2; numform2[2] = 2; } |
|
| - | 691 | if(interpolSize->TGLabelDoubleNEntry(fH1, subgroup[0]/4+20, 30, "Interpol. step size:", 500, numform, 500, numform2, "center")) |
|
| - | 692 | fH1->AddFrame(interpolSize->outsidebox, f1expandXpad); |
|
| - | 693 | ||
| - | 694 | if(DBGSIG > 1) printf("TempAnalysisTab(): Creating TSubStructure *updateCrop -> 2 buttons for either updating the crop or making an integral\n"); |
|
| - | 695 | updateCrop = new TSubStructure(); |
|
| - | 696 | const char *selnames[512] = {"Update","Integrate surface scan"}; |
|
| - | 697 | if(updateCrop->TGMultiButton(fH1, subgroup[0]/4-50, 30, 2, selnames, "center")) |
|
| - | 698 | fH1->AddFrame(updateCrop->outsidebox, f1expandXpad); |
|
| - | 699 | ||
| - | 700 | fV1->AddFrame(fH1, f1expandXpad); |
|
| - | 701 | ||
| - | 702 | updateCrop->widgetTB[0]->Connect("Clicked()", "TGAppMainFrame", this, "UpdateIntegrateSurface(=0)"); |
|
| - | 703 | updateCrop->widgetTB[1]->Connect("Clicked()", "TGAppMainFrame", this, "UpdateIntegrateSurface(=1)"); |
|
| - | 704 | ||
| - | 705 | ToolTipSetSurfaceScan(); |
|
| 656 | } |
706 | } |
| 657 | 707 | ||
| 658 | // Export and close buttons |
708 | // Export and close buttons |
| 659 | if(DBGSIG > 1) printf("TempAnalysisTab(): Creating TSubStructure *exportExitAnalysis -> 2 buttons for either exporting the plot or closing the tab\n"); |
709 | if(DBGSIG > 1) printf("TempAnalysisTab(): Creating TSubStructure *exportExitAnalysis -> 2 buttons for either exporting the plot or closing the tab\n"); |
| 660 | exportExitAnalysis = new TSubStructure(); |
710 | exportExitAnalysis = new TSubStructure(); |
| 661 | const char *selnames[512] = {"Export","Close"}; |
711 | const char *selnames[512] = {"Export","Close"}; |
| Line 666... | Line 716... | ||
| 666 | char cTemp[512]; |
716 | char cTemp[512]; |
| 667 | exportExitAnalysis->widgetTB[0]->Connect("Clicked()", "TGAppMainFrame", this, "ExportTempAnalysisPlot()"); |
717 | exportExitAnalysis->widgetTB[0]->Connect("Clicked()", "TGAppMainFrame", this, "ExportTempAnalysisPlot()"); |
| 668 | sprintf(cTemp, "CloseTempAnalysisTab(=%d)", newTab*100+startTab); |
718 | sprintf(cTemp, "CloseTempAnalysisTab(=%d)", newTab*100+startTab); |
| 669 | exportExitAnalysis->widgetTB[1]->Connect("Clicked()", "TGAppMainFrame", this, cTemp); |
719 | exportExitAnalysis->widgetTB[1]->Connect("Clicked()", "TGAppMainFrame", this, cTemp); |
| 670 | 720 | ||
| 671 | fT1->AddFrame(fV1, f1expand2d); |
721 | fT1->AddFrame(fV1, f1expand2d); |
| 672 | 722 | ||
| 673 | fMain->MapSubwindows(); |
723 | fMain->MapSubwindows(); |
| 674 | fMain->MapWindow(); |
724 | fMain->MapWindow(); |
| 675 | fMain->Layout(); |
725 | fMain->Layout(); |
| 676 | 726 | ||
| - | 727 | ToolTipSetTempAnalysis(); |
|
| - | 728 | ||
| 677 | // Set tab ID |
729 | // Set tab ID |
| 678 | *tabid = newTab; |
730 | *tabid = newTab; |
| 679 | 731 | ||
| 680 | if(DBGSIG > 1) |
732 | if(DBGSIG > 1) |
| 681 | { |
733 | { |
| 682 | printf("TempAnalysisTab(): New tab objects (Temporary Analysis Header)\n"); |
734 | printf("TempAnalysisTab(): New tab objects (Temporary Analysis Header)\n"); |
| 683 | gObjectTable->Print(); |
735 | gObjectTable->Print(); |
| 684 | } |
736 | } |
| 685 | } |
737 | } |
| 686 | else |
738 | else |
| 687 | { |
739 | { |
| 688 | // Switch to new tab |
740 | // Switch to new tab |
| 689 | fTab->SetTab(*tabid); |
741 | fTab->SetTab(*tabid); |
| 690 | } |
742 | } |
| Line 707... | Line 759... | ||
| 707 | 759 | ||
| 708 | fTab->SetTab(oldtab); |
760 | fTab->SetTab(oldtab); |
| 709 | } |
761 | } |
| 710 | 762 | ||
| 711 | void TGAppMainFrame::ApplyRunningAver() |
763 | void TGAppMainFrame::ApplyRunningAver() |
| 712 | { |
764 | { |
| 713 | TCanvas *gCanvas = tempAnalysisCanvas->GetCanvas(); |
765 | TCanvas *gCanvas = tempAnalysisCanvas->GetCanvas(); |
| 714 | TList *funcList = (TList*)gCanvas->GetListOfPrimitives(); |
766 | TList *funcList = (TList*)gCanvas->GetListOfPrimitives(); |
| 715 | unsigned int nrfunc = funcList->GetSize(); |
767 | unsigned int nrfunc = funcList->GetSize(); |
| 716 | TGraph *baseGr; |
768 | TGraph *baseGr; |
| 717 | char funcname[512]; |
769 | char funcname[512]; |
| 718 | int runav = runningAver->widgetNE[0]->GetNumber(); |
770 | int runav = runningAver->widgetNE[0]->GetNumber(); |
| 719 | int offx = runningOff->widgetNE[0]->GetNumber(); |
771 | int offx = runningOff->widgetNE[0]->GetNumber(); |
| Line 769... | Line 821... | ||
| 769 | runaver->Draw("l same"); |
821 | runaver->Draw("l same"); |
| 770 | gCanvas->Modified(); |
822 | gCanvas->Modified(); |
| 771 | gCanvas->Update(); |
823 | gCanvas->Update(); |
| 772 | delete[] xval; |
824 | delete[] xval; |
| 773 | delete[] yval; |
825 | delete[] yval; |
| - | 826 | } |
|
| - | 827 | } |
|
| - | 828 | } |
|
| - | 829 | ||
| - | 830 | void TGAppMainFrame::UpdateIntegrateSurface(int val) |
|
| - | 831 | { |
|
| - | 832 | TCanvas *gCanvas = tempAnalysisCanvas->GetCanvas(); |
|
| - | 833 | TList *funcList = (TList*)gCanvas->GetListOfPrimitives(); |
|
| - | 834 | unsigned int nrfunc = funcList->GetSize(); |
|
| - | 835 | TGraph2D *baseGr; |
|
| - | 836 | char funcname[512]; |
|
| - | 837 | ||
| - | 838 | double integralValue; |
|
| - | 839 | int pointCount; |
|
| - | 840 | double xStepsize, yStepsize; |
|
| - | 841 | int xInterpol, yInterpol; |
|
| - | 842 | ||
| - | 843 | for(int i = 0; i < nrfunc; i++) |
|
| - | 844 | { |
|
| - | 845 | sprintf(funcname, "%s", funcList->At(i)->GetName()); |
|
| - | 846 | if(DBGSIG) printf("UpdateIntegrateSurface(): Function is: %s\n", funcname); |
|
| - | 847 | ||
| - | 848 | if(strcmp(funcname,"surfscan") == 0) |
|
| - | 849 | { |
|
| - | 850 | baseGr = (TGraph2D*)gCanvas->GetPrimitive(funcname); |
|
| - | 851 | ||
| - | 852 | // Just set the initial things for the surface scan |
|
| - | 853 | if(val == -1) |
|
| - | 854 | { |
|
| - | 855 | xCrop->widgetNE[0]->SetNumber(baseGr->GetXaxis()->GetXmin()); |
|
| - | 856 | xCrop->widgetNE[1]->SetNumber(baseGr->GetXaxis()->GetXmax()); |
|
| - | 857 | yCrop->widgetNE[0]->SetNumber(baseGr->GetYaxis()->GetXmin()); |
|
| - | 858 | yCrop->widgetNE[1]->SetNumber(baseGr->GetYaxis()->GetXmax()); |
|
| - | 859 | ||
| - | 860 | xCrop->widgetNE[0]->SetLimits(TGNumberFormat::kNELLimitMinMax, baseGr->GetXaxis()->GetXmin(), baseGr->GetXaxis()->GetXmax()); |
|
| - | 861 | xCrop->widgetNE[1]->SetLimits(TGNumberFormat::kNELLimitMinMax, baseGr->GetXaxis()->GetXmin(), baseGr->GetXaxis()->GetXmax()); |
|
| - | 862 | yCrop->widgetNE[0]->SetLimits(TGNumberFormat::kNELLimitMinMax, baseGr->GetYaxis()->GetXmin(), baseGr->GetYaxis()->GetXmax()); |
|
| - | 863 | yCrop->widgetNE[1]->SetLimits(TGNumberFormat::kNELLimitMinMax, baseGr->GetYaxis()->GetXmin(), baseGr->GetYaxis()->GetXmax()); |
|
| - | 864 | } |
|
| - | 865 | // Update the cropping |
|
| - | 866 | else if(val == 0) |
|
| - | 867 | { |
|
| - | 868 | baseGr->GetXaxis()->SetRange(xCrop->widgetNE[0]->GetNumber(), xCrop->widgetNE[1]->GetNumber()); |
|
| - | 869 | baseGr->GetXaxis()->SetRangeUser(xCrop->widgetNE[0]->GetNumber(), xCrop->widgetNE[1]->GetNumber()); |
|
| - | 870 | baseGr->GetYaxis()->SetRange(yCrop->widgetNE[0]->GetNumber(), yCrop->widgetNE[1]->GetNumber()); |
|
| - | 871 | baseGr->GetYaxis()->SetRangeUser(yCrop->widgetNE[0]->GetNumber(), yCrop->widgetNE[1]->GetNumber()); |
|
| - | 872 | ||
| - | 873 | gCanvas->Modified(); |
|
| - | 874 | gCanvas->Update(); |
|
| - | 875 | } |
|
| - | 876 | // Make an integral over all histogram values in range |
|
| - | 877 | else if(val == 1) |
|
| - | 878 | { |
|
| - | 879 | integralValue = 0; |
|
| - | 880 | pointCount = 0; |
|
| - | 881 | ||
| - | 882 | xStepsize = interpolSize->widgetNE[0]->GetNumber(); |
|
| - | 883 | yStepsize = interpolSize->widgetNE[1]->GetNumber(); |
|
| - | 884 | xInterpol = (int)((xCrop->widgetNE[1]->GetNumber() - xCrop->widgetNE[0]->GetNumber())/xStepsize); |
|
| - | 885 | yInterpol = (int)((yCrop->widgetNE[1]->GetNumber() - yCrop->widgetNE[0]->GetNumber())/yStepsize); |
|
| - | 886 | ||
| - | 887 | for(int j = 0; j < xInterpol; j++) |
|
| - | 888 | { |
|
| - | 889 | for(int k = 0; k < yInterpol; k++) |
|
| - | 890 | { |
|
| - | 891 | if((xCrop->widgetNE[0]->GetNumber()+j*xStepsize+xStepsize/2. <= xCrop->widgetNE[1]->GetNumber()) && (yCrop->widgetNE[0]->GetNumber()+k*yStepsize+yStepsize/2. <= yCrop->widgetNE[1]->GetNumber())) |
|
| - | 892 | { |
|
| - | 893 | if(DBGSIG) cout << "Interpolation at (" << xCrop->widgetNE[0]->GetNumber()+j*xStepsize+xStepsize/2. << "," << yCrop->widgetNE[0]->GetNumber()+k*yStepsize+yStepsize/2. << ") is " << baseGr->Interpolate(xCrop->widgetNE[0]->GetNumber()+j*xStepsize+xStepsize/2., yCrop->widgetNE[0]->GetNumber()+k*yStepsize+yStepsize/2.) << endl; |
|
| - | 894 | integralValue += baseGr->Interpolate(xCrop->widgetNE[0]->GetNumber()+j*xStepsize+xStepsize/2., yCrop->widgetNE[0]->GetNumber()+k*yStepsize+yStepsize/2.); |
|
| - | 895 | pointCount++; |
|
| - | 896 | } |
|
| - | 897 | } |
|
| - | 898 | } |
|
| - | 899 | ||
| - | 900 | cout << "Total integral value (" << pointCount << " points) = " << integralValue << endl << "Total normated integral value = " << (double)integralValue/pointCount << endl; |
|
| - | 901 | ||
| - | 902 | } |
|
| 774 | } |
903 | } |
| 775 | } |
904 | } |
| 776 | } |
905 | } |
| 777 | 906 | ||
| 778 | void TGAppMainFrame::ExportTempAnalysisPlot() |
907 | void TGAppMainFrame::ExportTempAnalysisPlot() |
| Line 784... | Line 913... | ||
| 784 | char *cTemp; |
913 | char *cTemp; |
| 785 | file_info.fFileTypes = filetypes; |
914 | file_info.fFileTypes = filetypes; |
| 786 | cTemp = new char[1024]; |
915 | cTemp = new char[1024]; |
| 787 | // sprintf(cTemp, "%s/results", rootdir); |
916 | // sprintf(cTemp, "%s/results", rootdir); |
| 788 | // file_info.fIniDir = StrDup(cTemp); |
917 | // file_info.fIniDir = StrDup(cTemp); |
| 789 | file_info.fIniDir = StrDup( |
918 | file_info.fIniDir = StrDup(currentAnalDir); |
| 790 | new TGFileDialog(gClient->GetDefaultRoot(), fMain, kFDSave, &file_info); |
919 | new TGFileDialog(gClient->GetDefaultRoot(), fMain, kFDSave, &file_info); |
| 791 | delete[] cTemp; |
920 | delete[] cTemp; |
| 792 | 921 | ||
| 793 | if(file_info.fFilename != NULL) |
922 | if(file_info.fFilename != NULL) |
| 794 | gCanvas->SaveAs(file_info.fFilename); |
923 | gCanvas->SaveAs(file_info.fFilename); |