gaps-online-software 0.10
online software for the TOF system for the GAPS experiment
All Classes Namespaces Functions Variables Pages Concepts
calibration.h
1#ifndef CALIBRATION_H_INCLUDED
2#define CALIBRATION_H_INCLUDED
3
4/********************************
5 * ReadoutBoard calibration:
6 * - convert adc, time bins in
7 * mV and nanoseconds.
8 *******************************/
9
10#include <vector>
11#include <string>
12
13#include "tof_typedefs.h"
14#include "events.h"
15
16class RBEvent;
17
18
21void spike_cleaning_drs4(Vec<Vec<f32>> &wf, u16 tCell, i32 spikes[]);
22
24void spike_cleaning_simple(Vec<Vec<f32>> &voltages, bool calibrated = true);
25
27void spike_cleaning_all(Vec<Vec<f32>> &voltages, bool calibrated = true);
28
34 static const u16 HEAD = 0xAAAA;
35 static const u16 TAIL = 0x5555;
36 static bool serialize_event_data;
37
41 f32 d_v;
44 Vec<Vec<f32>> v_offsets;
45 Vec<Vec<f32>> v_dips;
46 Vec<Vec<f32>> v_incs;
47 Vec<Vec<f32>> t_bin;
48 // data used to calculate calibration constants
50 Vec<RBEvent> noi_data;
52 Vec<RBEvent> vcal_data;
54 Vec<RBEvent> tcal_data;
55
57
59 Vec<Vec<f32>> voltages (const RBEvent &event, bool spike_cleaning = false) const;
60 Vec<Vec<f32>> nanoseconds (const RBEvent &event) const;
61
62 Vec<f32> voltages (const RBEvent &event, const u8 channel) const;
63 Vec<f32> nanoseconds(const RBEvent &event, const u8 channel) const;
64
72 static RBCalibration from_bytestream(const Vec<u8> &bytestream,
73 u64 &pos,
74 bool discard_events = true);
75
79 static RBCalibration from_txtfile(const String &filename);
80
81
85 static RBCalibration from_file(const String &filename,
86 bool discard_events = true);
88 std::string to_string() const;
89
93 static void disable_eventdata();
94
95 private:
96
98 bool channel_check(u8 channel) const;
99};
100
101std::ostream& operator<<(std::ostream& os, const RBCalibration& pck);
102
103#endif
Definition calibration.h:33
static RBCalibration from_bytestream(const Vec< u8 > &bytestream, u64 &pos, bool discard_events=true)
std::string to_string() const
String representation for printing.
static RBCalibration from_txtfile(const String &filename)
f32 d_v
voltage difference between noi and voltage data
Definition calibration.h:41
Vec< Vec< f32 > > voltages(const RBEvent &event, bool spike_cleaning=false) const
get the voltage values for the traces of the event
static void disable_eventdata()
Vec< RBEvent > noi_data
The no-input data used to calculate the constants.
Definition calibration.h:50
Vec< RBEvent > vcal_data
The constant voltage data used to calculate the constants.
Definition calibration.h:52
static RBCalibration from_file(const String &filename, bool discard_events=true)
u32 timestamp
timestamp when the calibration has been taken
Definition calibration.h:43
Vec< RBEvent > tcal_data
The timing calibration data used to calculate the constants.
Definition calibration.h:54
u8 rb_id
id of the RB this calibration belongs to
Definition calibration.h:39
Definition events.h:227