wavecatcher-analysis
Loading...
Searching...
No Matches
Experimental.cc
Go to the documentation of this file.
1#include "Experimental.h"
2
16void Experimental::RebinAll(int ngroup, float noise_level, unsigned long seed) {
17
18 SP *= static_cast<float>(ngroup);
19 binNumber /= ngroup;
20 float norm = 1. / static_cast<float>(ngroup);
21 cout << "\nRebinning the data to a new sampling rate of " << 1. / SP
22 << " GS/s which corresponds to a bin size of " << SP << " ns and the data now has " << binNumber << " bins" << endl;
23
24 for (int j = 0; j < nwf; j++) {
25 TH1F* his = Getwf(j);
26 his->Rebin(ngroup);
27 his->Scale(norm);
28
29 if (noise_level != 0.) {
30 auto noise = new TRandom3();
31 noise->SetSeed(seed);
32 for (int i = 1; i <= his->GetNbinsX(); i++) his->SetBinContent(i, his->GetBinContent(i) + noise->Gaus(0, noise_level));
33 }
35 }
36}
38
43 cout << "\nForward derivative of all waveforms:" << endl;
44 for (int j = 0; j < nwf; j++) {
45 TH1F* his = Getwf(j);
46 double* yvals = Helpers::gety(his);
47 for (int i = 1; i <= his->GetNbinsX() - 1; i++) his->SetBinContent(i, yvals[i + 1] - yvals[i]);
48 delete[] yvals;
50 }
51}
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.
static void PrintProgressBar(int, int)
Print progress bar for a loop in steps of 10 percent.
Definition Helpers.cc:28
static double * gety(TH1F *)
Get array of y values for a histogram.
Definition Helpers.cc:125
TH1F * Getwf(int)
Helper that returns the waveform histogram for a certain waveform number number.
Definition ReadRun.cc:2547
int nwf
Total number of waveforms read from data: number of active channels x number of events.
Definition ReadRun.h:267
int binNumber
Number of bins (always 1024 samples per waveform). Do not change!
Definition ReadRun.h:280
float SP
Sampling: ns per bin of data, sampling rate 3.2 GS/s -> 0.3125 ns.
Definition ReadRun.h:274