Rev 173 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 173 | Rev 181 | ||
---|---|---|---|
Line 57... | Line 57... | ||
57 | resol2d->widgetNE[1]->SetNumber(40); |
57 | resol2d->widgetNE[1]->SetNumber(40); |
58 | } |
58 | } |
59 | else if(analTab->GetCurrent() == 1) // Relative PDE |
59 | else if(analTab->GetCurrent() == 1) // Relative PDE |
60 | { |
60 | { |
61 | relPde->widgetChBox[0]->SetState(kButtonDown); |
61 | relPde->widgetChBox[0]->SetState(kButtonDown); |
62 | relPde->widgetChBox[1]->SetState(kButtonUp); |
- | |
63 | midPeak->widgetChBox[0]->SetState(kButtonUp); |
62 | midPeak->widgetChBox[0]->SetState(kButtonUp); |
64 | zeroAngle->widgetNE[0]->SetNumber(0.00); |
63 | zeroAngle->widgetNE[0]->SetNumber(0.00); |
65 | } |
64 | } |
66 | else if(analTab->GetCurrent() == 2) // Breakdown voltage |
65 | else if(analTab->GetCurrent() == 2) // Breakdown voltage |
67 | { |
66 | { |
Line 693... | Line 692... | ||
693 | float progVal = 0; |
692 | float progVal = 0; |
694 | analysisProgress->widgetPB->SetPosition(progVal); |
693 | analysisProgress->widgetPB->SetPosition(progVal); |
695 | gVirtualX->Update(1); |
694 | gVirtualX->Update(1); |
696 | 695 | ||
697 | // Check if the checkbox for no peaks is selected - TODO: Still need the situation when we do not have a peaked ADC spectrum |
696 | // Check if the checkbox for no peaks is selected - TODO: Still need the situation when we do not have a peaked ADC spectrum |
698 |
|
697 | /* if(relPde->widgetChBox[1]->IsDown()) |
699 | { |
698 | { |
700 | printf("PhotonMu(): ADC spectrum has no peak structure.\n"); |
699 | printf("PhotonMu(): ADC spectrum has no peak structure.\n"); |
701 | nopeaks = 1; |
700 | nopeaks = 1; |
702 | 701 | ||
703 | // Error if there is no darkhist |
702 | // Error if there is no darkhist |
Line 710... | Line 709... | ||
710 | delete[] pdeval; |
709 | delete[] pdeval; |
711 | delete[] muval; |
710 | delete[] muval; |
712 | return; |
711 | return; |
713 | } |
712 | } |
714 | 713 | ||
715 |
|
714 | }*/ |
716 | 715 | ||
717 | // Start if we select at least one file |
716 | // Start if we select at least one file |
718 | if(nrfiles > 0) |
717 | if(nrfiles > 0) |
719 | { |
718 | { |
720 | // Find the pedestal peak for the dark histogram, and use it for all if there are no peaks |
719 | // Find the pedestal peak for the dark histogram, and use it for all if there are no peaks |
Line 1194... | Line 1193... | ||
1194 | exclude = false; |
1193 | exclude = false; |
1195 | 1194 | ||
1196 | // Get next point values (if zero value -> need to add the dark hist value again) |
1195 | // Get next point values (if zero value -> need to add the dark hist value again) |
1197 | pointest[10] = angle[i]; |
1196 | pointest[10] = angle[i]; |
1198 | pointest[11] = muval[i]; |
1197 | pointest[11] = muval[i]; |
- | 1198 | // printf("Last point = [%lf,%lf]\n", pointest[10], pointest[11]); |
|
1199 | 1199 | ||
1200 | // Check if next point has larger error than acceptable (if yes, set exclude signal to true), reuse meansel[0] |
1200 | // Check if next point has larger error than acceptable (if yes, set exclude signal to true), reuse meansel[0] |
1201 | meansel[0] = PointEstimate(5, pointest); // PointEstimate only works with very small step size |
1201 | meansel[0] = PointEstimate(5, pointest); // PointEstimate only works with very small step size |
1202 | if(meansel[0] > accError->widgetNE[0]->GetNumber()) |
1202 | if(meansel[0] > accError->widgetNE[0]->GetNumber()) |
1203 | { |
1203 | { |
1204 | printf("PhotonMu(): Point (%lf, %lf) excluded due to error: %lf\n", pointest[10], pointest[11], meansel[0]); |
1204 | printf("PhotonMu(): Point (%lf, %lf) excluded due to error: %lf\n", pointest[10], pointest[11], meansel[0]); |
- | 1205 | exclude = true; |
|
- | 1206 | } |
|
- | 1207 | ||
- | 1208 | if(isinf(meansel[0])) |
|
- | 1209 | { |
|
- | 1210 | printf("PhotonMu(): Point (%lf, %lf) excluded due to being infinite: %lf\n", pointest[10], pointest[11], meansel[0]); |
|
1205 | exclude = true; |
1211 | exclude = true; |
1206 | } |
1212 | } |
1207 | 1213 | ||
1208 | // Value with 0 angle and dark histogram are always needed, so should not be excluded |
1214 | // Value with 0 angle and dark histogram are always needed, so should not be excluded |
1209 | if(i == darkhist) |
1215 | if(i == darkhist) |
1210 | exclude = false; |
1216 | exclude = false; |
1211 | 1217 | ||
1212 | // If nothing excluded, pass the points in pointest variable like in a FIFO |
1218 | // If nothing excluded, pass the points in pointest variable like in a FIFO |
1213 | if(!exclude) |
1219 | if(!exclude) |
1214 | { |
1220 | { |
1215 | for(int j = 0; j < 10; j++) |
1221 | for(int j = 0; j < 10; j++) |
1216 | { |
1222 | { |
1217 | if(DBGSIG) printf("PhotonMu(): j = %d: Old X value = %lf\n", j, pointest[j]); |
1223 | if(DBGSIG) printf("PhotonMu(): j = %d: Old X value = %lf\n", j, pointest[j]); |
1218 | pointest[j] = pointest[j+2]; |
1224 | pointest[j] = pointest[j+2]; |
1219 | } |
1225 | } |
1220 | } |
1226 | } |
1221 | else |
1227 | else |
1222 | { |
1228 | { |
1223 | for(int j = 0; j < 10; j++) |
1229 | for(int j = 0; j < 10; j++) |
1224 | if(DBGSIG) printf("PhotonMu(): No j = %d: Old X value = %lf\n", j, pointest[j]); |
1230 | if(DBGSIG) printf("PhotonMu(): No j = %d: Old X value = %lf\n", j, pointest[j]); |
1225 | } |
1231 | } |
1226 | } |
1232 | } |
1227 | else |
1233 | else |
1228 | { |
1234 | { |
1229 | // First 5 points act as estimator points for next one |
1235 | // First 5 points act as estimator points for next one |
1230 | pointest[2*m] = angle[i]; |
1236 | pointest[2*m] = angle[i]; |
1231 | pointest[2*m+1] = muval[i]; |
1237 | pointest[2*m+1] = muval[i]; |
1232 | } |
1238 | } |
- | 1239 | ||
- | 1240 | printf("Exclude signal = %d\n", (int)exclude); |
|
1233 | 1241 | ||
1234 | // Run only if we have a dark run histogram and middle pedestal peak estimation |
1242 | // Run only if we have a dark run histogram and middle pedestal peak estimation |
1235 | if( (darkhist != -1) && midPeak->widgetChBox[0]->IsDown() ) |
1243 | if( (darkhist != -1) && midPeak->widgetChBox[0]->IsDown() ) |
1236 | { |
1244 | { |
1237 | if(DBGSIG) printf("PhotonMu(): m = %d, i = %d: muval = %lf, ", m, i, muval[i]); |
1245 | if(DBGSIG) printf("PhotonMu(): m = %d, i = %d: muval = %lf, ", m, i, muval[i]); |