Changeset 12343 for trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.cc
- Timestamp:
- 10/31/11 14:52:20 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.cc
r12310 r12343 477 477 drawBlur = false; 478 478 loopCurrentEvent = false; 479 fIsDrsCalibration = false; 479 480 SetAutoRefresh(true); 480 481 #ifdef LOAD_RAW … … 1059 1060 //calibrationLoaded = false; 1060 1061 1061 MessageImp msg; 1062 if (!DataCalib::ReadFits(file, msg)) 1063 { 1064 DataCalib::Restart(); 1065 return; 1066 } 1067 /* 1068 1069 calibInputFile = new fits(file); 1070 if (!*calibInputFile) 1071 { 1072 delete calibInputFile; 1073 calibInputFile = NULL; 1074 return; 1075 } 1076 1077 // if (calibInputFile->HasKey("NROI")) 1078 // { 1079 // cout << "Looks like you're trying to load a regular raw data file as DRS calib. aborting." << endl; 1080 // delete calibInputFile; 1081 // calibInputFile = NULL; 1082 // return; 1083 // } 1084 1085 if (!calibInputFile->SetPtrAddress("BaselineMean", baseLineMean)){ 1086 cout << "Missing column " << "BaseLineMean" << " Aborting load..." << endl; 1087 return;} 1088 if (!calibInputFile->SetPtrAddress("GainMean", gainMean)){ 1089 cout << "Missing column " << "GainMean" << " Aborting load..." << endl; 1090 return;} 1091 if (!calibInputFile->SetPtrAddress("TriggerOffsetMean", triggerOffsetMean)){ 1092 cout << "Missing column " << "TriggerOffsetMean" << " Aborting load..." << endl; 1093 return;} 1094 1095 calibInputFile->GetNextRow(); 1096 1097 // for (int i=0;i<1024;i++) 1098 // cout << gainMean[i] << " "; 1099 // cout << endl << endl; 1100 1101 delete calibInputFile; 1102 */ 1103 //calibrationLoaded = true; 1104 1105 emit newFileLoaded(); 1106 1107 //if (calibratedCheckBox->isChecked()) 1062 string msg; 1063 try 1064 { 1065 msg = fDrsCalib.ReadFitsImp(file); 1066 if (msg.empty()) 1067 { 1068 emit newFileLoaded(); 1069 updateGL(); 1070 return; 1071 } 1072 } 1073 catch (const runtime_error &e) 1074 { 1075 msg = e.what(); 1076 } 1077 1078 cerr << msg << endl; 1079 fDrsCalib.Clear(); 1080 } 1081 1082 /************************************************************ 1083 * PLUS EVENT 1084 ************************************************************/ 1085 void RawDataViewer::plusEvent() 1086 { 1087 eventStepping(true); 1088 } 1089 /************************************************************ 1090 * MINUS EVENT 1091 ************************************************************/ 1092 void RawDataViewer::minusEvent() 1093 { 1094 eventStepping(false); 1095 } 1096 /************************************************************ 1097 * SET EVENT STEP 1098 ************************************************************/ 1099 void RawDataViewer::setEventStep(int step) 1100 { 1101 eventStep = step; 1102 } 1103 /************************************************************ 1104 * EVENT STEPPING 1105 ************************************************************/ 1106 1107 void RawDataViewer::ApplyCalibration() 1108 { 1109 for (int i=0;i<(1440+160)*nRoi;i++) 1110 eventData[i] = (float)rawEventData[i]; 1111 1112 if (fIsDrsCalibration) 1113 { 1114 fDrsCalib.Apply(eventData, rawEventData, startPix, nRoi); 1115 DrsCalibrate::RemoveSpikes(eventData, nRoi); 1116 } 1117 1118 vector<float> pixelStatsData(1440*4); 1119 DrsCalibrate::GetPixelStats(pixelStatsData.data(), eventData, nRoi); 1120 1121 for (vector<PixelMapEntry>::const_iterator it=fPixelMap.begin(); it!=fPixelMap.end(); it++) 1122 RMSvalues[it->index] = pixelStatsData[1*1440+it->hw()]; 1123 1124 if (isVisible()) 1108 1125 updateGL(); 1109 1126 } 1110 /************************************************************ 1111 * PLUS EVENT 1112 ************************************************************/ 1113 void RawDataViewer::plusEvent() 1114 { 1115 eventStepping(true); 1116 } 1117 /************************************************************ 1118 * MINUS EVENT 1119 ************************************************************/ 1120 void RawDataViewer::minusEvent() 1121 { 1122 eventStepping(false); 1123 } 1124 /************************************************************ 1125 * SET EVENT STEP 1126 ************************************************************/ 1127 void RawDataViewer::setEventStep(int step) 1128 { 1129 eventStep = step; 1130 } 1131 /************************************************************ 1132 * EVENT STEPPING 1133 ************************************************************/ 1127 1134 1128 void RawDataViewer::eventStepping(bool plus) 1135 1129 { … … 1149 1143 inputFile->GetRow(rowNum); 1150 1144 // cout << "Getting row " << rowNum << endl; 1151 for (int i=0;i<(1440+160)*nRoi;i++)1152 eventData[i] = (float)rawEventData[i];1153 1145 #endif 1154 1146 1155 // if (drawCalibrationLoaded && calibrationLoaded) 1156 // { 1157 1158 // if (calibratedCheckBox->isChecked()) 1159 DataCalib::Apply(eventData, rawEventData, startPix, nRoi); 1160 CalibData::RemoveSpikes(eventData, nRoi); 1161 1162 vector<float> pixelStatsData(1440*4); 1163 CalibData::GetPixelStats(pixelStatsData.data(), eventData, nRoi); 1164 1165 1166 for (vector<PixelMapEntry>::const_iterator it=fPixelMap.begin(); it!=fPixelMap.end(); it++) 1167 { 1168 RMSvalues[it->index] = pixelStatsData[1*1440+it->hw()]; 1169 } 1170 1171 /* 1172 1173 for (int i=0;i<1440;i++) 1174 for (int j=0;j<nRoi;j++) 1175 { 1176 int realj = (j+startPix[i])%1024; 1177 eventData[i*1024+j] *= 2000.f/4096.f; 1178 eventData[i*1024+j] -= (baseLineMean[i*1024+realj]+triggerOffsetMean[i*1024+j]); 1179 eventData[i*1024+j] /= gainMean[i*1024+realj]; 1180 eventData[i*1024+j] *= (50000.f/65536.f) * 2500.f; 1181 } 1182 } 1183 */ 1184 if (isVisible()) 1185 updateGL(); 1147 ApplyCalibration(); 1148 1186 1149 emit signalCurrentEvent(eventNum); 1187 1150 emit signalCurrentPixel(selectedPixel); 1188 1151 } 1152 1189 1153 /************************************************************ 1190 1154 * NEXT SLICE. deprec ? … … 1375 1339 void UIConnector::on_calibratedCheckBox_stateChanged(int state) 1376 1340 { 1377 for (int i=0;i<(1440+160)*GLWindow->nRoi;i++) 1378 GLWindow->eventData[i] = (float)GLWindow->rawEventData[i]; 1379 1380 // if (GLWindow->calibratedCheckBox->isChecked()) 1381 if (state) 1382 { 1383 DataCalib::Apply(GLWindow->eventData, GLWindow->rawEventData, GLWindow->startPix, GLWindow->nRoi); 1384 CalibData::RemoveSpikes(GLWindow->eventData, GLWindow->nRoi); 1385 } 1386 1387 GLWindow->updateGL(); 1388 1389 //drawCalibrationCheckBox->setChecked(false); 1341 GLWindow->fIsDrsCalibration = state; 1342 GLWindow->ApplyCalibration(); 1390 1343 1391 1344 on_autoScaleColor_clicked(); … … 2220 2173 if (!autoScaleColor->isChecked()) 2221 2174 { 2222 /*2223 2175 GLWindow->ss[0] = 0.496; 2224 2176 GLWindow->ss[1] = 0.507; … … 2231 2183 colorRange3->setValue(GLWindow->ss[3]); 2232 2184 colorRange4->setValue(GLWindow->ss[4]); 2233 */2234 2185 return; 2235 2186 }
Note:
See TracChangeset
for help on using the changeset viewer.