From 2abf84b40baf5af710bd4deca4dc256f991d5c68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hern=C3=A1n=20Asorey?= <asoreyh@gmail.com> Date: Fri, 14 Sep 2018 09:46:06 -0300 Subject: [PATCH] Verbosity level for raw.cc and defines pulse containers in lago_file.h --- lago_file.h | 2 +- raw.cc | 30 ++++++++++++++++++++++++++---- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/lago_file.h b/lago_file.h index 4dcd815..1855636 100644 --- a/lago_file.h +++ b/lago_file.h @@ -148,7 +148,7 @@ class LagoFile { } } else { // reading pulse - int c0,c1,c2; + int c0=0, c1=0, c2=0; sscanf(line, "%d %d %d\n", &c0, &c1, &c2); Pulse[NbPulses].fill(c0,c1,c2); } diff --git a/raw.cc b/raw.cc index 676559a..88d8c61 100644 --- a/raw.cc +++ b/raw.cc @@ -84,6 +84,8 @@ int qtr_default = 55; // defined by Luis Otiniano, using typical fluctuations at // SATURATED PEAKS int sat_level[CHANNELS]; int sat_default = ADCMAX - 1; +bool sat_discard = false; +int sat_drop[CHANNELS]; // TIME DIFFERENCE (AND ALSO ALL PULSE DATA) ANALYSIS int tim_pc = 0, tim_pt = 0, tim_dc = 0, tim_dt = 0; @@ -107,6 +109,9 @@ double mon_avg_bl_tmp; double mon_dev_bl_tmp; int mon_bl_counts; +// VERBOSITY +int iverbose=0; + // SOL variable time integration int iSolTime = 60; // default 60s @@ -155,15 +160,16 @@ void TreatSecond(LagoGeneric *Data, LagoEvent*Pulse, int NbPulses) { // processing pulses for (int i=0; i<NbPulses; i++) { // discard saturated and it is a saturated pulse? - int sat_drop = 0; + sat_discard = false; if (isat) { for (int j=0; j<CHANNELS; j++) { if (Pulse[i].GetPeak(j) >= sat_level[j]) { // pulse is saturated - sat_drop++; + sat_drop[j]++; + sat_discard=true; } } } - if (isat && sat_drop) + if (isat && sat_discard) continue; // impossing external trigger @@ -414,7 +420,7 @@ void TreatSecond(LagoGeneric *Data, LagoEvent*Pulse, int NbPulses) { } } -void Usage(char *prog, int verbose=0) +void Usage(char *prog) { cout << "\t" << PROJECT << " " << CODEVERSION << endl; cout << endl; @@ -475,6 +481,7 @@ void Usage(char *prog, int verbose=0) cout << "\t-i\tOnly include pulses that trigger each channel to fill" << endl; cout << "\t \tthe calibration histograms of each channel (by default," << endl; cout << "\t \tall pulses are included." << endl; + cout << "\t-V\tincrease verbosity level." << endl; cout << "\t-?\tprints this help and exits" << endl << endl; cout << endl; exit(1); @@ -501,6 +508,8 @@ int main (int argc, char *argv[]) scl_scalers[i][j][l]=0; for (int i = 0; i < CHANNELS; i++) scl_flux[i] = 0; + for (int i = 0; i < CHANNELS; i++) + sat_drop[i] = 0; for (int i = 0; i < CHANNELS; i++) trg_level[i] = trg_default; for (int i = 0; i < CHANNELS; i++) @@ -617,6 +626,9 @@ int main (int argc, char *argv[]) iflx = 1; } break; + case 'V': + iverbose=1; + break; case 'g': isclg=1; break; @@ -736,6 +748,8 @@ int main (int argc, char *argv[]) snprintf(nfi,256,"%s.raw",ifile); raw.open(nfi); } + if (iverbose) + fprintf(stderr,"Verbose mode is on\n"); if (iall) { snprintf(nfi,256,"bzip2 -9z > %s.all.bz2",ifile); @@ -1056,4 +1070,12 @@ int main (int argc, char *argv[]) if (iscl) fclose(scl); } + if (iverbose) { + if (isat) { + fprintf(stderr, "INFO: saturated pulses discarded:\n\t\t"); + for (int j=0; j<CHANNELS; j++) + fprintf(stderr, "channel %d: %d. ", j+1, sat_drop[j]); + fprintf(stderr, "\n"); + } + } } -- GitLab