Added frame number check.
This commit is contained in:
@ -451,6 +451,45 @@ int main(int argc, char* argv[]) {
|
||||
nfiles = 6;
|
||||
}
|
||||
|
||||
// total frame number check
|
||||
int expected_totalFrames = 0;
|
||||
if (find(scan_v2.begin(), scan_v2.end(), module_str) != scan_v2.end()) {
|
||||
expected_totalFrames = 19199;
|
||||
} else if (find(scan_v3.begin(), scan_v3.end(), module_str) != scan_v3.end()) {
|
||||
expected_totalFrames = 24319;
|
||||
} else if (find(scan_v4.begin(), scan_v4.end(), module_str) != scan_v4.end()) {
|
||||
expected_totalFrames = 21759;
|
||||
} else if (find(scan_v5.begin(), scan_v5.end(), module_str) != scan_v5.end()) {
|
||||
expected_totalFrames = 34560;
|
||||
} else if (find(scan_v6.begin(), scan_v6.end(), module_str) != scan_v6.end()) {
|
||||
expected_totalFrames = 64000;
|
||||
} else if (find(scan_v1.begin(), scan_v1.end(), module_str) != scan_v1.end()) {
|
||||
expected_totalFrames = 59519;
|
||||
}
|
||||
|
||||
int totalFrames = 0;
|
||||
|
||||
for (int filei = 0; filei < nfiles; filei++) {
|
||||
|
||||
sprintf(savename,"%s/%s_%%6.6d.dat", data_loc.c_str(), data_file.c_str());
|
||||
thisfile->open((char*)savename, filei);
|
||||
|
||||
while(thisfile->readNextFrame()) {
|
||||
totalFrames++;
|
||||
}
|
||||
|
||||
thisfile->close();
|
||||
}
|
||||
|
||||
if (totalFrames == expected_totalFrames) {
|
||||
cout << "got expected number of frames " << totalFrames << endl;
|
||||
} else {
|
||||
cout << "got unexpected number of frames " << totalFrames << endl;
|
||||
cout << "code expected frames " << expected_totalFrames << endl;
|
||||
cout << "exiting to make sure you notice" << endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
for (int filei = 0; filei < nfiles; filei++) {
|
||||
|
||||
sprintf(savename,"%s/%s_%%6.6d.dat", data_loc.c_str(), data_file.c_str());
|
||||
@ -541,19 +580,17 @@ int main(int argc, char* argv[]) {
|
||||
// catch the last frame (bad ctrl-c exit)
|
||||
// new receiver doesn't have this problem
|
||||
int last_frame = 0;
|
||||
if (find(scan_v2.begin(), scan_v2.end(), module_str) != scan_v2.end()) {
|
||||
last_frame = 19199-1920;
|
||||
} else if (find(scan_v3.begin(), scan_v3.end(), module_str) != scan_v3.end()) {
|
||||
last_frame = 24319-1920;
|
||||
} else if (find(scan_v4.begin(), scan_v4.end(), module_str) != scan_v4.end()) {
|
||||
last_frame = 21759-1920;
|
||||
} else if (find(scan_v1.begin(), scan_v1.end(), module_str) != scan_v1.end()) {
|
||||
last_frame = 59519-1920;
|
||||
if (find(scan_v1.begin(), scan_v1.end(), module_str) != scan_v1.end() ||
|
||||
find(scan_v2.begin(), scan_v2.end(), module_str) != scan_v2.end() ||
|
||||
find(scan_v3.begin(), scan_v3.end(), module_str) != scan_v3.end() ||
|
||||
find(scan_v4.begin(), scan_v4.end(), module_str) != scan_v4.end()) {
|
||||
last_frame = expected_totalFrames - 1920;
|
||||
}
|
||||
|
||||
if (j%640 == 0 || j == last_frame) {
|
||||
if (j == last_frame) {
|
||||
j = last_frame+1;
|
||||
cout << "catching on last_frame" << endl;
|
||||
}
|
||||
|
||||
for (int i = 0; i < NCH; i++) {
|
||||
@ -1007,11 +1044,6 @@ int main(int argc, char* argv[]) {
|
||||
grap_g0->SetMarkerColor(kBlue);
|
||||
grap_g0->SetLineColor(kBlue);
|
||||
|
||||
TF1 *extended_g0 = new TF1("extended_g0","[0]+[1]*x",0.009,1.1E3);
|
||||
extended_g0->SetParameters(fit_g0->GetParameter(0),fit_g0->GetParameter(1));
|
||||
extended_g0->SetLineColor(kBlue);
|
||||
extended_g0->SetLineStyle(2);
|
||||
|
||||
grap_g0->SetMinimum(0);
|
||||
grap_g0->SetMaximum(16000);
|
||||
grap_g0->GetXaxis()->SetTitle("Integration time [#mus]");
|
||||
@ -1027,7 +1059,6 @@ int main(int argc, char* argv[]) {
|
||||
st0->SetY2NDC(0.90);
|
||||
st0->SetBorderSize(0);
|
||||
st0->SetTextColor(kBlue);
|
||||
extended_g0->Draw("same");
|
||||
mapcanvas->SetLogx();
|
||||
sprintf(savename,"plots/M%s/CurrentSource/pixel_%s_%d_g0_M%s.png", module_str.c_str(), pixel_type.c_str(), i, module_str.c_str());
|
||||
mapcanvas->SaveAs((const char *)(savename));
|
||||
@ -1057,7 +1088,6 @@ int main(int argc, char* argv[]) {
|
||||
mapcanvas->SaveAs((const char *)(savename));
|
||||
|
||||
delete norm_g0;
|
||||
delete extended_g0;
|
||||
delete flat_g0;
|
||||
}
|
||||
}
|
||||
@ -1113,11 +1143,6 @@ int main(int argc, char* argv[]) {
|
||||
grap_g1->SetMarkerColor(kGreen+2);
|
||||
grap_g1->SetLineColor(kGreen+2);
|
||||
|
||||
TF1 *extended_g1 = new TF1("extended_g1","[0]+[1]*x",0.009,1.1E3);
|
||||
extended_g1->SetParameters(fit_g1->GetParameter(0),fit_g1->GetParameter(1));
|
||||
extended_g1->SetLineColor(kGreen+2);
|
||||
extended_g1->SetLineStyle(2);
|
||||
|
||||
grap_g1->SetMinimum(0);
|
||||
grap_g1->SetMaximum(16000);
|
||||
grap_g1->GetXaxis()->SetTitle("Integration time [#mus]");
|
||||
@ -1133,7 +1158,6 @@ int main(int argc, char* argv[]) {
|
||||
st0->SetY2NDC(0.36);
|
||||
st0->SetBorderSize(0);
|
||||
st0->SetTextColor(kGreen+2);
|
||||
extended_g1->Draw("same");
|
||||
mapcanvas->SetLogx();
|
||||
sprintf(savename,"plots/M%s/CurrentSource/pixel_%s_%d_g1_M%s.png", module_str.c_str(), pixel_type.c_str(), i, module_str.c_str());
|
||||
mapcanvas->SaveAs((const char *)(savename));
|
||||
@ -1188,7 +1212,6 @@ int main(int argc, char* argv[]) {
|
||||
mapcanvas->SaveAs((const char *)(savename));
|
||||
|
||||
delete norm_g1;
|
||||
delete extended_g1;
|
||||
delete flat_g1;
|
||||
}
|
||||
}
|
||||
@ -1244,11 +1267,6 @@ int main(int argc, char* argv[]) {
|
||||
grap_g2->SetMarkerColor(kRed);
|
||||
grap_g2->SetLineColor(kRed);
|
||||
|
||||
TF1 *extended_g2 = new TF1("extended_g2","[0]+[1]*x",0.009,1.1E3);
|
||||
extended_g2->SetParameters(fit_g2->GetParameter(0),fit_g2->GetParameter(1));
|
||||
extended_g2->SetLineColor(kRed);
|
||||
extended_g2->SetLineStyle(2);
|
||||
|
||||
grap_g2->SetMinimum(0);
|
||||
grap_g2->SetMaximum(16000);
|
||||
grap_g2->GetXaxis()->SetTitle("Integration time [#mus]");
|
||||
@ -1264,7 +1282,6 @@ int main(int argc, char* argv[]) {
|
||||
st0->SetY2NDC(0.36);
|
||||
st0->SetBorderSize(0);
|
||||
st0->SetTextColor(kRed);
|
||||
extended_g2->Draw("same");
|
||||
mapcanvas->SetLogx();
|
||||
sprintf(savename,"plots/M%s/CurrentSource/pixel_%s_%d_g2_M%s.png", module_str.c_str(), pixel_type.c_str(), i, module_str.c_str());
|
||||
mapcanvas->SaveAs((const char *)(savename));
|
||||
@ -1319,7 +1336,6 @@ int main(int argc, char* argv[]) {
|
||||
mapcanvas->SaveAs((const char *)(savename));
|
||||
|
||||
delete norm_g2;
|
||||
delete extended_g2;
|
||||
delete flat_g2;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user