Changeset 11753 for trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.cc
- Timestamp:
- 08/03/11 14:21:39 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.cc
r11740 r11753 514 514 float yRange = bboxMax[1] - bboxMin[1]; 515 515 glColor3f(1.0,1.0,1.0); 516 float divideMe = (float)(VALUES_SPAN-1); 517 float plusMe = VALUES_SPAN/2; 518 if (drawCalibrationLoaded && calibrationLoaded) 519 { 520 divideMe /=2; 521 plusMe /=2; 522 } 516 523 for (int i=0;i<nRoi-1;i++) 517 524 { 518 525 #ifdef LOAD_RAW 519 526 glVertex2f(bboxMin[0] + xRange*i/(float)nRoi, 520 bboxMin[1] + yRange*(eventsData[eventNum][selectedPixel][i]+ (VALUES_SPAN/2)) /(float)(VALUES_SPAN-1));527 bboxMin[1] + yRange*(eventsData[eventNum][selectedPixel][i]+plusMe) /divideMe); 521 528 glVertex2f(bboxMin[0] + xRange*(i+1)/(float)nRoi, 522 bboxMin[1] + yRange*(eventsData[eventNum][selectedPixel][i+1]+ (VALUES_SPAN/2)) /(float)(VALUES_SPAN-1));529 bboxMin[1] + yRange*(eventsData[eventNum][selectedPixel][i+1]+plusMe) /divideMe); 523 530 #else 531 524 532 glVertex2f(bboxMin[0] + xRange*i/(float)nRoi, 525 bboxMin[1] + yRange*(eventData[nRoi*selectedPixel + i]+ (VALUES_SPAN/2)) /(float)(VALUES_SPAN-1));533 bboxMin[1] + yRange*(eventData[nRoi*selectedPixel + i]+plusMe) /divideMe); 526 534 glVertex2f(bboxMin[0] + xRange*(i+1)/(float)nRoi, 527 bboxMin[1] + yRange*(eventData[nRoi*selectedPixel + i+1]+ (VALUES_SPAN/2)) /(float)(VALUES_SPAN-1));535 bboxMin[1] + yRange*(eventData[nRoi*selectedPixel + i+1]+plusMe) /divideMe); 528 536 #endif 529 537 } … … 659 667 for (int i=0;i<1440;i++) 660 668 updateNeighbors(i); 669 670 calibrationLoaded = false; 671 drawCalibrationLoaded = false; 672 661 673 } 662 674 /************************************************************ … … 936 948 if (!inputFile->SetPtrAddress("Data", eventData)){ 937 949 cout << "Missing column " << "Data" << " Aborting load..." << endl; 938 nRoi = nRows = 0; }950 nRoi = nRows = 0;return;} 939 951 if (!inputFile->SetPtrAddress("EventNum", &eventNum)){ 940 952 cout << "Missing column " << "EventNum" << " Aborting load..." << endl; 941 nRoi = nRows = 0; }953 nRoi = nRows = 0;return;} 942 954 if (!inputFile->SetPtrAddress("TriggerType", &triggerType)){ 943 955 cout << "Missing column " << "TriggerType" << " Aborting load..." << endl; 944 nRoi = nRows = 0; }956 nRoi = nRows = 0;return;} 945 957 if (!inputFile->SetPtrAddress("SoftTrig", &softTrig)){ 946 958 cout << "Missing column " << "SoftTrig" << " Aborting load..." << endl; 947 nRoi = nRows = 0; }959 nRoi = nRows = 0;return;} 948 960 if (!inputFile->SetPtrAddress("PCTime", &pcTime)){ 949 961 cout << "Missing column " << "PCTime" << " Aborting load..." << endl; 950 nRoi = nRows = 0; }962 nRoi = nRows = 0;return;} 951 963 if (!inputFile->SetPtrAddress("BoardTime", boardTime)){ 952 964 cout << "Missing column " << "BoardTime" << " Aborting load..." << endl; 953 nRoi = nRows = 0; }965 nRoi = nRows = 0;return;} 954 966 if (!inputFile->SetPtrAddress("StartCellData", startPix)){ 955 967 cout << "Missing column " << "StartCellData" << " Aborting load..." << endl; 956 nRoi = nRows = 0; }968 nRoi = nRows = 0;return;} 957 969 if (!inputFile->SetPtrAddress("StartCellTimeMarker", startTM)){ 958 970 cout << "Missing column " << "StartCellTimeMarker" << " Aborting load..." << endl; 959 nRoi = nRows = 0; }971 nRoi = nRows = 0;return;} 960 972 int backupStep = eventStep; 961 973 rowNum = -1; … … 966 978 emit signalCurrentPixel(selectedPixel); 967 979 } 968 980 void RawDataViewer::openCalibFile(string& file) 981 { 982 calibrationLoaded = false; 983 calibInputFile = new fits(file); 984 if (!*calibInputFile) 985 { 986 delete calibInputFile; 987 calibInputFile = NULL; 988 return; 989 } 990 991 if (!calibInputFile->SetPtrAddress("BaselineMean", baseLineMean)){ 992 cout << "Missing column " << "BaseLineMean" << " Aborting load..." << endl; 993 return;} 994 if (!calibInputFile->SetPtrAddress("GainMean", gainMean)){ 995 cout << "Missing column " << "GainMean" << " Aborting load..." << endl; 996 return;} 997 if (!calibInputFile->SetPtrAddress("TriggerOffsetMean", triggerOffsetMean)){ 998 cout << "Missing column " << "TriggerOffsetMean" << " Aborting load..." << endl; 999 return;} 1000 1001 calibInputFile->GetNextRow(); 1002 1003 delete calibInputFile; 1004 1005 calibrationLoaded = true; 1006 emit newFileLoaded(); 1007 if (drawCalibrationLoaded) 1008 updateGL(); 1009 } 969 1010 /************************************************************ 970 1011 * PLUS EVENT … … 1009 1050 #endif 1010 1051 1052 if (drawCalibrationLoaded) 1053 { 1054 for (int i=0;i<1440;i++) 1055 for (int j=0;j<nRoi;j++) 1056 { 1057 eventData[i*1024+j] /= 2; 1058 eventData[i*1024+j] -= (baseLineMean[i*1024+j]+triggerOffsetMean[i*1024+j]); 1059 eventData[i*1024+j] /= gainMean[i*1024+j]; 1060 } 1061 } 1011 1062 updateGL(); 1012 1063 emit signalCurrentEvent(eventNum); 1013 1064 emit signalCurrentPixel(selectedPixel); 1014 1015 1065 } 1016 1066 /************************************************************ … … 1065 1115 patchID = 1; 1066 1116 rescaleWholeCamera = true; 1117 currentFile = "none"; 1118 currentCalibFile = "none"; 1067 1119 } 1068 1120 void UIConnector::slicesPlusPlus() … … 1073 1125 { 1074 1126 viewer->previousSlice(); 1127 } 1128 void UIConnector::drawCalibratedDataChanged(int state) 1129 { 1130 if (state) 1131 { 1132 if (viewer->calibrationLoaded) 1133 { 1134 viewer->drawCalibrationLoaded = true; 1135 for (int i=0;i<1440;i++) 1136 for (int j=0;j<viewer->nRoi;j++) 1137 { 1138 viewer->eventData[i*1024+j] /= 2; 1139 viewer->eventData[i*1024+j] -= (viewer->baseLineMean[i*1024+j]+viewer->triggerOffsetMean[i*1024+j]); 1140 viewer->eventData[i*1024+j] /= viewer->gainMean[i*1024+j]; 1141 } 1142 viewer->updateGL(); 1143 } 1144 else 1145 { 1146 drawCalibrationCheckBox->setChecked(false); 1147 } 1148 } 1149 else 1150 { 1151 viewer->drawCalibrationLoaded = false; 1152 if (viewer->calibrationLoaded) 1153 { 1154 for (int i=0;i<1440;i++) 1155 for (int j=0;j<viewer->nRoi;j++) 1156 { 1157 viewer->eventData[i*1024+j] *= viewer->gainMean[i*1024+j]; 1158 viewer->eventData[i*1024+j] += (viewer->baseLineMean[i*1024+j]+viewer->triggerOffsetMean[i*1024+j]); 1159 viewer->eventData[i*1024+j] *= 2; 1160 } 1161 viewer->updateGL(); 1162 } 1163 1164 } 1165 1075 1166 } 1076 1167 /************************************************************ … … 1306 1397 dialog.exec(); 1307 1398 } 1399 void UIConnector::loadNewCalibFileClicked() 1400 { 1401 QFileDialog dialog; 1402 dialog.setFileMode(QFileDialog::ExistingFile); 1403 dialog.open(this, SLOT(calibFileSelected(QString))); 1404 dialog.setVisible(true); 1405 dialog.exec(); 1406 } 1308 1407 /************************************************************ 1309 1408 * FILE SELECTED. return of the file open dialog handler … … 1315 1414 viewer->openFile(currentFile); 1316 1415 } 1416 void UIConnector::calibFileSelected(QString file) 1417 { 1418 currentCalibFile = file.toStdString(); 1419 if (currentCalibFile != "") 1420 viewer->openCalibFile(currentCalibFile); 1421 } 1317 1422 /************************************************************ 1318 1423 * NEW FILE LOADED. update of the UI after a new file has been loaded … … 1322 1427 ostringstream str; 1323 1428 str << "File loaded: " << currentFile << "\n"; 1429 str << "Calibration file loaded: " << currentCalibFile << "\n"; 1324 1430 // fileLoadedLabel->setText(QString(str.str().c_str())); 1325 1431 // str.str(""); … … 2123 2229 connector.range3 = myUi.colorRange3; 2124 2230 connector.range4 = myUi.colorRange4; 2231 connector.drawCalibrationCheckBox = myUi.calibratedCheckBox; 2125 2232 2126 2233 connector.initHistograms(); … … 2162 2269 &connector, SLOT(newFileLoaded())); 2163 2270 2271 QObject::connect(myUi.calibratedCheckBox, SIGNAL(stateChanged(int)), 2272 &connector, SLOT(drawCalibratedDataChanged(int))); 2164 2273 QObject::connect(myUi.loadNewFileButton, SIGNAL(clicked()), 2165 2274 &connector, SLOT(loadNewFileClicked())); 2275 QObject::connect(myUi.loadDRSCalibButton, SIGNAL(clicked()), 2276 &connector, SLOT(loadNewCalibFileClicked())); 2166 2277 2167 2278 QObject::connect(myUi.colorRange0, SIGNAL(valueChanged(double)),
Note:
See TracChangeset
for help on using the changeset viewer.