Subversion Repositories f9daq

Compare Revisions

Ignore whitespace Rev 172 → Rev 173

/lab/sipmscan/trunk/src/sipmscan.cpp
150,7 → 150,7
 
void TGAppMainFrame::HandleMenu(Int_t id)
{
// int ret = 0;
int ret = 0;
char cmd[256];
 
switch(id)
164,13 → 164,33
break;
 
case M_FILE_SAVE_MSETTINGS:
// Here, we save the set values in the measurement layout (automatically done when we safely exit the application and after each start of measurement).
SaveMeasSettings();
break;
 
case M_FILE_SAVE_ASETTINGS:
// Here, we save the set values in the analysis layout (automatically done when we safely exit the application and after each start of analysis).
SaveAnalSettings();
break;
 
case M_FILE_DEF_MSETTINGS:
printf("Reseting measurement settings to default.\n");
sprintf(cmd, "cp %s/settings/default_measurement_settings.txt %s/settings/measurement_settings.txt", rootdir, rootdir);
ret = system(cmd);
break;
 
case M_FILE_DEF_ASETTINGS:
printf("Reseting analysis settings to default.\n");
sprintf(cmd, "cp %s/settings/default_analysis_settings.txt %s/settings/analysis_settings.txt", rootdir, rootdir);
ret = system(cmd);
break;
 
case M_FILE_DEF_SETTINGS:
printf("Reseting all settings to default.\n");
sprintf(cmd, "cp %s/settings/default_measurement_settings.txt %s/settings/measurement_settings.txt", rootdir, rootdir);
ret = system(cmd);
sprintf(cmd, "cp %s/settings/default_analysis_settings.txt %s/settings/analysis_settings.txt", rootdir, rootdir);
ret = system(cmd);
break;
 
case M_FILE_CHECK_WIDTH:
printf("\nSettings window: %dx%d\n", measLayout[0]->GetWidth(), measLayout[0]->GetHeight());
printf("Histogram window: %dx%d\n", measLayout[1]->GetWidth(), measLayout[1]->GetHeight());
302,6 → 322,9
fMenuFile->AddSeparator();
fMenuFile->AddEntry(new TGHotString("Save current &measurement settings"), M_FILE_SAVE_MSETTINGS);
fMenuFile->AddEntry(new TGHotString("Save current &analysis settings"), M_FILE_SAVE_ASETTINGS);
fMenuFile->AddEntry(new TGHotString("Set default measurement settings"), M_FILE_DEF_MSETTINGS);
fMenuFile->AddEntry(new TGHotString("Set default analysis settings"), M_FILE_DEF_ASETTINGS);
fMenuFile->AddEntry(new TGHotString("Set default settings"), M_FILE_DEF_SETTINGS);
fMenuFile->AddEntry(new TGHotString("&Check frame width (Testing)"), M_FILE_CHECK_WIDTH);
fMenuFile->AddSeparator();
fMenuFile->AddEntry(new TGHotString("E&xit"), M_FILE_EXIT);
533,12 → 556,12
fH2 = new TGCompositeFrame(fG1, 3*subgroup[0]/4, 30, kFixedWidth | kHorizontalFrame);
xPos = new TSubStructure();
for(int i = 0; i < 6; i++) numform[i] = 0;
numform[0] = 9; numform[3] = 2; numform[4] = -100; numform[5] = 215000;
numform[0] = 9; numform[3] = 2; numform[4] = -100; numform[5] = 375000; //numform[4] = -100; numform[5] = 215000; // use commented part if Z is the longer axis and X the shorter
if(xPos->TGLabelNEntry(fH2, 8*subgroup[0]/16, 30, "X:", 0, numform, "center"))
fH2->AddFrame(xPos->outsidebox, f0centerX);
 
zPosMin = new TSubStructure();
numform[5] = 375000;
numform[5] = 215000; //numform[5] = 375000; // use commented part if Z is the longer axis and X the shorter
if(zPosMin->TGLabelNEntry(fH2, 8*subgroup[0]/16, 30, "Z (min):", 0, numform, "center"))
fH2->AddFrame(zPosMin->outsidebox, f0centerX);
fG1->AddFrame(fH2, f1expandXpad);
550,7 → 573,7
fH2->AddFrame(yPos->outsidebox, f0centerX);
 
zPosMax = new TSubStructure();
numform[5] = 375000;
numform[5] = 215000; //numform[5] = 375000; // use commented part if Z is the longer axis and X the shorter
if(zPosMax->TGLabelNEntry(fH2, 8*subgroup[0]/16, 30, "Z (max):", 0, numform, "center"))
fH2->AddFrame(zPosMax->outsidebox, f0centerX);
fG1->AddFrame(fH2, f1expandXpad);
557,7 → 580,7
fH2 = new TGCompositeFrame(fG1, 3*subgroup[0]/4, 30, kFixedWidth | kHorizontalFrame);
zPos = new TSubStructure();
numform[5] = 375000;
numform[5] = 215000; //numform[5] = 375000; // use commented part if Z is the longer axis and X the shorter
if(zPos->TGLabelNEntry(fH2, 8*subgroup[0]/16, 30, "Z:", 0, numform, "center"))
fH2->AddFrame(zPos->outsidebox, f0centerX);
 
580,11 → 603,12
fH2 = new TGCompositeFrame(fG1, 3*subgroup[0]/4, 30, kFixedWidth | kHorizontalFrame);
xPosMin = new TSubStructure();
for(int i = 0; i < 6; i++) numform[i] = 0;
numform[0] = 9; numform[3] = 2; numform[4] = -100; numform[5] = 215000;
numform[0] = 9; numform[3] = 2; numform[4] = -100; numform[5] = 375000; //numform[5] = 215000; // use commented part if Z is the longer axis and X the shorter
if(xPosMin->TGLabelNEntry(fH2, 8*subgroup[0]/16, 30, "X (min):", 0, numform, "center"))
fH2->AddFrame(xPosMin->outsidebox, f0centerX);
 
yPosMin = new TSubStructure();
numform[5] = 215000;
if(yPosMin->TGLabelNEntry(fH2, 8*subgroup[0]/16, 30, "Y (min):", 0, numform, "center"))
fH2->AddFrame(yPosMin->outsidebox, f0centerX);
fG1->AddFrame(fH2, f1expandXpad);
591,10 → 615,12
 
fH2 = new TGCompositeFrame(fG1, 3*subgroup[0]/4, 30, kFixedWidth | kHorizontalFrame);
xPosMax = new TSubStructure();
numform[5] = 375000; //numform[5] = 215000; // use commented part if Z is the longer axis and X the shorter
if(xPosMax->TGLabelNEntry(fH2, 8*subgroup[0]/16, 30, "X (max):", 0, numform, "center"))
fH2->AddFrame(xPosMax->outsidebox, f0centerX);
 
yPosMax = new TSubStructure();
numform[5] = 215000;
if(yPosMax->TGLabelNEntry(fH2, 8*subgroup[0]/16, 30, "Y (max):", 0, numform, "center"))
fH2->AddFrame(yPosMax->outsidebox, f0centerX);
fG1->AddFrame(fH2, f1expandXpad);
629,11 → 655,18
fG1->AddFrame(rotPos->outsidebox, f1expandXpad);
// Set, get, home and reset rotation buttons
if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *rotButtons -> 5 buttons (set rotation, read current rotation, home the motor, reset controller and emergency stop)\n");
if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *rotButtons -> 4 buttons (set rotation, read current rotation, home the motor, reset controller)\n");
rotButtons = new TSubStructure();
selnames[0] = "Set"; selnames[1] = "Get"; selnames[2] = "Home"; selnames[3] = "Reset"; selnames[4] = "Emergency stop";
if(rotButtons->TGMultiButton(fG1, 3*subgroup[0]/4, 30, 5, selnames, "center"))
selnames[0] = "Set"; selnames[1] = "Get"; selnames[2] = "Home"; selnames[3] = "Reset";
if(rotButtons->TGMultiButton(fG1, 3*subgroup[0]/4, 30, 4, selnames, "center"))
fG1->AddFrame(rotButtons->outsidebox, f1expandXpad);
// Emergency stop rotation buttons
if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *rotButEmergency -> 1 button (emergency stop)\n");
rotButEmergency = new TSubStructure();
selnames[0] = "Emergency stop";
if(rotButEmergency->TGMultiButton(fG1, 3*subgroup[0]/4, 30, 1, selnames, "center"))
fG1->AddFrame(rotButEmergency->outsidebox, f1expandXpad);
 
// Rotation scan controls
if(DBGSIG > 1) printf("AppLayout(): Creating TSubStructure *rotPosMin -> Number entry for starting angle\n");
714,10 → 747,10
Pixel_t pixel_color;
gClient->GetColorByName("white", pixel_color);
posButtons->widgetTB[4]->SetTextColor(pixel_color);
rotButtons->widgetTB[4]->SetTextColor(pixel_color);
rotButEmergency->widgetTB[0]->SetTextColor(pixel_color);
gClient->GetColorByName("red", pixel_color);
posButtons->widgetTB[4]->SetBackgroundColor(pixel_color);
rotButtons->widgetTB[4]->SetBackgroundColor(pixel_color);
rotButEmergency->widgetTB[0]->SetBackgroundColor(pixel_color);
 
// Actions for Main window //TODO
vOutOpt->widgetChBox[0]->Connect("Clicked()", "TGAppMainFrame", this, "NegativePolarity()");
733,7 → 766,7
rotButtons->widgetTB[1]->Connect("Clicked()", "TGAppMainFrame", this, "RotationSet(=1)");
rotButtons->widgetTB[2]->Connect("Clicked()", "TGAppMainFrame", this, "RotationSet(=2)");
rotButtons->widgetTB[3]->Connect("Clicked()", "TGAppMainFrame", this, "RotationSet(=3)");
rotButtons->widgetTB[4]->Connect("Clicked()", "TGAppMainFrame", this, "RotationSet(=4)");
rotButEmergency->widgetTB[0]->Connect("Clicked()", "TGAppMainFrame", this, "RotationSet(=4)");
fileName->widgetTB[0]->Connect("Clicked()", "TGAppMainFrame", this, "SaveFile()");
measProgress->widgetTB[0]->Connect("Clicked()", "TGAppMainFrame", this, "StartAcq()");
// TODO - Save file
1200,6 → 1233,10
exportHist->widgetTB[0]->Connect("Clicked()", "TGAppMainFrame", this, "UpdateHistogram(=1)");
 
// Histogram controls pane -----------------------------------------------------------------
 
// Setting starting settings (when opening program)
GetMeasSettings();
GetAnalSettings();
}
 
// -------------------------------------------------------------------