588,6 → 588,7 |
if(DBGSIG > 1) printf("TempAnalysisTab(): Current tab = %d, Nr. of tabs = %d\n", startTab, newTab ); |
|
double numform[6]; |
double numform2[6]; |
|
int subgroup[2]; |
subgroup[0] = mainTab->GetWidth()-10; |
615,7 → 616,7 |
} |
tempAnalysisCanvas->GetCanvas()->SetGrid(); |
|
// Specific options for plotting (analtype: 0 = Normal integration, 1 = Edge scans, 2 = Relative PDE,...) |
// Specific options for plotting (analtype: 0 = Normal integration, 1 = Edge scans, 2 = Relative PDE, 3 = Breakdown voltage, 4 = Surface scan, 5 = Timing,...) |
// Normal integration |
if(analtype == 0) |
{ |
653,8 → 654,57 |
|
runningAver->widgetNE[0]->Connect("ValueSet(Long_t)", "TGAppMainFrame", this, "ApplyRunningAver()"); |
runningOff->widgetNE[0]->Connect("ValueSet(Long_t)", "TGAppMainFrame", this, "ApplyRunningAver()"); |
|
ToolTipSetRelativePDE(); |
} |
// Breakdown voltage |
else if(analtype == 3) |
{ |
} |
// Surface scan |
else if(analtype == 4) |
{ |
fH1 = new TGCompositeFrame(fV1, subgroup[0], subgroup[1], kHorizontalFrame); |
|
// Values to create a crop of the graph |
if(DBGSIG > 1) printf("TempAnalysisTab(): Creating TSubStructure *xCrop -> Set how many X parts of the surface scan to crop.\n"); |
xCrop = new TSubStructure(); |
for(int i = 0; i < 6; i++) { numform[i] = 0; numform2[i] = 0; } |
if(posUnitsPlot->widgetCB->GetSelected() == 0) { numform[0] = 8; numform[2] = 2; numform2[0] = 8; numform2[2] = 2; } |
else if(posUnitsPlot->widgetCB->GetSelected() == 1) { numform[0] = 8; numform[1] = 2; numform[2] = 2; numform2[0] = 8; numform2[1] = 2; numform2[2] = 2; } |
if(xCrop->TGLabelDoubleNEntry(fH1, subgroup[0]/4-50, 30, "X axis crop values:", 0, numform, 0, numform2, "center")) |
fH1->AddFrame(xCrop->outsidebox, f1expandXpad); |
|
if(DBGSIG > 1) printf("TempAnalysisTab(): Creating TSubStructure *yCrop -> Set how many Y parts of the surface scan to crop.\n"); |
yCrop = new TSubStructure(); |
for(int i = 0; i < 6; i++) { numform[i] = 0; numform2[i] = 0; } |
if(posUnitsPlot->widgetCB->GetSelected() == 0) { numform[0] = 8; numform[2] = 2; numform2[0] = 8; numform2[2] = 2; } |
else if(posUnitsPlot->widgetCB->GetSelected() == 1) { numform[0] = 8; numform[1] = 2; numform[2] = 2; numform2[0] = 8; numform2[1] = 2; numform2[2] = 2; } |
if(yCrop->TGLabelDoubleNEntry(fH1, subgroup[0]/4-50, 30, "Y axis crop values:", 0, numform, 0, numform2, "center")) |
fH1->AddFrame(yCrop->outsidebox, f1expandXpad); |
|
if(DBGSIG > 1) printf("TempAnalysisTab(): Creating TSubStructure *interpolSize -> Set the interpolation step size of the 2D graph.\n"); |
interpolSize = new TSubStructure(); |
for(int i = 0; i < 6; i++) { numform[i] = 0; numform2[i] = 0; } |
if(posUnitsPlot->widgetCB->GetSelected() == 0) { numform[0] = 8; numform[2] = 2; numform2[0] = 8; numform2[2] = 2; } |
else if(posUnitsPlot->widgetCB->GetSelected() == 1) { numform[0] = 8; numform[1] = 2; numform[2] = 2; numform2[0] = 8; numform2[1] = 2; numform2[2] = 2; } |
if(interpolSize->TGLabelDoubleNEntry(fH1, subgroup[0]/4+20, 30, "Interpol. step size:", 500, numform, 500, numform2, "center")) |
fH1->AddFrame(interpolSize->outsidebox, f1expandXpad); |
|
if(DBGSIG > 1) printf("TempAnalysisTab(): Creating TSubStructure *updateCrop -> 2 buttons for either updating the crop or making an integral\n"); |
updateCrop = new TSubStructure(); |
const char *selnames[512] = {"Update","Integrate surface scan"}; |
if(updateCrop->TGMultiButton(fH1, subgroup[0]/4-50, 30, 2, selnames, "center")) |
fH1->AddFrame(updateCrop->outsidebox, f1expandXpad); |
|
fV1->AddFrame(fH1, f1expandXpad); |
|
updateCrop->widgetTB[0]->Connect("Clicked()", "TGAppMainFrame", this, "UpdateIntegrateSurface(=0)"); |
updateCrop->widgetTB[1]->Connect("Clicked()", "TGAppMainFrame", this, "UpdateIntegrateSurface(=1)"); |
|
ToolTipSetSurfaceScan(); |
} |
|
// Export and close buttons |
if(DBGSIG > 1) printf("TempAnalysisTab(): Creating TSubStructure *exportExitAnalysis -> 2 buttons for either exporting the plot or closing the tab\n"); |
exportExitAnalysis = new TSubStructure(); |
674,6 → 724,8 |
fMain->MapWindow(); |
fMain->Layout(); |
|
ToolTipSetTempAnalysis(); |
|
// Set tab ID |
*tabid = newTab; |
|
775,6 → 827,83 |
} |
} |
|
void TGAppMainFrame::UpdateIntegrateSurface(int val) |
{ |
TCanvas *gCanvas = tempAnalysisCanvas->GetCanvas(); |
TList *funcList = (TList*)gCanvas->GetListOfPrimitives(); |
unsigned int nrfunc = funcList->GetSize(); |
TGraph2D *baseGr; |
char funcname[512]; |
|
double integralValue; |
int pointCount; |
double xStepsize, yStepsize; |
int xInterpol, yInterpol; |
|
for(int i = 0; i < nrfunc; i++) |
{ |
sprintf(funcname, "%s", funcList->At(i)->GetName()); |
if(DBGSIG) printf("UpdateIntegrateSurface(): Function is: %s\n", funcname); |
|
if(strcmp(funcname,"surfscan") == 0) |
{ |
baseGr = (TGraph2D*)gCanvas->GetPrimitive(funcname); |
|
// Just set the initial things for the surface scan |
if(val == -1) |
{ |
xCrop->widgetNE[0]->SetNumber(baseGr->GetXaxis()->GetXmin()); |
xCrop->widgetNE[1]->SetNumber(baseGr->GetXaxis()->GetXmax()); |
yCrop->widgetNE[0]->SetNumber(baseGr->GetYaxis()->GetXmin()); |
yCrop->widgetNE[1]->SetNumber(baseGr->GetYaxis()->GetXmax()); |
|
xCrop->widgetNE[0]->SetLimits(TGNumberFormat::kNELLimitMinMax, baseGr->GetXaxis()->GetXmin(), baseGr->GetXaxis()->GetXmax()); |
xCrop->widgetNE[1]->SetLimits(TGNumberFormat::kNELLimitMinMax, baseGr->GetXaxis()->GetXmin(), baseGr->GetXaxis()->GetXmax()); |
yCrop->widgetNE[0]->SetLimits(TGNumberFormat::kNELLimitMinMax, baseGr->GetYaxis()->GetXmin(), baseGr->GetYaxis()->GetXmax()); |
yCrop->widgetNE[1]->SetLimits(TGNumberFormat::kNELLimitMinMax, baseGr->GetYaxis()->GetXmin(), baseGr->GetYaxis()->GetXmax()); |
} |
// Update the cropping |
else if(val == 0) |
{ |
baseGr->GetXaxis()->SetRange(xCrop->widgetNE[0]->GetNumber(), xCrop->widgetNE[1]->GetNumber()); |
baseGr->GetXaxis()->SetRangeUser(xCrop->widgetNE[0]->GetNumber(), xCrop->widgetNE[1]->GetNumber()); |
baseGr->GetYaxis()->SetRange(yCrop->widgetNE[0]->GetNumber(), yCrop->widgetNE[1]->GetNumber()); |
baseGr->GetYaxis()->SetRangeUser(yCrop->widgetNE[0]->GetNumber(), yCrop->widgetNE[1]->GetNumber()); |
|
gCanvas->Modified(); |
gCanvas->Update(); |
} |
// Make an integral over all histogram values in range |
else if(val == 1) |
{ |
integralValue = 0; |
pointCount = 0; |
|
xStepsize = interpolSize->widgetNE[0]->GetNumber(); |
yStepsize = interpolSize->widgetNE[1]->GetNumber(); |
xInterpol = (int)((xCrop->widgetNE[1]->GetNumber() - xCrop->widgetNE[0]->GetNumber())/xStepsize); |
yInterpol = (int)((yCrop->widgetNE[1]->GetNumber() - yCrop->widgetNE[0]->GetNumber())/yStepsize); |
|
for(int j = 0; j < xInterpol; j++) |
{ |
for(int k = 0; k < yInterpol; k++) |
{ |
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())) |
{ |
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; |
integralValue += baseGr->Interpolate(xCrop->widgetNE[0]->GetNumber()+j*xStepsize+xStepsize/2., yCrop->widgetNE[0]->GetNumber()+k*yStepsize+yStepsize/2.); |
pointCount++; |
} |
} |
} |
|
cout << "Total integral value (" << pointCount << " points) = " << integralValue << endl << "Total normated integral value = " << (double)integralValue/pointCount << endl; |
|
} |
} |
} |
} |
|
void TGAppMainFrame::ExportTempAnalysisPlot() |
{ |
TCanvas *gCanvas = tempAnalysisCanvas->GetCanvas(); |
786,7 → 915,7 |
cTemp = new char[1024]; |
// sprintf(cTemp, "%s/results", rootdir); |
// file_info.fIniDir = StrDup(cTemp); |
file_info.fIniDir = StrDup(currentOpenDir); |
file_info.fIniDir = StrDup(currentAnalDir); |
new TGFileDialog(gClient->GetDefaultRoot(), fMain, kFDSave, &file_info); |
delete[] cTemp; |
|