Repository: ara-software/AraSim
Pull request #180: Extra fixes multitriggers 1
Author: login: marcomuzio
Created: 2025-04-09T15:53:06Z | Merged: 2025-04-10T20:03:47Z

Some bug fixes to multitriggers. This is still being worked on.


Diff:
diff --git a/Detector.cc b/Detector.cc
index 7c48b771..81ac7f59 100644
--- a/Detector.cc
+++ b/Detector.cc
@@ -3763,9 +3763,12 @@ inline void Detector::ReadFilter(string filename, Settings *settings1) {    // w
 
 void Detector::ReadFilter_New(Settings *settings1) {    // will return gain (dB) with same freq bin with antenna gain
 
+    // Number of bins for FFTs
+    int n_bins = settings1->DATA_BIN_SIZE / 2;
+
     // We can use FilterGain array as a original array
-    double xfreq_databin[settings1->DATA_BIN_SIZE/2];   // array for FFT freq bin
-    double ygain_databin[settings1->DATA_BIN_SIZE/2];   // array for gain in FFT bin
+    std::vector<double> xfreq_databin(n_bins);   // vector for FFT freq bin
+    std::vector<double> ygain_databin(n_bins);   // vector for gain in FFT bin
     double df_fft;
     
     df_fft = 1./ ( (double)(settings1->DATA_BIN_SIZE) * settings1->TIMESTEP );
@@ -3774,7 +3777,7 @@ void Detector::ReadFilter_New(Settings *settings1) {    // will return gain (dB)
         xfreq_databin[i] = (double)i * df_fft / (1.E6); // from Hz to MHz
     }
 
-    Tools::SimpleLinearInterpolation( freq_step, &Freq[0], FilterGain, settings1->DATA_BIN_SIZE/2, xfreq_databin, ygain_databin );
+    Tools::SimpleLinearInterpolation( freq_step, &Freq[0], FilterGain, settings1->DATA_BIN_SIZE/2, xfreq_databin.data(), ygain_databin.data() );
         
     FilterGain_databin.clear();
     
@@ -3858,10 +3861,13 @@ inline void Detector::ReadPreamp(string filename, Settings *settings1) {    // w
 
 void Detector::ReadPreamp_New(Settings *settings1) {    // will return gain (dB) with same freq bin with antenna gain
 
+    // Number of bins for FFTs
+    int n_bins = settings1->DATA_BIN_SIZE / 2;
+
     // We can use FilterGain array as a original array
 
-    double xfreq_databin[settings1->DATA_BIN_SIZE/2];   // array for FFT freq bin
-    double ygain_databin[settings1->DATA_BIN_SIZE/2];   // array for gain in FFT bin
+    std::vector<double> xfreq_databin(n_bins);   // vector for FFT freq bin
+    std::vector<double> ygain_databin(n_bins);    // vector for gain in FFT bin
     double df_fft;
     
     df_fft = 1./ ( (double)(settings1->DATA_BIN_SIZE) * settings1->TIMESTEP );
@@ -3870,7 +3876,7 @@ void Detector::ReadPreamp_New(Settings *settings1) {    // will return gain (dB)
         xfreq_databin[i] = (double)i * df_fft / (1.E6); // from Hz to MHz
     }
 
-    Tools::SimpleLinearInterpolation( freq_step, &Freq[0], PreampGain, settings1->DATA_BIN_SIZE/2, xfreq_databin, ygain_databin );
+    Tools::SimpleLinearInterpolation( freq_step, &Freq[0], PreampGain, settings1->DATA_BIN_SIZE/2, xfreq_databin.data(), ygain_databin.data() );
         
     PreampGain_databin.clear();
     
@@ -4239,10 +4245,13 @@ void Detector::ReadAmplifierNoiseFigure(Settings *settings) {
 
 void Detector::ReadFOAM_New(Settings *settings1) {    // will return gain (dB) with same freq bin with antenna gain
 
+    // Number of bins for FFTs
+    int n_bins = settings1->DATA_BIN_SIZE / 2;
+
     // We can use FilterGain array as a original array
 
-    double xfreq_databin[settings1->DATA_BIN_SIZE/2];   // array for FFT freq bin
-    double ygain_databin[settings1->DATA_BIN_SIZE/2];   // array for gain in FFT bin
+    std::vector<double> xfreq_databin(n_bins);   // vector for FFT freq bin
+    std::vector<double> ygain_databin(n_bins);  // vector for gain in FFT bin
     double df_fft;
     
     df_fft = 1./ ( (double)(settings1->DATA_BIN_SIZE) * settings1->TIMESTEP );
@@ -4251,7 +4260,7 @@ void Detector::ReadFOAM_New(Settings *settings1) {    // will return gain (dB) w
         xfreq_databin[i] = (double)i * df_fft / (1.E6); // from Hz to MHz
     }
 
-    Tools::SimpleLinearInterpolation( freq_step, &Freq[0], FOAMGain, settings1->DATA_BIN_SIZE/2, xfreq_databin, ygain_databin );
+    Tools::SimpleLinearInterpolation( freq_step, &Freq[0], FOAMGain, settings1->DATA_BIN_SIZE/2, xfreq_databin.data(), ygain_databin.data() );
         
     FOAMGain_databin.clear();
     
@@ -5533,11 +5542,12 @@ std::vector< std::vector< double> > Detector::GetRayleighFitVector_databin(int s
 
     // this stores the response vector interpolated for THIS SPECIFIC DATA_BIN_SIZE
     std::vector< std::vector< double > > rayleighFits_DeepStation_values_databin;
-    rayleighFits_DeepStation_values_databin.resize(this_station_original_fits.size()); // resize to match channel count
+    rayleighFits_DeepStation_values_databin.resize(this_station_original_fits.size(), vector<double>(settings->DATA_BIN_SIZE/2)); // resize to match channel count
     
     // set up the output frequency spacing for this event's specific DATA_BIN_SIZE
+    int n_bins = settings->DATA_BIN_SIZE / 2;
     double df_fft = 1./ ( (double)(settings->DATA_BIN_SIZE) * settings->TIMESTEP ); // the frequency step
-    double interp_frequencies_databin[settings->DATA_BIN_SIZE/2];   // array for interpolated FFT frequencies
+    std::vector<double> interp_frequencies_databin(n_bins);   // array for interpolated FFT frequencies
     for(int i=0; i<settings->DATA_BIN_SIZE/2.; i++){
         // set the frequencies
         interp_frequencies_databin[i] = (double)i * df_fft / (1.E6); // from Hz to MHz
@@ -5547,28 +5557,22 @@ std::vector< std::vector< double> > Detector::GetRayleighFitVector_databin(int s
     // dumb, but oh well...
     // so, copy over the vector of frequencies into an array
     int numFreqBins = int(this_station_original_freqs.size());
-    double this_station_original_frequencies_asarray[numFreqBins];
-    std::copy(this_station_original_freqs.begin(), this_station_original_freqs.end(), this_station_original_frequencies_asarray);
 
     // loop over channel, and do the interpolation
     for(int iCh=0; iCh<this_station_original_fits.size(); iCh++){
 
-        // same issue as with the frequencies; we need to copy the results for this station and channel to an array
-        double this_channel_original_fits_asarray[numFreqBins];
-        std::copy(this_station_original_fits[iCh].begin(), this_station_original_fits[iCh].end(), this_channel_original_fits_asarray);
-
         // output value
-        double interp_fits_databin[settings->DATA_BIN_SIZE/2];   // array for interpolated rayleigh fit values
+        std::vector<double> interp_fits_databin(n_bins);   // array for interpolated rayleigh fit values
 
         // now, do interpolation
         Tools::SimpleLinearInterpolation(
-            numFreqBins, this_station_original_frequencies_asarray, this_channel_original_fits_asarray, // from the original binning
-            settings->DATA_BIN_SIZE/2, interp_frequencies_databin, interp_fits_databin // to the new binning
+            numFreqBins, this_station_original_freqs.data(), this_station_original_fits[iCh].data(), // from the original binning
+            settings->DATA_BIN_SIZE/2, interp_frequencies_databin.data(), interp_fits_databin.data() // to the new binning
         );
 
         // copy the interpolated values out
         for(int iFreqBin=0; iFreqBin<settings->DATA_BIN_SIZE/2; iFreqBin++) {
-            rayleighFits_DeepStation_values_databin[iCh].push_back( interp_fits_databin[iFreqBin] );
+            rayleighFits_DeepStation_values_databin[iCh][iFreqBin] = interp_fits_databin[iFreqBin];
         }
     }
 
@@ -5841,30 +5845,29 @@ void Detector::getDiodeModel(Settings *settings1) {
 
 vector<double> Detector::getDiodeModel(const int len, Settings *settings1) {
     // creates diode model vector of length len
-
     //  this is our homegrown diode response function which is a downgoing gaussian followed by an upward step function
     TF1 *fdown1=new TF1("fl_down1","[3]+[0]*exp(-1.*(x-[1])*(x-[1])/(2*[2]*[2]))",-300.E-9,300.E-9);
     fdown1->SetParameter(0,-0.8);
     fdown1->SetParameter(1,15.E-9);
     fdown1->SetParameter(2,2.3E-9);
     fdown1->SetParameter(3,0.);
-    
+
     TF1 *fdown2=new TF1("fl_down2","[3]+[0]*exp(-1.*(x-[1])*(x-[1])/(2*[2]*[2]))",-300.E-9,300.E-9);
     fdown2->SetParameter(0,-0.2);
     fdown2->SetParameter(1,15.E-9);
     fdown2->SetParameter(2,4.0E-9);
     fdown2->SetParameter(3,0.);
-    
+
     maxt_diode= settings1->MAXT_DIODE;
     
     TF1 *f_up=new TF1("f_up","[0]*([3]*(x-[1]))^2*exp(-(x-[1])/[2])",-200.E-9,100.E-9);
-    
+
     f_up->SetParameter(2,7.0E-9);
     f_up->SetParameter(0,1.);
     f_up->SetParameter(1,18.E-9);
     f_up->SetParameter(3,1.E9);
     
-    
+
     double sum=0.;
 	
     f_up->SetParameter(0,-1.*sqrt(2.*PI)*(fdown1->GetParameter(0)*fdown1->GetParameter(2)+fdown2->GetParameter(0)*fdown2->GetParameter(2))/(2.*pow(f_up->GetParameter(2),3.)*1.E18));
@@ -5884,9 +5887,9 @@ vector<double> Detector::getDiodeModel(const int len, Settings *settings1) {
             sum+=diode_real[i];
         }
     }
-    
-    double diode_real_fft[len];  
-    
+
+    std::vector<double> diode_real_fft(len, 0.0);  
+
     for (int i=0; i < len; i++) {  
         if ( i<(int)(maxt_diode/TIMESTEP) ) { 
             diode_real_fft[i] = diode_real[i];
@@ -5895,12 +5898,12 @@ vector<double> Detector::getDiodeModel(const int len, Settings *settings1) {
             diode_real_fft[i] = 0.;
         }
     }
-    
+
     // forward FFT
-    Tools::realft(diode_real_fft,1,len);
-    
+    Tools::realft(diode_real_fft.data(),1,len);
+
     vector<double> fdiode; 
-    
+
     // save f domain diode response in fdiode
     for (int i=0; i < len; i++) { 
         fdiode.push_back( diode_real_fft[i] );
diff --git a/Makefile b/Makefile
index 25681c28..e4403599 100644
--- a/Makefile
+++ b/Makefile
@@ -24,6 +24,7 @@ CXX = g++
 
 #Generic and Site Specific Flags
 CXXFLAGS     += $(SYSINCLUDES) $(INC_ARA_UTIL) -DGIT_COMMIT_HASH=\"$(GIT_COMMIT_HASH)\"
+CXXFLAGS		 += -Werror=return-type 
 #LDFLAGS      += -L. -g -I$(BOOST_ROOT) $(ROOTLDFLAGS) $(LD_ARA_UTIL) -Wl
 LDFLAGS      += -L. -g -I$(BOOST_ROOT) $(ROOTLDFLAGS) $(LD_ARA_UTIL) -Wl,--no-as-needed
 #,--no-as-needed
diff --git a/Primaries.cc b/Primaries.cc
index 56b8aed1..fbe5646e 100644
--- a/Primaries.cc
+++ b/Primaries.cc
@@ -511,6 +511,12 @@ double Primaries::Gety(Settings *settings1,double pnu,int nu_nubar,int currentin
       return settings1->ELAST_Y;
   }
 
+  else {
+      throw runtime_error("YPARAM value not supported!");
+  }
+
+  return -1.; // should never reach this line
+
 } //Gety
 
 double Primaries::Getyweight(double pnu, double y, int nu_nubar, int currentint) {
diff --git a/Report.cc b/Report.cc
index f76edb76..6b60c2bb 100644
--- a/Report.cc
+++ b/Report.cc
@@ -612,7 +612,15 @@ void Report::BuildAndTriggerOnWaveforms(
     // to save time, use only necessary number of bins
     int max_total_bin = (
         (stations[station_index].max_arrival_time - stations[station_index].min_arrival_time) 
-        / settings1->TIMESTEP + settings1->NFOUR *3 + trigger->maxt_diode_bin );    // make more time
+        / settings1->TIMESTEP);
+    
+    // Compute next power of two larger than max_total_bin
+    max_total_bin = (int)std::pow(2, std::ceil(std::log2(max_total_bin)));
+    
+    //Analyze more bins for historically unspecified reasons. 
+    //Could be to adjust for an offset in indexing and signals that come after the last event temporally
+    //However AraSim may break without this extra padding, so adjust carefully
+    max_total_bin += settings1->NFOUR *3 + trigger->maxt_diode_bin;
 
     // Decide if new noise waveforms will be generated for every new event. 
     // Otherwise, the same noise waveforms will be used for the entire simulation run.
@@ -2898,7 +2906,7 @@ void Report::Convolve_Signals(
     // If there are no ray solutions to this antenna, fill all the arrays with 0s
     //   then get noise and convolve
     if ( antenna->ray_sol_cnt == 0 ){
-        
+
         // Save signal wf as array of 0s
         vector <double> V_signal;
         for (int bin=0; bin<BINSIZE; bin++) V_signal.push_back(0.);
@@ -2913,39 +2921,62 @@ void Report::Convolve_Signals(
             settings1, trigger, detector);
             
     }
-    // If there are ray solutions, prepare signal wf array with 0s 
-    //   and save an array with the full noise-only waveform to the antenna
-    else {
-
-        // Initialize waveform length as 2 BINSIZES longer than the last ray's signal bin
-        int array_length = antenna->Get_Max_SignalBin() + 2*BINSIZE;
-
-        // Make array of 0s for array we're saving all ray signals to
-        for (int i=0; i<array_length; i++) antenna->V_convolved.push_back(0.);
-        for (int i=0; i<array_length; i++) antenna->V_noise.push_back(0.);
-
-    }
-
     // Loop over ray solutions and get signals from each
     // Loop does not run if there are no ray solutions
-    if(antenna->ray_sol_cnt > 0) {
+    else {
+
       int this_signalbin = 0;
       int n_connected_rays = antenna->ray_sol_cnt; 
       vector<double> V_signal;
+    
+      // Identify the indices of the last non-empty waveform (to apply final padding inside Combine_Waveforms)
+      // Loop through all interaction indices
+      int last_valid_interaction = -1;  // Will store the index of the last interaction with data
+      int last_valid_m = -1;            // Will store the index of the last ray within that interaction
+
+      for (int i = 0; i < antenna->V.size(); ++i) {
+          // Loop over rays for this interaction
+          for (int m = 0; m < signal_bin[i].size(); ++m) {
+              // Check if the waveform is non-empty
+              if (!antenna->V[i][m].empty()) {
+                  // Update the last known valid (non-empty) waveform indices
+                  last_valid_interaction = i;
+                  last_valid_m = m;
+              }
+          }
+      }
+
       for (int interaction_idx=0; interaction_idx<antenna->V.size(); interaction_idx++){
         for (int m = 0; m < signal_bin[interaction_idx].size(); ++m) {
+            
+            bool is_last = (interaction_idx == last_valid_interaction) && (m == last_valid_m); // reached the last waveform
+
             Combine_Waveforms(
                 signal_bin[interaction_idx][m], this_signalbin,
                 antenna->V[interaction_idx][m], V_signal,
-                &this_signalbin, &V_signal);
+                &this_signalbin, &V_signal, is_last);
         }
       }
       
+      // If there are ray solutions, prepare signal wf array with 0s 
+      //   and save an array with the full noise-only waveform to the antenna
+
+      // Initialize array_length = waveform length + (2*NFOUR + maxt_diode_bin)
+      int waveform_length = (int)V_signal.size();
+      int array_length = waveform_length + this_signalbin + 2*settings1->NFOUR + trigger->maxt_diode_bin;
+
+      // Make vectors of 0s for array we're saving all ray signals to
+      antenna->V_convolved.clear();
+      antenna->V_noise.clear();
+      antenna->V_convolved.resize(array_length, 0.0);
+      antenna->V_noise.resize(array_length, 0.0);
+
       GetNoiseThenConvolve(
           antenna, V_signal,
           BINSIZE, this_signalbin, n_connected_rays, 
           channel_index, station_number, 
           settings1, trigger, detector);
+
     }
 
 }
@@ -3056,7 +3087,7 @@ void Report::Select_Wave_Convlv_Exchange(
 
 void Report::Combine_Waveforms(int signalbin_0, int signalbin_1, 
     vector<double> V0, vector<double> V1, 
-    int* signalbin_combined, vector<double>* V_combined
+    int* signalbin_combined, vector<double>* V_combined, bool pad_to_power_of_two
 ) {
   // adds waveforms V0 & V1 into combined vector V_combined
   // uses global signalbin indices to ensure vectors are properly combined
@@ -3097,13 +3128,12 @@ void Report::Combine_Waveforms(int signalbin_0, int signalbin_1,
     V[combined_bin] += V1[bin];
   }
 
-  // if length is not a power of 2, zero pad
-  if((len & (len - 1)) != 0) {
-    const int newLen = int(pow(2, ceil(log2(len)))); // get next power of 2 
+  // for the last added waveform if length is not a power of 2, zero pad
+  if(pad_to_power_of_two && (V.size() & (V.size() - 1)) != 0) {
+    const int newLen = int(pow(2, ceil(log2(V.size())))); // get next power of 2 
     V.resize(newLen, 0.);
   }
 
-
   return;
 }
 
@@ -3118,7 +3148,6 @@ void Report::GetNoiseThenConvolve(
     //   convolve them through the tunnel diode, apply voltage saturation,
     //   then save the noise and signals to the 
     //   `Antenna_r` object and the `trigger` class
-
     // Extend the length of this waveform we're constructing if more than 1 ray connected
     int wf_length = 0;
     int min_wf_bin = 0;
@@ -3200,6 +3229,7 @@ void Report::GetAntennaNoiseWF(
     // Pick noise waveform
     vector< vector <double> > *noise_wf;
     int channel_number = GetChNumFromArbChID(detector, channel_index, StationIndex, settings1) - 1;
+
     if ( settings1->NOISE_CHANNEL_MODE==0) {
         noise_wf = &trigger->v_noise_timedomain;
     }
@@ -3225,7 +3255,6 @@ void Report::GetAntennaNoiseWF(
         cout<<" for requested NOISE_CHANNEL_MODE "<<settings1->NOISE_CHANNEL_MODE<<endl;
         throw std::runtime_error("");
     }
-
     // Loop over bins and get noise voltage value for each
     int bin_value;
     int noise_ID_index;
@@ -3237,8 +3266,8 @@ void Report::GetAntennaNoiseWF(
         V_noise_only->push_back(
             noise_wf->at( noise_ID[noise_ID_index] ).at( noise_wf_index )
         );
-    } // end loop over bins
 
+    } // end loop over bins
 }
 
 
@@ -3908,6 +3937,9 @@ void Report::GetNoiseWaveforms_ch(Settings * settings1, Detector * detector, dou
         Vfft_noise_after.clear(); // remove previous Vfft_noise values
         Vfft_noise_before.clear(); // remove previous Vfft_noise values
 
+        Vfft_noise_after.resize(settings1->DATA_BIN_SIZE);
+        Vfft_noise_before.resize(settings1->DATA_BIN_SIZE/2);
+
         double V_tmp; // copy original flat H_n [V] value
         double current_amplitude, current_phase;
 
@@ -3934,7 +3966,7 @@ void Report::GetNoiseWaveforms_ch(Settings * settings1, Detector * detector, dou
                 ApplyRFCM_OutZero(ch, freq, detector, V_tmp, settings1 -> RFCM_OFFSET);
             }
 
-            Vfft_noise_before.push_back(V_tmp);
+            Vfft_noise_before[k] = V_tmp;
 
             current_phase = noise_phase[k];
 
@@ -3945,8 +3977,8 @@ void Report::GetNoiseWaveforms_ch(Settings * settings1, Detector * detector, dou
             vnoise[2 * k] = (current_amplitude) * cos(noise_phase[k]);
             vnoise[2 * k + 1] = (current_amplitude) * sin(noise_phase[k]);
 
-            Vfft_noise_after.push_back(vnoise[2 * k]);
-            Vfft_noise_after.push_back(vnoise[2 * k + 1]);
+            Vfft_noise_after[2*k] = vnoise[2 * k];
+            Vfft_noise_after[2*k + 1] = vnoise[2 * k + 1];
 
             // inverse FFT normalization factor!
             vnoise[2 * k] *= 2. / ((double) settings1 -> DATA_BIN_SIZE);
@@ -3961,6 +3993,9 @@ void Report::GetNoiseWaveforms_ch(Settings * settings1, Detector * detector, dou
 
         Vfft_noise_after.clear(); // remove previous Vfft_noise values
         Vfft_noise_before.clear(); // remove previous Vfft_noise values
+        
+        Vfft_noise_after.resize(settings1->DATA_BIN_SIZE);
+        Vfft_noise_before.resize(settings1->DATA_BIN_SIZE/2);
 
         double V_tmp; // copy original flat H_n [V] value
         double current_amplitude, current_phase;
@@ -3978,7 +4013,7 @@ void Report::GetNoiseWaveforms_ch(Settings * settings1, Detector * detector, dou
 
                 if (ch < detector -> RayleighFit_ch) {
 
-                    Vfft_noise_before.push_back(detector -> GetRayleighFit_databin(ch, k));
+                    Vfft_noise_before[k] = detector -> GetRayleighFit_databin(ch, k);
 
                     current_phase = noise_phase[k];
 
@@ -4005,7 +4040,7 @@ void Report::GetNoiseWaveforms_ch(Settings * settings1, Detector * detector, dou
                         ApplyRFCM_OutZero(ch, freq, detector, V_tmp, settings1 -> RFCM_OFFSET);
                     }
 
-                    Vfft_noise_before.push_back(V_tmp);
+                    Vfft_noise_before[k] = V_tmp;
 
                     current_phase = noise_phase[k];
 
@@ -4018,8 +4053,8 @@ void Report::GetNoiseWaveforms_ch(Settings * settings1, Detector * detector, dou
                 vnoise[2 * k] = (current_amplitude) * cos(noise_phase[k]);
                 vnoise[2 * k + 1] = (current_amplitude) * sin(noise_phase[k]);
 
-                Vfft_noise_after.push_back(vnoise[2 * k]);
-                Vfft_noise_after.push_back(vnoise[2 * k + 1]);
+                Vfft_noise_after[2*k] = vnoise[2 * k];
+                Vfft_noise_after[2*k + 1] =  vnoise[2 * k + 1];
 
                 // inverse FFT normalization factor!
                 vnoise[2 * k] *= 2. / ((double) settings1 -> DATA_BIN_SIZE);
@@ -4050,10 +4085,10 @@ void Report::GetNoiseWaveforms_ch(Settings * settings1, Detector * detector, dou
             // loop over frequency bins
             for(int k=0; k<settings1->DATA_BIN_SIZE/2; k++){
 
-                Vfft_noise_before.push_back(fits_for_this_station[ch][k]);
+                Vfft_noise_before[k] = fits_for_this_station[ch][k];
                 current_phase = noise_phase[k];
                 V_tmp = fits_for_this_station[ch][k];
-                
+
                 // the right normalization factor is N * sqrt(deltaF)
                 V_tmp *= double(settings1->DATA_BIN_SIZE);
                 V_tmp *= sqrt(this_delta_f);
@@ -4064,10 +4099,10 @@ void Report::GetNoiseWaveforms_ch(Settings * settings1, Detector * detector, dou
                 // set the real and imaginary components of the FFT
                 vnoise[2 * k] = (current_amplitude) * cos(noise_phase[k]);
                 vnoise[2 * k + 1] = (current_amplitude) * sin(noise_phase[k]);
-                
+
                 // stash those values
-                Vfft_noise_after.push_back(vnoise[2 * k]);
-                Vfft_noise_after.push_back(vnoise[2 * k + 1]);
+                Vfft_noise_after[2*k] = vnoise[2 * k];
+                Vfft_noise_after[2*k+1] = vnoise[2 * k + 1];
 
                 // and apply the inverse FFT normalization factor
                 vnoise[2 * k] *= 2. / ((double) settings1 -> DATA_BIN_SIZE);
@@ -4102,7 +4137,7 @@ void Report::GetNoiseWaveforms_ch(Settings * settings1, Detector * detector, dou
             // loop over frequency bins
             for(int k=0; k<settings1->DATA_BIN_SIZE/2; k++){
 
-                Vfft_noise_before.push_back(fits_for_this_station[ch][k]);
+                Vfft_noise_before[k] = fits_for_this_station[ch][k];
                 current_phase = noise_phase[k];
                 V_tmp = fits_for_this_station[ch][k];
                 
@@ -4118,8 +4153,8 @@ void Report::GetNoiseWaveforms_ch(Settings * settings1, Detector * detector, dou
                 vnoise[2 * k + 1] = (current_amplitude) * sin(noise_phase[k]);
                 
                 // stash those values
-                Vfft_noise_after.push_back(vnoise[2 * k]);
-                Vfft_noise_after.push_back(vnoise[2 * k + 1]);
+                Vfft_noise_after[2*k] = vnoise[2 * k];
+                Vfft_noise_after[2*k + 1] = vnoise[2 * k + 1];
 
                 // and apply the inverse FFT normalization factor
                 vnoise[2 * k] *= 2. / ((double) settings1 -> DATA_BIN_SIZE);
@@ -4144,9 +4179,10 @@ void Report::GetNoiseWaveforms_ch(Settings * settings1, Detector * detector, dou
 void Report::GetNoisePhase(Settings *settings1) {
 
     noise_phase.clear();    // remove all previous noise_phase vector values
+    noise_phase.resize(settings1->DATA_BIN_SIZE/2);
 
     for (int i=0; i<settings1->DATA_BIN_SIZE/2; i++) {  // noise with DATA_BIN_SIZE bin array
-        noise_phase.push_back(2*PI*gRandom->Rndm());  // get random phase for flat thermal noise
+        noise_phase[i] = 2*PI*gRandom->Rndm();  // get random phase for flat thermal noise
     }
     
 }
diff --git a/Report.h b/Report.h
index 7d86d911..e4a66ee7 100644
--- a/Report.h
+++ b/Report.h
@@ -294,7 +294,7 @@ class Report {
         void Combine_Waveforms( // combine the signal from two vectors into single vector
             int signalbin_0, int signalbin_1,
             vector<double> V0, vector<double> V1,
-            int* signalbin_combined, vector<double>* V_combined);
+            int* signalbin_combined, vector<double>* V_combined, bool pad_to_power_of_two);
         void GetNoiseThenConvolve(
             Antenna_r *antenna, vector <double> V_signal,
             int BINSIZE, int this_signalbin, int n_connected_rays, 
diff --git a/Tools.cc b/Tools.cc
index 5a1d5cf5..f6ce38a5 100644
--- a/Tools.cc
+++ b/Tools.cc
@@ -476,15 +476,15 @@ void Tools::InterpolateComplex(double *array, const int n) {
     }
 }
 
-void Tools::NormalTimeOrdering(const int n,double *volts) {
-    double volts_temp[n];
-    for (int i=0;i<n/2;i++) {
-        volts_temp[i]=volts[i+n/2];
-        volts_temp[i+n/2]=volts[i];
-    }
-    for (int i=0;i<n;i++) {
-        volts[i]=volts_temp[i];
+void Tools::NormalTimeOrdering(const int n, double *volts) {
+    std::vector<double> volts_temp(n);
+
+    for (int i = 0; i < n / 2; i++) {
+        volts_temp[i] = volts[i + n / 2];
+        volts_temp[i + n / 2] = volts[i];
     }
+
+    std::copy(volts_temp.begin(), volts_temp.end(), volts);
 }
 
 void Tools::NormalTimeOrdering_InvT(const int n,double *volts) {
diff --git a/Trigger.cc b/Trigger.cc
index 9530f67b..3420cdb7 100644
--- a/Trigger.cc
+++ b/Trigger.cc
@@ -625,8 +625,8 @@ void Trigger::GetNewNoiseWaveforms(Settings *settings1, Detector *detector, Repo
         int ngeneratedevents = settings1->NOISE_EVENTS;  // should this value read at Settings class
         double v_noise[settings1->DATA_BIN_SIZE];  // noise voltage time domain (with filter applied)
 
-        v_noise_timedomain.resize(ngeneratedevents);  // make the size of v_noise_timedomain_diode as ngeneratedevents (this will be huge!)
-        v_noise_timedomain_diode.resize(ngeneratedevents);  // make the size of v_noise_timedomain_diode as ngeneratedevents (this will be huge!)
+        v_noise_timedomain.resize(ngeneratedevents, vector<double>(DATA_BIN_SIZE));  // make the size of v_noise_timedomain_diode as ngeneratedevents (this will be huge!)
+        v_noise_timedomain_diode.resize(ngeneratedevents, vector<double>(DATA_BIN_SIZE));  // make the size of v_noise_timedomain_diode as ngeneratedevents (this will be huge!)
 
         if (settings1->TRIG_ANALYSIS_MODE != 1)
         {
@@ -645,7 +645,7 @@ void Trigger::GetNewNoiseWaveforms(Settings *settings1, Detector *detector, Repo
                 for (int m = 0; m < settings1->DATA_BIN_SIZE; m++)
                 {
 
-                    v_noise_timedomain[i].push_back(v_noise[m]);  // save pure noise (not diode convlved) waveforms
+                    v_noise_timedomain[i][m] = v_noise[m];  // save pure noise (not diode convlved) waveforms
 
                 }
             }  // get meandiode with 1000 noisewaveforms
@@ -661,8 +661,8 @@ void Trigger::GetNewNoiseWaveforms(Settings *settings1, Detector *detector, Repo
                 for (int m = 0; m < settings1->DATA_BIN_SIZE; m++)
                 {
 
-                    v_noise_timedomain[i].push_back(0.);
-                    v_noise_timedomain_diode[i].push_back(0.);
+                    v_noise_timedomain[i][m] = 0.;
+                    v_noise_timedomain_diode[i][m] = 0.;
                 }
             }
         }
@@ -681,8 +681,8 @@ void Trigger::GetNewNoiseWaveforms(Settings *settings1, Detector *detector, Repo
 
         for (int i = 0; i < num_chs; i++)
         {
-            v_noise_timedomain_ch[i].resize(ngeneratedevents);  // make the size of v_noise_timedomain_diode as ngeneratedevents (this will be huge!)
-            v_noise_timedomain_diode_ch[i].resize(ngeneratedevents);  // make the size of v_noise_timedomain_diode as ngeneratedevents (this will be huge!)
+            v_noise_timedomain_ch[i].resize(ngeneratedevents, vector<double>(settings1->DATA_BIN_SIZE));  // make the size of v_noise_timedomain_diode as ngeneratedevents (this will be huge!)
+            v_noise_timedomain_diode_ch[i].resize(ngeneratedevents, vector<double>(settings1->DATA_BIN_SIZE));  // make the size of v_noise_timedomain_diode as ngeneratedevents (this will be huge!)
 
         }
 
@@ -708,7 +708,7 @@ void Trigger::GetNewNoiseWaveforms(Settings *settings1, Detector *detector, Repo
                     for (int m = 0; m < settings1->DATA_BIN_SIZE; m++)
                     {
 
-                        v_noise_timedomain_ch[ch][i].push_back(v_noise[m]);  // save pure noise (not diode convlved) waveforms
+                        v_noise_timedomain_ch[ch][i][m] = v_noise[m];  // save pure noise (not diode convlved) waveforms
                     }
 
                 }  // get meandiode with 1000 noisewaveforms
@@ -722,8 +722,8 @@ void Trigger::GetNewNoiseWaveforms(Settings *settings1, Detector *detector, Repo
             for (int ch = 0; ch < num_chs; ch++) {
                 for (int i = 0; i < ngeneratedevents; i++) {
                     for (int m = 0; m < settings1->DATA_BIN_SIZE; m++) {
-                        v_noise_timedomain_ch[ch][i].push_back(0.);
-                        v_noise_timedomain_diode_ch[ch][i].push_back(0.);
+                        v_noise_timedomain_ch[ch][i][m] = 0.;
+                        v_noise_timedomain_diode_ch[ch][i][m] = 0.;
                     }
                 }
             }
@@ -742,8 +742,8 @@ void Trigger::GetNewNoiseWaveforms(Settings *settings1, Detector *detector, Repo
         v_noise_timedomain_diode_ch.resize(num_chs);  // make the size of v_noise_timedomain_diode as number of chs
 
         for (int i = 0; i < num_chs; i++) {
-            v_noise_timedomain_ch[i].resize(ngeneratedevents);  // make the size of v_noise_timedomain_diode as ngeneratedevents (this will be huge!)
-            v_noise_timedomain_diode_ch[i].resize(ngeneratedevents);  // make the size of v_noise_timedomain_diode as ngeneratedevents (this will be huge!)
+            v_noise_timedomain_ch[i].resize(ngeneratedevents, vector<double>(DATA_BIN_SIZE));  // make the size of v_noise_timedomain_diode as ngeneratedevents (this will be huge!)
+            v_noise_timedomain_diode_ch[i].resize(ngeneratedevents, vector<double>(DATA_BIN_SIZE));  // make the size of v_noise_timedomain_diode as ngeneratedevents (this will be huge!)
 
         }
 
@@ -762,7 +762,7 @@ void Trigger::GetNewNoiseWaveforms(Settings *settings1, Detector *detector, Repo
                     myconvlv(v_noise, settings1->DATA_BIN_SIZE, detector->fdiode_real_databin, v_noise_timedomain_diode_ch[ch][i]);
 
                     for (int m = 0; m < settings1->DATA_BIN_SIZE; m++) {
-                        v_noise_timedomain_ch[ch][i].push_back(v_noise[m]); // save pure noise (not diode convlved) waveforms
+                        v_noise_timedomain_ch[ch][i][m] = v_noise[m]; // save pure noise (not diode convlved) waveforms
                     }
 
                 }  // get meandiode with 1000 noisewaveforms
@@ -775,8 +775,8 @@ void Trigger::GetNewNoiseWaveforms(Settings *settings1, Detector *detector, Repo
             for (int ch = 0; ch < num_chs; ch++) {
                 for (int i = 0; i < ngeneratedevents; i++) {
                     for (int m = 0; m < settings1->DATA_BIN_SIZE; m++) {
-                        v_noise_timedomain_ch[ch][i].push_back(0.);
-                        v_noise_timedomain_diode_ch[ch][i].push_back(0.);
+                        v_noise_timedomain_ch[ch][i][m] = 0.;
+                        v_noise_timedomain_diode_ch[ch][i][m] = 0.;
                     }
                 }
             }
@@ -793,7 +793,7 @@ void Trigger::myconvlv(vector <double> &data,const int DATA_BIN_SIZE,vector <dou
     const int length=DATA_BIN_SIZE;
 
     // we are going to make double sized array for complete convolution
-    double power_noise_copy[length*2];
+    std::vector<double> power_noise_copy(length * 2);
 
     // fill half of the array as power (actually energy) and another half (actually extanded part) with zero padding (Numerical Recipes 643 page)
     for (int i=0;i<length;i++) {
@@ -804,9 +804,9 @@ void Trigger::myconvlv(vector <double> &data,const int DATA_BIN_SIZE,vector <dou
     }
     
     // do forward fft to get freq domain (energy of pure signal)
-    Tools::realft(power_noise_copy,1,length*2);
+    Tools::realft(power_noise_copy.data(),1,length*2);
     
-    double ans_copy[length*2];
+    std::vector<double> ans_copy(length * 2);
 
     // change the sign (from numerical recipes 648, 649 page)
     for (int j=1;j<length;j++) {
@@ -818,7 +818,7 @@ void Trigger::myconvlv(vector <double> &data,const int DATA_BIN_SIZE,vector <dou
 
     // 1/length is actually 2/(length * 2)
     
-    Tools::realft(ans_copy,-1,length*2);
+    Tools::realft(ans_copy.data(),-1,length*2);
     
     diodeconv.clear();  // remove previous values in diodeconv
     
@@ -848,7 +848,6 @@ void Trigger::myconvlv(vector <double> &data,const int DATA_BIN_SIZE,vector <dou
 // input data is not vector but double array
 void Trigger::myconvlv(double *data,const int DATA_BIN_SIZE,vector <double> &fdiode, vector <double> &diodeconv) {
     
-
     // cout << "Trigger::myconvlv" << endl;
     const int length=DATA_BIN_SIZE;
 
@@ -862,12 +861,12 @@ void Trigger::myconvlv(double *data,const int DATA_BIN_SIZE,vector <double> &fdi
     for (int i=length;i<length*2;i++) {
 	    power_noise_copy[i]=0.;
     }
-    
+
     // do forward fft to get freq domain (energy of pure signal)
     Tools::realft(power_noise_copy.data(),1,length*2);
 
     std::vector<double> ans_copy(length * 2);
-    
+
     // change the sign (from numerical recipes 648, 649 page)
     for (int j=1;j<length;j++) {
         ans_copy[2*j]=(power_noise_copy[2*j]*fdiode[2*j]-power_noise_copy[2*j+1]*fdiode[2*j+1])/((double)length);
@@ -880,14 +879,14 @@ void Trigger::myconvlv(double *data,const int DATA_BIN_SIZE,vector <double> &fdi
     //
     
     Tools::realft(ans_copy.data(),-1,length*2);
-    
+
     diodeconv.clear();  // remove previous values in diodeconv
     
     // only save first half of convolution result as last half is result from zero padding (and some spoiled bins)
     for (int i=0;i<length+maxt_diode_bin;i++) {
 	    diodeconv.push_back( ans_copy[i] );
     }
-    
+
     
     int iminsamp,imaxsamp; // find min and max samples such that
     // the diode response is fully overlapping with the noise waveform
@@ -897,7 +896,7 @@ void Trigger::myconvlv(double *data,const int DATA_BIN_SIZE,vector <double> &fdi
     // diode response function is only partially overlappying with the
     // waveform in the convolution
     imaxsamp=NFOUR/2;
-    
+
     if (imaxsamp<iminsamp) {
         cout << "Noise waveform is not long enough for this diode response.\n";
         exit(1);
diff --git a/test/veff_ara3/run_veff_ara3_test.sh b/test/veff_ara3/run_veff_ara3_test.sh
index 10aa09c0..417e2362 100644
--- a/test/veff_ara3/run_veff_ara3_test.sh
+++ b/test/veff_ara3/run_veff_ara3_test.sh
@@ -4,7 +4,7 @@
 
 # then, do a comparison to check for consistency
 
-EXPECTED_GLOBAL_PASS=2
-EXPECTED_TOTAL_WEIGHT=0.99957
+EXPECTED_GLOBAL_PASS=1
+EXPECTED_TOTAL_WEIGHT=0.81612
 EXPECTED_TOTAL_WEIGHT_SIGMA=0.0001
 python3 test/check_sim.py test/veff_ara3/veff_ara3_test_output.txt $EXPECTED_GLOBAL_PASS $EXPECTED_TOTAL_WEIGHT $EXPECTED_TOTAL_WEIGHT_SIGMA
diff --git a/test/veff_ara3/veff_ara3_test_output.txt b/test/veff_ara3/veff_ara3_test_output.txt
index 7be98d94..1d91560e 100644
--- a/test/veff_ara3/veff_ara3_test_output.txt
+++ b/test/veff_ara3/veff_ara3_test_output.txt
@@ -1,3 +1,4 @@
+The Git Commit Hash: 695932c44449f6e1c1cdf69105321f78aba2beb8
 
 	Default values!
 NNU : 100
@@ -37,7 +38,7 @@ read stations_per_side
 	Error, station number not match !
 InstalledStations[StationID].nChannels is 20
 Opening 2013-2017 SQliteDB using AraGeomTool::getStationInfo()
-Pre 2018: AraStationInfo::readChannelMapDbAtri_2(): INFO - /home/abishop/analysis/AraRoot_Install//share/araCalib/AntennaInfo.sqlite
+Pre 2018: AraStationInfo::readChannelMapDbAtri_2(): INFO - /cvmfs/ara.opensciencegrid.org/trunk/RHEL_7_x86_64/ara_build/share/araCalib/AntennaInfo.sqlite
 Opening default 2013-2017 SQLite tables for all stations 
 Borehole ch: 0 inserted station: 0 station: 3 string: 3 ant: 2 Type: 0
 Borehole ch: 1 inserted station: 0 station: 3 string: 0 ant: 2 Type: 0
@@ -115,14 +116,14 @@ System temp ch14 : 325
 System temp ch15 : 325
 System temp ch16 : 0
 Reading in situ ARA noise for this station and configuration from file: 
-/home/abishop/AraSim-AraSoft//data/noise/sigmavsfreq_A_3_config_2.csv
+/cvmfs/ara.opensciencegrid.org/trunk/RHEL_7_x86_64/source/AraSim/data/noise/sigmavsfreq_A_3_config_2.csv
 start read elect chain
  Reading standard ARA electronics response from file:
-/home/abishop/AraSim-AraSoft//data/gain/ARA_Electronics_TotalGain_TwoFilters.csv
+/cvmfs/ara.opensciencegrid.org/trunk/RHEL_7_x86_64/source/AraSim/data/gain/ARA_Electronics_TotalGain_TwoFilters.csv
  Recalculating in situ electronic response amplitude to ensure consistency with antenna model used here.
 done read elect chain
  Reading trigger formation values for this station and configuration from file:
-/home/abishop/AraSim-AraSoft//data/trigger/delays_masking_A3_C2.csv
+/cvmfs/ara.opensciencegrid.org/trunk/RHEL_7_x86_64/source/AraSim/data/trigger/delays_masking_A3_C2.csv
 Sharesurface: 0 : 0 : 0 : 10010.2 : 10003 : 6.35944e+06 : 
 Sharesurface: 0 : 0 : 1 : 10010.2 : 10003 : 6.35944e+06 : 
 Sharesurface: 0 : 0 : 2 : 10010.2 : 10003 : 6.35946e+06 : 
@@ -210,12 +211,13 @@ station[0].strings[3].antennas[1] no_ch:14
 station[0].strings[3].antennas[2] no_ch:15
 station[0].strings[3].antennas[3] no_ch:16
 *Thrown 0
-*******************************************************************************************
-trigger passed at bin 4209  passed ch : 0 (0type) Direct dist btw posnu : 1544.96 noiseID : 0 ViewAngle : 58.5635 LikelyTrigSignal : interaction 0, ray 0
-trigger passed at bin 4250  passed ch : 4 (0type) Direct dist btw posnu : 1551.6 noiseID : 0 ViewAngle : 58.8626 LikelyTrigSignal : interaction 0, ray 0
-trigger passed at bin 4327  passed ch : 12 (0type) Direct dist btw posnu : 1557.44 noiseID : 0 ViewAngle : 58.9857 LikelyTrigSignal : interaction 0, ray 0
-Global_Pass : 4209 evt : 91 added weight : 0.99957
-0.99957 : 9
+**********
+trigger passed at bin 5314  passed ch : 6 (0type) Direct dist btw posnu : 1817.96 noiseID : 0 ViewAngle : 55.5114 LikelyTrigSignal : interaction 0, ray 1
+trigger passed at bin 5434  passed ch : 10 (0type) Direct dist btw posnu : 1831.08 noiseID : 0 ViewAngle : 55.5173 LikelyTrigSignal : interaction 0, ray 1
+trigger passed at bin 5416  passed ch : 11 (1type) Direct dist btw posnu : 1832.25 noiseID : 0 ViewAngle : 55.4806 LikelyTrigSignal : interaction 0, ray 1
+trigger passed at bin 5454  passed ch : 14 (0type) Direct dist btw posnu : 1835.74 noiseID : 0 ViewAngle : 55.1539 LikelyTrigSignal : interaction 0, ray 1
+Global_Pass : 5165 evt : 10 added weight : 0.81612
+0.81612 : 9
 
 Making useful event
 StationID: 3
@@ -227,68 +229,24 @@ OR
 c) Call UsefulAtriStationEvent *realAtriEvPtr = new UsefulAtriStationEvent(rawAtriEvPtr, AraCalType::kLatestCalib); ***BEFORE*** 
 AraGeomTool::getStationInfo(3,2017)
 Opening 2013-2017 SQliteDB using AraGeomTool::getStationInfo()
-Pre 2018: AraStationInfo::readChannelMapDbAtri_2(): INFO - /home/abishop/analysis/AraRoot_Install//share/araCalib/AntennaInfo.sqlite
+Pre 2018: AraStationInfo::readChannelMapDbAtri_2(): INFO - /cvmfs/ara.opensciencegrid.org/trunk/RHEL_7_x86_64/ara_build/share/araCalib/AntennaInfo.sqlite
 Opening default 2013-2017 SQLite tables for all stations 
-*********Thrown 100
-**************************************************************************depth negative! -19.1763
-depth negative! -19.1763
-depth negative! -19.1763
-depth negative! -19.1763
-depth negative! -19.1685
-depth negative! -19.1685
-depth negative! -19.1685
-depth negative! -19.1685
-depth negative! -19.1734
-depth negative! -19.1734
-depth negative! -19.1734
-depth negative! -19.1734
-depth negative! -19.1811
-depth negative! -19.1811
-depth negative! -19.1811
-depth negative! -19.1811
-**************************Thrown 200
-***********************************************************depth negative! -15.5757
-depth negative! -15.5757
-depth negative! -15.5757
-depth negative! -15.5757
-depth negative! -15.5723
-depth negative! -15.5723
-depth negative! -15.5723
-depth negative! -15.5723
-depth negative! -15.5821
-depth negative! -15.5821
-depth negative! -15.5821
-depth negative! -15.5821
-depth negative! -15.5851
-depth negative! -15.5851
-depth negative! -15.5851
-depth negative! -15.5851
-*****************************************Thrown 300
-*************************************************************
-trigger passed at bin 4321  passed ch : 8 (0type) Direct dist btw posnu : 1377.66 noiseID : 0 ViewAngle : 57.0444 LikelyTrigSignal : interaction 0, ray 0
-trigger passed at bin 4327  passed ch : 10 (0type) Direct dist btw posnu : 1379.2 noiseID : 0 ViewAngle : 55.863 LikelyTrigSignal : interaction 0, ray 0
-trigger passed at bin 4418  passed ch : 12 (0type) Direct dist btw posnu : 1387.96 noiseID : 0 ViewAngle : 57.1833 LikelyTrigSignal : interaction 0, ray 0
-Global_Pass : 4247 evt : 361 added weight : 1.30807e-24
-1.30807e-24 : 0
-
-Making useful event
-StationID: 3
-StationID_AraRoot: 3
-***************************************Thrown 400
+******************************************************************************************Thrown 100
+****************************************************************************************************Thrown 200
+****************************************************************************************************Thrown 300
+****************************************************************************************************Thrown 400
 *************************************************************************************************** end loop
 Total Events Thrown: 500
-Total_Global_Pass : 2
-Total_Weight : 0.99957
-Total_Probability : 3628.34
-weight bin values : 1, 0, 0, 0, 0, 0, 0, 0, 0, 1
+Total_Global_Pass : 1
+Total_Weight : 0.81612
+Total_Probability : 3747.29
+weight bin values : 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
 
 Radius: 5000 [m]
 IceVolume : 2.35619e+11
-test Veff(ice) : 5.91922e+09 m3sr, 5.91922 km3sr
-test Veff(water eq.) : 5.42792e+09 m3sr, 5.42792 km3sr
+test Veff(ice) : 4.83287e+09 m3sr, 4.83287 km3sr
+test Veff(water eq.) : 4.43174e+09 m3sr, 4.43174 km3sr
 And Veff(water eq.) error plus : 7.31506 km3sr and error minus : 2.42193 km3sr
-max_dt : 1.96768e-07
-rmsdiode= 4.9017e-14
 Info in <TCanvas::Print>: pdf file sigmaCrossSection.pdf has been created
 outputdir= outputs/.
 This AraSim run is complete and will exit with code 0
diff --git a/test/veff_birefringence/run_veff_birefringence_test.sh b/test/veff_birefringence/run_veff_birefringence_test.sh
index fb70432e..2099da41 100644
--- a/test/veff_birefringence/run_veff_birefringence_test.sh
+++ b/test/veff_birefringence/run_veff_birefringence_test.sh
@@ -1,10 +1,10 @@
 # run AraSim with the veff setup file
 
-./AraSim test/veff_birefringence/birefringence_setup 2 outputs/. 2>&1 | tee test/veff_birefringence/veff_birefringence_test_output.txt 
+./AraSim test/veff_birefringence/birefringence_setup 3 outputs/. 2>&1 | tee test/veff_birefringence/veff_birefringence_test_output.txt 
 
 # then, do a comparison to check for consistency
 
 EXPECTED_GLOBAL_PASS=3
-EXPECTED_TOTAL_WEIGHT=0.992699
+EXPECTED_TOTAL_WEIGHT=0.0584521
 EXPECTED_TOTAL_WEIGHT_SIGMA=0.0001
 python3 test/check_sim.py test/veff_birefringence/veff_birefringence_test_output.txt $EXPECTED_GLOBAL_PASS $EXPECTED_TOTAL_WEIGHT $EXPECTED_TOTAL_WEIGHT_SIGMA
diff --git a/test/veff_birefringence/veff_birefringence_test_output.txt b/test/veff_birefringence/veff_birefringence_test_output.txt
index aad3570d..083b5662 100644
--- a/test/veff_birefringence/veff_birefringence_test_output.txt
+++ b/test/veff_birefringence/veff_birefringence_test_output.txt
@@ -1,3 +1,4 @@
+The Git Commit Hash: 695932c44449f6e1c1cdf69105321f78aba2beb8
 
 	Default values!
 NNU : 100
@@ -9,7 +10,7 @@ MOOREBAY : 0
 EXPONENT : 19
 DETECTOR : 1
 setupfile : test/veff_birefringence/birefringence_setup
-run number : 2
+run number : 3
 outputdir : outputs/.
 Read in READGEOM
 Read test/veff_birefringence/birefringence_setup file!
@@ -28,7 +29,7 @@ EXPONENT : 18
 DETECTOR : 4
 POSNU_RADIUS : 5000
 EVENT_GENERATION_MODE: 0
-first random : 0.458232
+first random : 0.994531
 
 Surface at (log:0, lat:0) : 6.35973e+06
 SurfaceAboveGeoid at (log:0, lat:0) : 2977
@@ -37,7 +38,7 @@ read stations_per_side
 	Error, station number not match !
 InstalledStations[StationID].nChannels is 20
 Opening 2013-2017 SQliteDB using AraGeomTool::getStationInfo()
-Pre 2018: AraStationInfo::readChannelMapDbAtri_2(): INFO - /home/abishop/analysis/AraRoot_Install//share/araCalib/AntennaInfo.sqlite
+Pre 2018: AraStationInfo::readChannelMapDbAtri_2(): INFO - /cvmfs/ara.opensciencegrid.org/trunk/RHEL_7_x86_64/ara_build/share/araCalib/AntennaInfo.sqlite
 Opening default 2013-2017 SQLite tables for all stations 
 Borehole ch: 0 inserted station: 0 station: 2 string: 3 ant: 2 Type: 0
 Borehole ch: 1 inserted station: 0 station: 2 string: 0 ant: 2 Type: 0
@@ -115,14 +116,14 @@ System temp ch14 : 325
 System temp ch15 : 325
 System temp ch16 : 0
 Reading in situ ARA noise for this station and configuration from file: 
-/home/abishop/AraSim-AraSoft//data/noise/sigmavsfreq_A_2_config_4.csv
+/cvmfs/ara.opensciencegrid.org/trunk/RHEL_7_x86_64/source/AraSim/data/noise/sigmavsfreq_A_2_config_4.csv
 start read elect chain
  Reading standard ARA electronics response from file:
-/home/abishop/AraSim-AraSoft//data/gain/ARA_Electronics_TotalGain_TwoFilters.csv
+/cvmfs/ara.opensciencegrid.org/trunk/RHEL_7_x86_64/source/AraSim/data/gain/ARA_Electronics_TotalGain_TwoFilters.csv
  Recalculating in situ electronic response amplitude to ensure consistency with antenna model used here.
 done read elect chain
  Reading trigger formation values for this station and configuration from file:
-/home/abishop/AraSim-AraSoft//data/trigger/delays_masking_A2_C4.csv
+/cvmfs/ara.opensciencegrid.org/trunk/RHEL_7_x86_64/source/AraSim/data/trigger/delays_masking_A2_C4.csv
 Sharesurface: 0 : 0 : 0 : 10004.4 : 9989.17 : 6.35944e+06 : 
 Sharesurface: 0 : 0 : 1 : 10004.4 : 9989.17 : 6.35945e+06 : 
 Sharesurface: 0 : 0 : 2 : 10004.4 : 9989.2 : 6.35946e+06 : 
@@ -171,22 +172,22 @@ finish calling secondaries and signal
 Preparing Noise
 num chs: 16
 From pure noise waveforms, diode responses
-For ch0 mean, rms diode are -6.04087e-16 1.43171e-14 rms voltage is 0.0146489
-For ch1 mean, rms diode are -6.38937e-16 1.7251e-14 rms voltage is 0.0146975
-For ch2 mean, rms diode are -2.37477e-15 5.21552e-14 rms voltage is 0.0282753
-For ch3 mean, rms diode are -7.93574e-16 1.76078e-14 rms voltage is 0.0159484
-For ch4 mean, rms diode are -2.07931e-15 4.56682e-14 rms voltage is 0.0260845
-For ch5 mean, rms diode are -6.08632e-16 1.363e-14 rms voltage is 0.0142274
-For ch6 mean, rms diode are -2.19729e-15 4.95485e-14 rms voltage is 0.027562
-For ch7 mean, rms diode are -1.54259e-15 3.34104e-14 rms voltage is 0.0224556
-For ch8 mean, rms diode are -1.87459e-15 4.92909e-14 rms voltage is 0.0250731
-For ch9 mean, rms diode are -6.50519e-16 1.6179e-14 rms voltage is 0.0148298
-For ch10 mean, rms diode are -8.24156e-16 2.06043e-14 rms voltage is 0.0164395
-For ch11 mean, rms diode are -7.74662e-16 2.265e-14 rms voltage is 0.0170404
-For ch12 mean, rms diode are -1.02349e-15 2.46667e-14 rms voltage is 0.0189183
-For ch13 mean, rms diode are -6.16079e-16 1.57967e-14 rms voltage is 0.0143372
-For ch14 mean, rms diode are -1.03576e-15 2.35384e-14 rms voltage is 0.0180482
-For ch15 mean, rms diode are -4.08123e-15 9.83434e-14 rms voltage is 0.0347238
+For ch0 mean, rms diode are -6.27955e-16 1.37047e-14 rms voltage is 0.0146185
+For ch1 mean, rms diode are -6.56328e-16 1.66139e-14 rms voltage is 0.0147315
+For ch2 mean, rms diode are -2.27714e-15 5.29088e-14 rms voltage is 0.0282751
+For ch3 mean, rms diode are -7.65577e-16 1.86105e-14 rms voltage is 0.0161629
+For ch4 mean, rms diode are -2.07609e-15 4.65665e-14 rms voltage is 0.0260487
+For ch5 mean, rms diode are -6.32337e-16 1.40649e-14 rms voltage is 0.0145787
+For ch6 mean, rms diode are -2.25692e-15 5.01206e-14 rms voltage is 0.0277761
+For ch7 mean, rms diode are -1.44037e-15 3.09927e-14 rms voltage is 0.0221141
+For ch8 mean, rms diode are -1.89703e-15 5.13312e-14 rms voltage is 0.0256865
+For ch9 mean, rms diode are -6.62946e-16 1.68771e-14 rms voltage is 0.014758
+For ch10 mean, rms diode are -8.2898e-16 2.05112e-14 rms voltage is 0.0168396
+For ch11 mean, rms diode are -8.81346e-16 2.33522e-14 rms voltage is 0.0171634
+For ch12 mean, rms diode are -1.04718e-15 2.43789e-14 rms voltage is 0.0188783
+For ch13 mean, rms diode are -5.75212e-16 1.54206e-14 rms voltage is 0.0144198
+For ch14 mean, rms diode are -1.04011e-15 2.40194e-14 rms voltage is 0.0183194
+For ch15 mean, rms diode are -3.48261e-15 9.90556e-14 rms voltage is 0.0347986
  DATA_BIN_SIZE : 16384
 powerthreshold : -6.06
 begin looping events!!
@@ -210,30 +211,13 @@ station[0].strings[3].antennas[1] no_ch:14
 station[0].strings[3].antennas[2] no_ch:15
 station[0].strings[3].antennas[3] no_ch:16
 *Thrown 0
-***********depth negative! -13.1584
-depth negative! -13.1584
-depth negative! -13.1584
-depth negative! -13.1584
-depth negative! -13.1456
-depth negative! -13.1456
-depth negative! -13.1456
-depth negative! -13.1456
-depth negative! -13.1563
-depth negative! -13.1563
-depth negative! -13.1563
-depth negative! -13.1563
-depth negative! -13.1481
-depth negative! -13.1481
-depth negative! -13.1481
-depth negative! -13.1481
-*****************************************************************************************Thrown 100
-********************************************************************************************
-trigger passed at bin 4704  passed ch : 1 (1type) Direct dist btw posnu : 3411.49 noiseID : 0 ViewAngle : 58.5844 LikelyTrigSignal : interaction 0, ray 0
-trigger passed at bin 4855  passed ch : 3 (1type) Direct dist btw posnu : 3423.2 noiseID : 0 ViewAngle : 58.7952 LikelyTrigSignal : interaction 0, ray 0
-trigger passed at bin 4920  passed ch : 4 (0type) Direct dist btw posnu : 3420.71 noiseID : 0 ViewAngle : 58.265 LikelyTrigSignal : interaction 0, ray 0
-trigger passed at bin 4975  passed ch : 11 (1type) Direct dist btw posnu : 3431.12 noiseID : 0 ViewAngle : 58.6139 LikelyTrigSignal : interaction 0, ray 0
-Global_Pass : 4975 evt : 192 added weight : 0.992505
-0.992505 : 9
+**********************************************************************************
+trigger passed at bin 4345  passed ch : 0 (0type) Direct dist btw posnu : 1548.39 noiseID : 0 ViewAngle : 58.3487 LikelyTrigSignal : interaction 0, ray 0
+trigger passed at bin 4335  passed ch : 1 (1type) Direct dist btw posnu : 1550.56 noiseID : 0 ViewAngle : 58.3135 LikelyTrigSignal : interaction 0, ray 0
+trigger passed at bin 4300  passed ch : 4 (0type) Direct dist btw posnu : 1543.09 noiseID : 0 ViewAngle : 59.0135 LikelyTrigSignal : interaction 0, ray 0
+trigger passed at bin 4231  passed ch : 8 (0type) Direct dist btw posnu : 1536.14 noiseID : 0 ViewAngle : 58.5435 LikelyTrigSignal : interaction 0, ray 0
+Global_Pass : 4345 evt : 82 added weight : 7.23851e-11
+7.23851e-11 : 0
 
 Making useful event
 StationID: 2
@@ -245,111 +229,44 @@ OR
 c) Call UsefulAtriStationEvent *realAtriEvPtr = new UsefulAtriStationEvent(rawAtriEvPtr, AraCalType::kLatestCalib); ***BEFORE*** 
 AraGeomTool::getStationInfo(3,2017)
 Opening 2013-2017 SQliteDB using AraGeomTool::getStationInfo()
-Pre 2018: AraStationInfo::readChannelMapDbAtri_2(): INFO - /home/abishop/analysis/AraRoot_Install//share/araCalib/AntennaInfo.sqlite
+Pre 2018: AraStationInfo::readChannelMapDbAtri_2(): INFO - /cvmfs/ara.opensciencegrid.org/trunk/RHEL_7_x86_64/ara_build/share/araCalib/AntennaInfo.sqlite
 Opening default 2013-2017 SQLite tables for all stations 
-********Thrown 200
-***************************depth negative! -18.7981
-depth negative! -18.7981
-depth negative! -18.7981
-depth negative! -18.7981
-depth negative! -18.7875
-depth negative! -18.7875
-depth negative! -18.7875
-depth negative! -18.7875
-depth negative! -18.7939
-depth negative! -18.7939
-depth negative! -18.7939
-depth negative! -18.7939
-depth negative! -18.792
-depth negative! -18.792
-depth negative! -18.792
-depth negative! -18.792
-*******************depth negative! -22.6954
-depth negative! -22.6954
-depth negative! -22.6954
-depth negative! -22.6954
-depth negative! -22.6808
-depth negative! -22.6808
-depth negative! -22.6808
-depth negative! -22.6808
-depth negative! -22.6852
-depth negative! -22.6852
-depth negative! -22.6852
-depth negative! -22.6852
-depth negative! -22.6917
-depth negative! -22.6917
-depth negative! -22.6917
-depth negative! -22.6917
-**********************************************
-trigger passed at bin 4331  passed ch : 1 (1type) Direct dist btw posnu : 968.033 noiseID : 0 ViewAngle : 56.1143 LikelyTrigSignal : interaction 0, ray 0
-trigger passed at bin 4088  passed ch : 3 (1type) Direct dist btw posnu : 974.312 noiseID : 0 ViewAngle : 56.0522 LikelyTrigSignal : interaction 0, ray 0
-trigger passed at bin 4331  passed ch : 5 (1type) Direct dist btw posnu : 970.405 noiseID : 0 ViewAngle : 57.3571 LikelyTrigSignal : interaction 0, ray 0
-trigger passed at bin 4249  passed ch : 8 (0type) Direct dist btw posnu : 957.689 noiseID : 0 ViewAngle : 56.8252 LikelyTrigSignal : interaction 0, ray 0
-trigger passed at bin 4304  passed ch : 11 (1type) Direct dist btw posnu : 964.955 noiseID : 0 ViewAngle : 56.7442 LikelyTrigSignal : interaction 0, ray 0
-Global_Pass : 4331 evt : 292 added weight : 0.000194634
-0.000194634 : 0
+******************Thrown 100
+******************************************************
+trigger passed at bin 4226  passed ch : 4 (0type) Direct dist btw posnu : 1334.18 noiseID : 0 ViewAngle : 52.5976 LikelyTrigSignal : interaction 0, ray 0
+trigger passed at bin 4212  passed ch : 8 (0type) Direct dist btw posnu : 1333.36 noiseID : 0 ViewAngle : 53.1481 LikelyTrigSignal : interaction 0, ray 0
+trigger passed at bin 4339  passed ch : 12 (0type) Direct dist btw posnu : 1346.59 noiseID : 0 ViewAngle : 52.85 LikelyTrigSignal : interaction 0, ray 0
+Global_Pass : 4339 evt : 154 added weight : 2.01199e-14
+2.01199e-14 : 0
 
 Making useful event
 StationID: 2
 StationID_AraRoot: 2
-********Thrown 300
-****************************************************************************
-trigger passed at bin 4186  passed ch : 4 (0type) Direct dist btw posnu : 1646.16 noiseID : 0 ViewAngle : 56.0449 LikelyTrigSignal : interaction 0, ray 0
-trigger passed at bin 4295  passed ch : 6 (0type) Direct dist btw posnu : 1654.41 noiseID : 0 ViewAngle : 55.4934 LikelyTrigSignal : interaction 0, ray 0
-trigger passed at bin 4290  passed ch : 8 (0type) Direct dist btw posnu : 1654.18 noiseID : 0 ViewAngle : 56.4219 LikelyTrigSignal : interaction 0, ray 0
-Global_Pass : 4295 evt : 376 added weight : 4.93334e-34
-4.93334e-34 : 0
+**********************************************Thrown 200
+****************************************************************************************************Thrown 300
+**********************************************************************************************
+trigger passed at bin 4348  passed ch : 4 (0type) Direct dist btw posnu : 1308.75 noiseID : 0 ViewAngle : 57.6031 LikelyTrigSignal : interaction 0, ray 0
+trigger passed at bin 4233  passed ch : 8 (0type) Direct dist btw posnu : 1295.6 noiseID : 0 ViewAngle : 57.7868 LikelyTrigSignal : interaction 0, ray 0
+trigger passed at bin 4343  passed ch : 10 (0type) Direct dist btw posnu : 1307.27 noiseID : 0 ViewAngle : 58.0225 LikelyTrigSignal : interaction 0, ray 0
+Global_Pass : 4348 evt : 394 added weight : 0.0584521
+0.0584521 : 5
 
 Making useful event
 StationID: 2
 StationID_AraRoot: 2
-************************Thrown 400
-*depth negative! -29.6918
-depth negative! -29.6918
-depth negative! -29.6918
-depth negative! -29.6918
-depth negative! -29.6781
-depth negative! -29.6781
-depth negative! -29.6781
-depth negative! -29.6781
-depth negative! -29.6837
-depth negative! -29.6837
-depth negative! -29.6837
-depth negative! -29.6837
-depth negative! -29.6868
-depth negative! -29.6868
-depth negative! -29.6868
-depth negative! -29.6868
-****************************************************depth negative! -13.2988
-depth negative! -13.2988
-depth negative! -13.2988
-depth negative! -13.2988
-depth negative! -13.2921
-depth negative! -13.2921
-depth negative! -13.2921
-depth negative! -13.2921
-depth negative! -13.2902
-depth negative! -13.2902
-depth negative! -13.2902
-depth negative! -13.2902
-depth negative! -13.3012
-depth negative! -13.3012
-depth negative! -13.3012
-depth negative! -13.3012
-********************************************** end loop
+******Thrown 400
+*************************************************************************************************** end loop
 Total Events Thrown: 500
 Total_Global_Pass : 3
-Total_Weight : 0.992699
-Total_Probability : 4128
-weight bin values : 2, 0, 0, 0, 0, 0, 0, 0, 0, 1
+Total_Weight : 0.0584521
+Total_Probability : 5572.51
+weight bin values : 2, 0, 0, 0, 0, 1, 0, 0, 0, 0
 
 Radius: 5000 [m]
 IceVolume : 2.35619e+11
-test Veff(ice) : 5.87853e+09 m3sr, 5.87853 km3sr
-test Veff(water eq.) : 5.39061e+09 m3sr, 5.39061 km3sr
-And Veff(water eq.) error plus : 7.31507 km3sr and error minus : 2.42195 km3sr
-max_dt : 1.42865e-06
-rmsdiode= 1.43171e-14
+test Veff(ice) : 3.46139e+08 m3sr, 0.346139 km3sr
+test Veff(water eq.) : 3.1741e+08 m3sr, 0.31741 km3sr
+And Veff(water eq.) error plus : 5.7381 km3sr and error minus : 0.153119 km3sr
 Info in <TCanvas::Print>: pdf file sigmaCrossSection.pdf has been created
 outputdir= outputs/.
 This AraSim run is complete and will exit with code 0


Reviews:
user: login: marcomuzio
body: This all looks good to me. As far as I'm concerned we can merge this. But maybe @abigailbishop or @clark2668 want to take a look first.
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-10T04:32:00Z
user: login: abigailbishop
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-10T16:56:24Z
user: login: AlanSalcedo
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-10T17:46:38Z
user: login: AlanSalcedo
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-10T17:56:30Z
user: login: AlanSalcedo
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-10T18:09:17Z
user: login: AlanSalcedo
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-10T18:10:15Z
user: login: marcomuzio
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-10T19:08:31Z
user: login: marcomuzio
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-10T19:12:15Z
user: login: abigailbishop
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-10T19:22:08Z
user: login: abigailbishop
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-10T19:22:54Z
user: login: AlanSalcedo
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-10T19:42:27Z

Review comments:
diff_hunk: @@ -24,6 +24,7 @@ CXX = g++
 
 #Generic and Site Specific Flags
 CXXFLAGS     += $(SYSINCLUDES) $(INC_ARA_UTIL) -DGIT_COMMIT_HASH=\"$(GIT_COMMIT_HASH)\"
+CXXFLAGS		 += -Werror=return-type 
path: Makefile
user: login: abigailbishop
body: What does this do? 
created_at: 2025-04-10T16:07:50Z
author_association: MEMBER
diff_hunk: @@ -612,7 +612,13 @@ void Report::BuildAndTriggerOnWaveforms(
     // to save time, use only necessary number of bins
     int max_total_bin = (
         (stations[station_index].max_arrival_time - stations[station_index].min_arrival_time) 
-        / settings1->TIMESTEP + settings1->NFOUR *3 + trigger->maxt_diode_bin );    // make more time
+        / settings1->TIMESTEP);
+    
+    // Compute next power of two larger than max_total_bin
+    max_total_bin = (int)std::pow(2, std::ceil(std::log2(max_total_bin)));
+    
+    //make more time
+    max_total_bin += settings1->NFOUR *3 + trigger->maxt_diode_bin;
path: Report.cc
user: login: abigailbishop
body: Can we get a comment reminding us why we need these extra bins? maxt_diode_bin I can understand (would still be good to have a comment) but I don't remember why we need 3*NFOUR
created_at: 2025-04-10T16:09:48Z
author_association: MEMBER
diff_hunk: @@ -24,6 +24,7 @@ CXX = g++
 
 #Generic and Site Specific Flags
 CXXFLAGS     += $(SYSINCLUDES) $(INC_ARA_UTIL) -DGIT_COMMIT_HASH=\"$(GIT_COMMIT_HASH)\"
+CXXFLAGS		 += -Werror=return-type 
path: Makefile
user: login: AlanSalcedo
body: @marcomuzio 
created_at: 2025-04-10T17:46:38Z
author_association: MEMBER
diff_hunk: @@ -612,7 +612,13 @@ void Report::BuildAndTriggerOnWaveforms(
     // to save time, use only necessary number of bins
     int max_total_bin = (
         (stations[station_index].max_arrival_time - stations[station_index].min_arrival_time) 
-        / settings1->TIMESTEP + settings1->NFOUR *3 + trigger->maxt_diode_bin );    // make more time
+        / settings1->TIMESTEP);
+    
+    // Compute next power of two larger than max_total_bin
+    max_total_bin = (int)std::pow(2, std::ceil(std::log2(max_total_bin)));
+    
+    //make more time
+    max_total_bin += settings1->NFOUR *3 + trigger->maxt_diode_bin;
path: Report.cc
user: login: AlanSalcedo
body: That "//make more time" comment is what AraSim had already. Let me see if I can understand it.
created_at: 2025-04-10T17:56:30Z
author_association: MEMBER
diff_hunk: @@ -612,7 +612,13 @@ void Report::BuildAndTriggerOnWaveforms(
     // to save time, use only necessary number of bins
     int max_total_bin = (
         (stations[station_index].max_arrival_time - stations[station_index].min_arrival_time) 
-        / settings1->TIMESTEP + settings1->NFOUR *3 + trigger->maxt_diode_bin );    // make more time
+        / settings1->TIMESTEP);
+    
+    // Compute next power of two larger than max_total_bin
+    max_total_bin = (int)std::pow(2, std::ceil(std::log2(max_total_bin)));
+    
+    //make more time
+    max_total_bin += settings1->NFOUR *3 + trigger->maxt_diode_bin;
path: Report.cc
user: login: AlanSalcedo
body: @abigailbishop what do you think now?
created_at: 2025-04-10T18:09:12Z
author_association: MEMBER
diff_hunk: @@ -24,6 +24,7 @@ CXX = g++
 
 #Generic and Site Specific Flags
 CXXFLAGS     += $(SYSINCLUDES) $(INC_ARA_UTIL) -DGIT_COMMIT_HASH=\"$(GIT_COMMIT_HASH)\"
+CXXFLAGS		 += -Werror=return-type 
path: Makefile
user: login: AlanSalcedo
body: I got this: It makes the compiler treat missing or incorrect return statements as errors instead of just warnings.
created_at: 2025-04-10T18:10:15Z
author_association: MEMBER
diff_hunk: @@ -24,6 +24,7 @@ CXX = g++
 
 #Generic and Site Specific Flags
 CXXFLAGS     += $(SYSINCLUDES) $(INC_ARA_UTIL) -DGIT_COMMIT_HASH=\"$(GIT_COMMIT_HASH)\"
+CXXFLAGS		 += -Werror=return-type 
path: Makefile
user: login: marcomuzio
body: Ya exactly. This is how I caught a bug in Primaries which was meant to return double but had no return statement, which is v bad.
created_at: 2025-04-10T19:08:31Z
author_association: CONTRIBUTOR
diff_hunk: @@ -24,6 +24,7 @@ CXX = g++
 
 #Generic and Site Specific Flags
 CXXFLAGS     += $(SYSINCLUDES) $(INC_ARA_UTIL) -DGIT_COMMIT_HASH=\"$(GIT_COMMIT_HASH)\"
+CXXFLAGS		 += -Werror=return-type 
path: Makefile
user: login: marcomuzio
body: (Also we pretty much have compiler warnings turned off which isn't that great IMO...)
created_at: 2025-04-10T19:12:15Z
author_association: CONTRIBUTOR
diff_hunk: @@ -612,7 +612,13 @@ void Report::BuildAndTriggerOnWaveforms(
     // to save time, use only necessary number of bins
     int max_total_bin = (
         (stations[station_index].max_arrival_time - stations[station_index].min_arrival_time) 
-        / settings1->TIMESTEP + settings1->NFOUR *3 + trigger->maxt_diode_bin );    // make more time
+        / settings1->TIMESTEP);
+    
+    // Compute next power of two larger than max_total_bin
+    max_total_bin = (int)std::pow(2, std::ceil(std::log2(max_total_bin)));
+    
+    //make more time
+    max_total_bin += settings1->NFOUR *3 + trigger->maxt_diode_bin;
path: Report.cc
user: login: abigailbishop
body: Is it about having two signals in 2*NFOUR? I just went and looked it up and I almost wonder if its how long we expect a signal to be so we want to add that predicted readout window to the number of bins to investigate
created_at: 2025-04-10T19:22:07Z
author_association: MEMBER
diff_hunk: @@ -24,6 +24,7 @@ CXX = g++
 
 #Generic and Site Specific Flags
 CXXFLAGS     += $(SYSINCLUDES) $(INC_ARA_UTIL) -DGIT_COMMIT_HASH=\"$(GIT_COMMIT_HASH)\"
+CXXFLAGS		 += -Werror=return-type 
path: Makefile
user: login: abigailbishop
body: Sounds good, thanks!
created_at: 2025-04-10T19:22:54Z
author_association: MEMBER
diff_hunk: @@ -612,7 +612,13 @@ void Report::BuildAndTriggerOnWaveforms(
     // to save time, use only necessary number of bins
     int max_total_bin = (
         (stations[station_index].max_arrival_time - stations[station_index].min_arrival_time) 
-        / settings1->TIMESTEP + settings1->NFOUR *3 + trigger->maxt_diode_bin );    // make more time
+        / settings1->TIMESTEP);
+    
+    // Compute next power of two larger than max_total_bin
+    max_total_bin = (int)std::pow(2, std::ceil(std::log2(max_total_bin)));
+    
+    //make more time
+    max_total_bin += settings1->NFOUR *3 + trigger->maxt_diode_bin;
path: Report.cc
user: login: AlanSalcedo
body: Closing this
created_at: 2025-04-10T19:42:27Z
author_association: MEMBER

PR comments:
user: login: AlanSalcedo
created_at: 2025-04-10T02:23:07Z
body: The effective volume tests needed to be modified in [here](https://github.com/ara-software/AraSim/pull/180/commits/73f3300eab0af23ff6f01bfdfa0f341fb101f650). We think that a break in previous Veff tests is expected. See how we recover Veff test passing by reverting one line of code in [this commit](https://github.com/ara-software/AraSim/pull/180/commits/389ec7aa53aa56eecedb57798ea294be9fd1847c).

We now make sure that traces have not been modified.

EXAMPLE EVENT **AFTER** THE COMMIT: 
<img width="963" alt="Screenshot 2025-04-09 at 10 16 06 p m" src="https://github.com/user-attachments/assets/37bc20ea-bd3a-44c5-bb2b-059b4eb238af" />


EXAMPLE EVENT **BEFORE** THE COMMIT: 
<img width="975" alt="Screenshot 2025-04-09 at 10 15 43 p m" src="https://github.com/user-attachments/assets/2e428fef-d033-448a-b793-54272b02d67c" />

They look identical, but I have checked twice that they are produced before/after the changes in that commit. 

In summary, the trace wasn't changed significantly or unexpectedly. We still weren't sure why the signals aren't centered in the window. 

Then we produced the same event with a detector configuration (C) number that has no "delay-enable=0" on cable delays for triggering in `AraSim/data/trigger` (e.g. we changed from A3 C2, with cable delays in triggering; to A3 C1, without cable delays in triggering). Here's how the same event looks:

<img width="952" alt="Screenshot 2025-04-09 at 10 12 31 p m" src="https://github.com/user-attachments/assets/b5f09a49-68e8-4926-938c-80825693361a" />


The signal not being centered is due to cable delays added for some detector configurations in triggering, not an issue introduced in multitriggers.

author_association: MEMBER
user: login: AlanSalcedo
created_at: 2025-04-10T03:19:29Z
body: Regarding the offsets from trigger delays. I went ahead and looked at the `a23_4yr_diffuse` branch of AraSim and produced the same events with and without [cable delays in triggering](https://github.com/ara-software/AraSim/blob/77e97783088652cebc0e89abdbb1cd7230155d94/Report.cc#L2271). 

The shift is present in readout event then! Though the ones in the previous comment seem ~2x more pronounced.

<img width="823" alt="Screenshot 2025-04-09 at 11 16 55 p m" src="https://github.com/user-attachments/assets/3ad78e28-77bb-4446-90c3-099d399f3b08" />
<img width="815" alt="Screenshot 2025-04-09 at 11 17 02 p m" src="https://github.com/user-attachments/assets/28cb64ca-36bc-42a9-b119-9b967a0d57f8" />



author_association: MEMBER
user: login: clark2668
created_at: 2025-04-10T15:27:12Z
body: There are too many changes (that seem quite technical) for me to really understand or track. So I don't have any comments here.
author_association: COLLABORATOR
user: login: abigailbishop
created_at: 2025-04-10T16:25:18Z
body: After my two comments are addressed I think this is ready to merge. I agree that this does not appear to change any physics, it just extends arrays including the noise array which results in more RNG calls and that is what changes the Jeff test. Thanks Alan and Marco! 
author_association: MEMBER