tttrlib
A library for time-tagged time resolved data
Loading...
Searching...
No Matches
CorrelatorCurve.h
Go to the documentation of this file.
1#ifndef TTTRLIB_CORRELATORCURVE_H
2#define TTTRLIB_CORRELATORCURVE_H
3
4#include <iostream>
5#include <vector>
6#include <algorithm> /* std::max */
7#include <cmath> /* pow */
8#include <cstdint> // include this header for uint64_t
9
10
11
13
15 double macro_time_duration = 1.0;
16
18 unsigned int n_casc = 25;
19
21 unsigned int n_bins = 17;
22
24 unsigned int get_ncorr() const{
25 return n_casc * n_bins + 1;
26 }
27
28 std::string correlation_method;
29
30};
31
32
34
35 friend class Correlator;
36
37private:
38
49 void update_axis();
50
51protected:
52
54 std::vector<unsigned long long> x_axis;
55
57 std::vector<double> correlation;
58
60 std::vector<double> corr_normalized;
61
67 void resize(size_t n){
68 x_axis.resize(n);
69 correlation.resize(n);
70 corr_normalized.resize(n);
71 }
72
86 void clear(){
87 std::fill(correlation.begin(), correlation.end(), 0.0);
88 }
89
90public:
91
94
109 size_t size(){
110 return x_axis.size();
111 }
112
122 void get_x_axis(double **output, int *n_output);
123
131 void set_x_axis(std::vector<long long unsigned int> input);
132
142 void set_n_bins(int v) {
143 settings.n_bins = std::max(1, v);
144 update_axis();
145 }
146
154 unsigned int get_n_bins() {
155 return settings.n_bins;
156 }
157
166 void set_n_casc(int v) {
167 settings.n_casc = std::max(1, v);
168 update_axis();
169 }
170
178 unsigned int get_n_casc() const {
179 return settings.n_casc;
180 }
181
188 void get_corr(double** output, int* n_output);
189
196 void get_corr_normalized(double** output, int* n_output);
197
198};
199
200
201#endif //TTTRLIB_CORRELATORCURVE_H
Definition CorrelatorCurve.h:33
std::vector< unsigned long long > x_axis
The x-axis (the time axis) of the correlation.
Definition CorrelatorCurve.h:54
void get_corr(double **output, int *n_output)
Get the non-normalized correlation values.
unsigned int get_n_casc() const
Get the number of cascades (blocks) in the correlation curve.
Definition CorrelatorCurve.h:178
std::vector< double > correlation
The non-normalized correlation.
Definition CorrelatorCurve.h:57
void resize(size_t n)
Resizes the internal vectors to a specified size.
Definition CorrelatorCurve.h:67
CorrelationCurveSettings settings
Stores the settings of the correlation curve, i.e., the number of correlation bins.
Definition CorrelatorCurve.h:93
void set_x_axis(std::vector< long long unsigned int > input)
Set the x-axis to arbitrary bin values.
void set_n_casc(int v)
Set the number of cascades (blocks) in the correlation curve and update the correlation axis.
Definition CorrelatorCurve.h:166
std::vector< double > corr_normalized
The normalized correlation.
Definition CorrelatorCurve.h:60
void clear()
Clear the correlation values.
Definition CorrelatorCurve.h:86
unsigned int get_n_bins()
Get the number of equally spaced correlation channels per block.
Definition CorrelatorCurve.h:154
void set_n_bins(int v)
Set the number of equally spaced correlation channels per block.
Definition CorrelatorCurve.h:142
size_t size()
Get the size of the correlation curve.
Definition CorrelatorCurve.h:109
void get_corr_normalized(double **output, int *n_output)
Get the normalized correlation values.
void get_x_axis(double **output, int *n_output)
Get the x-axis of the correlation.
Definition Correlator.h:21
Definition CorrelatorCurve.h:12
std::string correlation_method
Definition CorrelatorCurve.h:28
unsigned int n_bins
The number of bins (correlation channels) per cascade.
Definition CorrelatorCurve.h:21
unsigned int get_ncorr() const
The number of points in a correlation curve.
Definition CorrelatorCurve.h:24
double macro_time_duration
Time calibration the duration of a single macro time unit.
Definition CorrelatorCurve.h:15
unsigned int n_casc
The number of cascades that coarsen the data.
Definition CorrelatorCurve.h:18