Removed unused frame_counter variable and added a check before fitting empty histogram.

This commit is contained in:
redford_s
2018-04-27 14:20:40 +02:00
parent 7ddc42bb02
commit 61b35385bb

View File

@ -291,7 +291,6 @@ int main(int argc, char* argv[]) {
gain_histos[i] = new TH1I(histogramNameStream2.str().c_str(),"",4,-0.5,3.5);
}
int frame_counter = 0;
int j = 0;
int nfiles = 0;
if (module_str == "032") {
@ -314,12 +313,10 @@ int main(int argc, char* argv[]) {
if (filei == 0) {
for (int k = 0; k < (640*3); k++) {
thisfile->readNextFrame();
frame_counter++;
}
}
while (thisfile->readNextFrame()) {
frame_counter++;
j++;
uint16_t* imagedptr = thisfile->getFrameDataHandle();
@ -546,8 +543,6 @@ int main(int argc, char* argv[]) {
delete adc_histos_g2[i];
}
cout << "frame_counter " << frame_counter << endl;
// save histograms
sprintf(savename,"/mnt/pcmoench_jungfrau_data/jungfrau_ana_sophie/M%s_CalibAna/CS_histos_M%s.root", module_str.c_str(), module_str.c_str());
TFile* saved_file = new TFile((const char *)(savename),"RECREATE");
@ -1282,14 +1277,15 @@ int main(int argc, char* argv[]) {
sprintf(savename,"plots/M%s/CurrentSource/g0overg1hist_M%s.png", module_str.c_str(), module_str.c_str());
c1->SaveAs((const char *)(savename));
g0overg1hist->Fit("gaus");
g0overg1hist->Draw();
c1->Update();
TPaveText *pave2 = new TPaveText(0.6,0.8,0.94,0.94,"blNDC");
pave2->SetBorderSize(0);
pave2->SetFillStyle(0);
pave2->SetTextSize(0.04);
pave2->SetTextAlign(32);
if (g0overg1hist->GetEntries() > 0) {
g0overg1hist->Fit("gaus");
g0overg1hist->Draw();
c1->Update();
TF1* g0overg1hist_gaus = g0overg1hist->GetFunction("gaus");
sprintf(savename,"Mean %0.4f #pm %0.4f", g0overg1hist_gaus->GetParameter(1), g0overg1hist_gaus->GetParError(1));
pave2->AddText((const char *)(savename));
@ -1299,6 +1295,7 @@ int main(int argc, char* argv[]) {
g0overg1hist->SetStats(kFALSE);
sprintf(savename,"plots/M%s/CurrentSource/g0overg1hist_fit_M%s.png", module_str.c_str(), module_str.c_str());
c1->SaveAs((const char *)(savename));
}
g0overg1erhist->GetXaxis()->SetTitle("G0 / G1 uncert");
g0overg1erhist->GetXaxis()->SetTitleOffset(1.1);