16 SP *=
static_cast<float>(ngroup);
19 float norm = 1. /
static_cast<float>(ngroup);
20 cout <<
"\nRebinning the data to a new sampling rate of " << 1. /
SP
21 <<
" GS/s which corresponds to a bin size of " <<
SP
22 <<
" ns and the data now has " <<
binNumber <<
" bins" << endl;
24 #pragma omp parallel for
25 for (
int j = 0; j <
nwf; j++) {
26 vector<float> &waveform =
rundata[j];
27 vector<float> rebinned;
28 unsigned long thread_seed = seed + j;
29 TRandom3 noise(thread_seed);
31 for (
size_t i = 0; i + ngroup <= waveform.size(); i += ngroup) {
33 for (
int k = 0; k < ngroup; k++) {
34 sum += waveform[i + k];
36 float avg = sum * norm;
38 if (sigma_noise != 0.) {
39 avg += noise.Gaus(0., sigma_noise);
41 rebinned.push_back(avg);
52 cout <<
"\nForward derivative of all waveforms:" << endl;
55 #pragma omp parallel for
56 for (
int j = 0; j <
nwf; j++) {
57 vector<float> &waveform =
rundata[j];
58 vector<float> derivative;
59 for (
int i = 0; i <
binNumber; i++) derivative.push_back(waveform[i + 1] - waveform[i]);
void RebinAll(int=2, float=0, unsigned long=0)
Rebin the data to test bandwidth effects. Will combine an integer number of bins into a new,...
void DerivativeAll()
Derivative of all waveforms.
vector< vector< float > > rundata
Stores waveforms.
int nwf
Total number of waveforms read from data: number of active channels x number of events.
int binNumber
Number of bins (usually 1024 samples per waveform).
float SP
Sampling: ns per bin of data, sampling rate 3.2 GS/s -> 0.3125 ns.