File indexing completed on 2025-08-03 08:17:00
0001 #ifndef CALORECO_CALOWAVEFORMPROCESSING_H
0002 #define CALORECO_CALOWAVEFORMPROCESSING_H
0003
0004 #include <fun4all/SubsysReco.h>
0005
0006 #include <array>
0007 #include <string>
0008 #include <vector>
0009
0010 class CaloWaveformFitting;
0011
0012 class CaloWaveformProcessing : public SubsysReco
0013 {
0014 public:
0015 enum process
0016 {
0017 NONE = 0,
0018 TEMPLATE = 1,
0019 ONNX = 2,
0020 FAST = 3,
0021 NYQUIST = 4,
0022 TEMPLATE_NOSAT = 5,
0023 };
0024
0025 CaloWaveformProcessing() = default;
0026 ~CaloWaveformProcessing() override;
0027
0028 void set_processing_type(CaloWaveformProcessing::process modelno)
0029 {
0030 m_processingtype = modelno;
0031 return;
0032 }
0033
0034 CaloWaveformProcessing::process get_processing_type()
0035 {
0036 return m_processingtype;
0037 }
0038
0039 void set_template_file(const std::string &template_input_file)
0040 {
0041 m_template_input_file = template_input_file;
0042 return;
0043 }
0044
0045 void set_template_name(const std::string &template_name)
0046 {
0047 m_template_name = template_name;
0048 return;
0049 }
0050 void set_model_file(const std::string &model_name)
0051 {
0052 m_model_name = model_name;
0053 return;
0054 }
0055
0056 void set_nthreads(int nthreads);
0057
0058 int get_nthreads();
0059
0060 void set_softwarezerosuppression(bool usezerosuppression, int softwarezerosuppression)
0061 {
0062 _nsoftwarezerosuppression = softwarezerosuppression;
0063 _bdosoftwarezerosuppression = usezerosuppression;
0064 }
0065 void set_timeFitLim(float low, float high)
0066 {
0067 m_setTimeLim = true;
0068 m_timeLim_low = low;
0069 m_timeLim_high = high;
0070 return;
0071 }
0072
0073 void set_bitFlipRecovery(bool dobitfliprecovery)
0074 {
0075 _dobitfliprecovery = dobitfliprecovery;
0076 }
0077
0078 std::vector<std::vector<float>> process_waveform(std::vector<std::vector<float>> waveformvector);
0079 std::vector<std::vector<float>> calo_processing_ONNX(const std::vector<std::vector<float>> &chnlvector);
0080
0081 void initialize_processing();
0082
0083 void set_onnx_factor(const int i, const double val) { m_Onnx_factor.at(i) = val; }
0084 void set_onnx_offset(const int i, const double val) { m_Onnx_offset.at(i) = val; }
0085
0086 private:
0087 CaloWaveformFitting *m_Fitter = nullptr;
0088
0089 CaloWaveformProcessing::process m_processingtype{CaloWaveformProcessing::TEMPLATE};
0090 int _nthreads{1};
0091 int _nsoftwarezerosuppression{40};
0092 bool _bdosoftwarezerosuppression{false};
0093 bool _dobitfliprecovery{false};
0094
0095 std::string m_template_input_file;
0096 std::string url_template;
0097 std::string m_template_name{"NONE"};
0098
0099 bool m_setTimeLim{false};
0100 float m_timeLim_low{-3.0};
0101 float m_timeLim_high{4.0};
0102
0103 std::string url_onnx;
0104 std::string m_model_name{"CEMC_ONNX"};
0105 std::array<double, 3> m_Onnx_factor{std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN()};
0106 std::array<double, 3> m_Onnx_offset{std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN()};
0107 };
0108
0109 #endif