Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MbdCalib.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file MbdCalib.h
1 #ifndef MBD_MBDCALIB_H
2 #define MBD_MBDCALIB_H
3 
4 #include "MbdDefs.h"
5 
6 #include <fun4all/Fun4AllBase.h>
7 
8 #include <phool/recoConsts.h>
9 
10 #include <array>
11 #include <vector>
12 //#include <math>
13 //#include <stdint>
14 #include <string>
15 //#include <string_view>
16 #include <memory>
17 
18 #include <mbd/MbdGeom.h>
19 
20 class TTree;
21 class CDBInterface;
22 
23 class MbdCalib : public Fun4AllBase
24 {
25  public:
26  MbdCalib();
27 
28  // MbdCalib(MbdCalib &other) = delete;
29  // void operator=(const MbdCalib &) = delete;
30 
31  virtual ~MbdCalib() {}
32 
33  float get_qgain(const int ipmt) const { return _qfit_mpv[ipmt]; }
34  float get_tq0(const int ipmt) const { return _tqfit_t0mean[ipmt]; }
35  int get_sampmax(const int ifeech) const { return _sampmax[ifeech]; }
36  std::vector<float> get_shape(const int ifeech) const { return _shape_y[ifeech]; }
37  std::vector<float> get_sherr(const int ifeech) const { return _sherr_yerr[ifeech]; }
38 
39  int Download_Gains(const std::string& dbfile);
40  int Download_TQT0(const std::string& dbfile);
41  int Download_TTT0(const std::string& dbfile);
42  int Download_Slew(const std::string& dbfile);
43  int Download_SampMax(const std::string& dbfile);
44  int Download_Shapes(const std::string& dbfile);
45  int Download_All();
46 
47  int Write_CDB_SampMax(const std::string& dbfile);
48  int Write_CDB_Shapes(const std::string& dbfile);
49  int Write_CDB_All();
50 
51  int Write_SampMax(const std::string& dbfile);
52  int Write_TQT0(const std::string& dbfile);
53 
54  // void Dump_to_file(const std::string& what = "ALL");
55 
56  void Reset();
57  // void Print(Option_t* option) const;
58 
59  private:
60  CDBInterface* _cdb{nullptr};
61  recoConsts* _rc{nullptr};
62 
63  std::unique_ptr<MbdGeom> _mbdgeom{nullptr};
64 
65  int _status{0};
66  // int _run_number {0};
67  // uint64_t _timestamp {0};
69 
70  // Assumes Landau fit
71  std::array<float, MbdDefs::BBC_N_PMT> _qfit_integ{};
72  std::array<float, MbdDefs::BBC_N_PMT> _qfit_mpv{};
73  std::array<float, MbdDefs::BBC_N_PMT> _qfit_sigma{};
74  std::array<float, MbdDefs::BBC_N_PMT> _qfit_integerr{};
75  std::array<float, MbdDefs::BBC_N_PMT> _qfit_mpverr{};
76  std::array<float, MbdDefs::BBC_N_PMT> _qfit_sigmaerr{};
77  std::array<float, MbdDefs::BBC_N_PMT> _qfit_chi2ndf{};
78 
79  // T0 offsets, time channels
80  std::array<float, MbdDefs::BBC_N_PMT> _ttfit_t0mean{};
81  std::array<float, MbdDefs::BBC_N_PMT> _ttfit_t0meanerr{};
82  std::array<float, MbdDefs::BBC_N_PMT> _ttfit_t0sigma{};
83  std::array<float, MbdDefs::BBC_N_PMT> _ttfit_t0sigmaerr{};
84 
85  // T0 offsets, charge channels
86  std::array<float, MbdDefs::BBC_N_PMT> _tqfit_t0mean{};
87  std::array<float, MbdDefs::BBC_N_PMT> _tqfit_t0meanerr{};
88  std::array<float, MbdDefs::BBC_N_PMT> _tqfit_t0sigma{};
89  std::array<float, MbdDefs::BBC_N_PMT> _tqfit_t0sigmaerr{};
90 
91  // Slew Correction
92  std::array<int, MbdDefs::BBC_N_FEECH> _slew_npts{}; // num points in template
93  std::array<float, MbdDefs::BBC_N_FEECH> _slew_minrange{}; // in template units (samples)
94  std::array<float, MbdDefs::BBC_N_FEECH> _slew_maxrange{}; // in template units (samples)
95  std::array<std::vector<float>, MbdDefs::BBC_N_FEECH> _slew_y{};
96 
97  // Peak of waveform
98  std::array<int, MbdDefs::BBC_N_FEECH> _sampmax{};
99 
100  // Waveform Template
102  std::array<int, MbdDefs::BBC_N_FEECH> _shape_npts{}; // num points in template
103  std::array<float, MbdDefs::BBC_N_FEECH> _shape_minrange{}; // in template units (samples)
104  std::array<float, MbdDefs::BBC_N_FEECH> _shape_maxrange{}; // in template units (samples)
105  std::array<std::vector<float>, MbdDefs::BBC_N_FEECH> _shape_y{};
106 
107  std::array<int, MbdDefs::BBC_N_FEECH> _sherr_npts{}; // num points in template
108  std::array<float, MbdDefs::BBC_N_FEECH> _sherr_minrange{}; // in template units (samples)
109  std::array<float, MbdDefs::BBC_N_FEECH> _sherr_maxrange{}; // in template units (samples)
110  std::array<std::vector<float>, MbdDefs::BBC_N_FEECH> _sherr_yerr{};
111 };
112 
113 #endif // MBD_MBDCALIB_H