sipm-characterisation 0.1.0
SiPM characterisation for ePIC — IV/DCR/gain, laser, readout, irradiation
Loading...
Searching...
No Matches
waveutils.h
Go to the documentation of this file.
1#pragma once
2
3namespace waveutils {
4
5float get_amplitude(TGraph &graph, float tmin, float tmax)
6{
7 float amp = 0.;
8 for (int i = 0; i < graph.GetN(); ++i) {
9 if (graph.GetX()[i] > tmin && graph.GetX()[i] < tmax && graph.GetY()[i] > amp)
10 amp = graph.GetY()[i];
11 }
12 return amp;
13}
14
15std::vector<float> get_transitions(TGraph &graph, float threshold, float sign)
16{
17 std::vector<float> values;
18 bool armed = false;
19 for (int i = 0; i < graph.GetN(); ++i) {
20 if (!armed && sign * graph.GetY()[i] > sign * threshold * 0.5)
21 continue;
22 armed = true;
23 if (sign * graph.GetY()[i] < sign * threshold)
24 continue;
25 values.push_back(graph.GetX()[i]);
26 armed = false;
27 }
28 return values;
29 }
30
31}
float threshold
Definition my_test_macro_for_WF_fitting.C:6
Definition waveutils.h:3
float get_amplitude(TGraph &graph, float tmin, float tmax)
Definition waveutils.h:5
std::vector< float > get_transitions(TGraph &graph, float threshold, float sign)
Definition waveutils.h:15