1#ifdef BUILD_ROOTCOMPONENTS
2#ifndef LEGACY_H_INCLUDED
3#define LEGACY_H_INCLUDED
7#include "tof_typedefs.h"
18#define MAX_NUM_PEAKS 50
19#define ERRVAL (999999999)
27void RemoveSpikes(
double wf[NCHN][1024],
unsigned int tCell,
int spikes[]);
32enum class PADDLE_END : u16 {
39enum THRTYPE { CONSTANT, CFD_ELEC, CFD_SIMPLE, PCONSTANT, PCFD };
54enum SAT_FLAGS { NOT_SAT, NORMAL, SAT, NO_FIT, FIT_GOOD, FIT_BAD};
56double Pulse(
double *x,
double *par);
62 Waveform (
double *data,
double *time,
int chnl,
int flag = 0);
75 void SetWave(std::vector<double>);
76 void SetTime(std::vector<double>);
79 void SetThreshold(
float PmtThreshold);
80 int GetWaveSize(
void){
return wf_size;}
81 double SetBin(
int idx,
double val);
82 double GetBin(
int idx);
83 double GetBinTime(
int idx);
84 int GetBinDC(
int idx);
85 int GetMaxBin(
int lo,
int size);
86 double GetMaxBinTime(
int lo,
int size);
87 double GetMaxVal(
int lo,
int size);
88 int GetMinBin(
int lo,
int size);
89 double GetMinBinTime(
int lo,
int size);
90 double GetMinVal(
int lo,
int size);
91 double GetPeakValue(
float lo,
float size);
92 void Rescale(
double factor);
93 double Integrate(
float lo,
float size);
96 void SetPedestal(
double pedestal){wf_pedestal = pedestal;}
97 void SetRunPedestal(
double runped){run_pedestal = runped;}
98 void SetPedRange(
float range);
99 void SetPedBegin(
float begin);
100 int GetPedRange(
void){
return wf_ped_range;}
101 int GetPedBegin(
void){
return wf_ped_begin;}
102 double GetPedestal(
void){
return wf_pedestal;}
103 double GetPedsigma(
void){
return wf_pedsigma;}
104 void CalcPedestalRange(
void);
105 void CalcPedestalDynamic(
void);
106 void SubtractPedestal(
void);
109 void SetMaxPeaks(
int max_num);
110 int GetMaxPeaks(
void){
return max_num_peaks;}
111 void CleanUpPeaks(
void);
112 int GetNumPeaks(
void);
113 void SetCFDSFraction(
double fraction) {cfds_frac = fraction;}
114 void SetCFDEFraction(
double fraction) {cfde_frac = fraction;}
115 void SetCFDEOffset(
int offset) {cfde_offset = offset;}
116 void FindPeaks(
float start,
float size);
117 void FindTdc(
int pk_num,
int th_type = CFD_SIMPLE);
118 int GetSpikes(
int i);
119 double GetTdcs(
int i);
120 double GetCharge(
int i);
121 double GetHeight(
int i);
122 double GetWidth(
int i);
123 double GetPeakTime(
void) {
return PeakValueTime;}
126 double GetPulsepars(
int i) {
return pulsepars[i];}
127 double GetPulsechi2() {
return pulsechi2;}
128 double GetNDF() {
return ndf;}
132 double GetNsPerBin(
void) {
return bin_ns;}
133 double GetOffset(
void) {
return offset;}
134 double GetTimingCorr(
void){
return timing_corr;}
135 double GetImpedance(
void) {
return impedance;}
136 void SetImpedance(
double val) {
if (val>0) impedance = val;}
152 double PeakValueTime;
202 void InitializePointers();
203 void InitializeVariables(
int no_acq);
204 void Message(
const char *s);
206 void AllocatePeaks();
207 double FindInterpolatedTime(
float thresh,
int idx,
int size);
208 double FindCFDElecTime(
float thresh,
int idx,
int size);
209 double FindCFDSimpTime(
int pk_num);
210 int Time2Bin(
float t_ns);