wavecatcher-analysis
Loading...
Searching...
No Matches
Experimental.cc
Go to the documentation of this file.
1#include "Experimental.h"
2
14void Experimental::RebinAll(int ngroup, float sigma_noise, unsigned long seed) {
15
16 SP *= static_cast<float>(ngroup);
17 SP_inv = 1. / SP;
18 binNumber /= 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;
23
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);
30
31 for (size_t i = 0; i + ngroup <= waveform.size(); i += ngroup) {
32 float sum = 0.;
33 for (int k = 0; k < ngroup; k++) {
34 sum += waveform[i + k];
35 }
36 float avg = sum * norm;
37
38 if (sigma_noise != 0.) {
39 avg += noise.Gaus(0., sigma_noise);
40 }
41 rebinned.push_back(avg);
42 }
43 rundata[j] = rebinned;
44 }
45}
47
52 cout << "\nForward derivative of all waveforms:" << endl;
53 binNumber--; // reduce number of bins
54
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]);
60 rundata[j] = derivative;
61 }
62}
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.
Definition ReadRun.h:132
int nwf
Total number of waveforms read from data: number of active channels x number of events.
Definition ReadRun.h:286
int binNumber
Number of bins (usually 1024 samples per waveform).
Definition ReadRun.h:301
float SP_inv
1/SP
Definition ReadRun.h:295
float SP
Sampling: ns per bin of data, sampling rate 3.2 GS/s -> 0.3125 ns.
Definition ReadRun.h:293