File indexing completed on 2025-08-03 08:21:08
0001 #ifndef TPOT_TPOTMON_H
0002 #define TPOT_TPOTMON_H
0003
0004 #include "MicromegasGeometry.h"
0005
0006 #include <micromegas/MicromegasDefs.h>
0007 #include <micromegas/MicromegasMapping.h>
0008 #include <micromegas/MicromegasCalibrationData.h>
0009 #include <onlmon/OnlMon.h>
0010
0011 #include <array>
0012 #include <memory>
0013
0014 class Event;
0015 class TH1;
0016 class TH2;
0017 class TH2Poly;
0018
0019 class TpotMon : public OnlMon
0020 {
0021 public:
0022
0023
0024 TpotMon(const std::string &name);
0025
0026
0027 ~TpotMon() override = default;
0028
0029 int process_event(Event *evt) override;
0030 int Init() override;
0031 int BeginRun(const int runno) override;
0032 int Reset() override;
0033
0034
0035 void set_calibration_file( const std::string& value )
0036 { m_calibration_filename = value; }
0037
0038
0039 void set_max_sample( int value )
0040 { m_max_sample = value; }
0041
0042
0043 void set_n_sigma( double value ) { m_n_sigma = value; }
0044
0045
0046 void set_min_adc( double value ) { m_min_adc = value; }
0047
0048
0049 using sample_window_t = std::pair<int, int>;
0050 void set_sample_window_signal( const sample_window_t& value )
0051 { m_sample_window_signal = value; }
0052
0053 private:
0054
0055
0056 void setup_detector_bins( TH2Poly* );
0057
0058
0059 void setup_resist_bins( TH2Poly*, MicromegasDefs::SegmentationType );
0060
0061
0062 int m_evtcnt = 0;
0063
0064
0065
0066
0067
0068
0069 double m_triggercnt = 0;
0070
0071
0072 MicromegasMapping m_mapping;
0073
0074
0075 MicromegasGeometry m_geometry;
0076
0077
0078 std::string m_calibration_filename;
0079
0080
0081 MicromegasCalibrationData m_calibration_data;
0082
0083
0084 int m_max_sample = 105;
0085
0086
0087 sample_window_t m_sample_window_signal = {3, 18};
0088
0089
0090 double m_n_sigma = 5;
0091
0092
0093 double m_min_adc = 50;
0094
0095
0096 TH1* m_counters = nullptr;
0097
0098
0099 TH2Poly* m_detector_multiplicity_z = nullptr;
0100 TH2Poly* m_detector_multiplicity_phi = nullptr;
0101
0102
0103 TH2Poly* m_detector_occupancy_z = nullptr;
0104 TH2Poly* m_detector_occupancy_phi = nullptr;
0105
0106
0107 TH2Poly* m_resist_multiplicity_z = nullptr;
0108 TH2Poly* m_resist_multiplicity_phi = nullptr;
0109
0110
0111 TH2Poly* m_resist_occupancy_z = nullptr;
0112 TH2Poly* m_resist_occupancy_phi = nullptr;
0113
0114
0115
0116 class detector_histograms_t
0117 {
0118 public:
0119
0120
0121 TH1* m_counts_sample = nullptr;
0122
0123
0124 TH2* m_adc_sample = nullptr;
0125
0126
0127 TH2* m_adc_channel = nullptr;
0128
0129
0130 TH2* m_sample_channel = nullptr;
0131
0132
0133 TH1* m_hit_charge = nullptr;
0134
0135
0136 TH1* m_hit_multiplicity = nullptr;
0137
0138
0139 TH1* m_wf_vs_channel = nullptr;
0140
0141
0142 TH1* m_hit_vs_channel = nullptr;
0143
0144
0145 TH1* m_heartbeat_vs_channel = nullptr;
0146
0147 };
0148
0149
0150
0151 std::map<int, MicromegasGeometry::point_t> m_tile_centers;
0152
0153
0154 std::map<int, detector_histograms_t> m_detector_histograms;
0155
0156 };
0157
0158 #endif