File indexing completed on 2025-08-06 08:17:53
0001 #ifndef MICROMEGAS_MICROMEGASCOMBINEDDATAEVALUATION_H
0002 #define MICROMEGAS_MICROMEGASCOMBINEDDATAEVALUATION_H
0003
0004
0005
0006
0007
0008
0009 #include "MicromegasCalibrationData.h"
0010 #include "MicromegasMapping.h"
0011
0012 #include <fun4all/SubsysReco.h>
0013 #include <phool/PHObject.h>
0014
0015 #include <TTree.h>
0016
0017 #include <map>
0018 #include <memory>
0019 #include <string>
0020 #include <utility>
0021
0022 class PHCompositeNode;
0023 class TFile;
0024 class TH1;
0025 class TH2;
0026 class TProfile;
0027
0028
0029 class MicromegasCombinedDataEvaluation : public SubsysReco
0030 {
0031 public:
0032
0033 MicromegasCombinedDataEvaluation(const std::string& name = "MicromegasCombinedDataEvaluation");
0034
0035
0036 int Init(PHCompositeNode*) override;
0037
0038
0039 int InitRun(PHCompositeNode*) override;
0040
0041
0042 int process_event(PHCompositeNode*) override;
0043
0044
0045 int End(PHCompositeNode*) override;
0046
0047
0048 void set_calibration_file(const std::string& value) { m_calibration_filename = value; }
0049
0050
0051 void set_n_sigma(double value) { m_n_sigma = value; }
0052
0053
0054
0055 void set_min_adc(double value) { m_min_adc = value; }
0056
0057
0058 void set_sample_min(int value) { m_sample_min = value; }
0059
0060
0061 void set_sample_max(int value) { m_sample_max = value; }
0062
0063
0064 void set_evaluation_outputfile(const std::string& outputfile) { m_evaluation_filename = outputfile; }
0065
0066 class Sample
0067 {
0068 public:
0069
0070 unsigned int packet_id = 0;
0071
0072
0073 uint64_t lvl1_bco = 0;
0074
0075
0076 unsigned int fee_bco = 0;
0077
0078
0079 unsigned int checksum = 0;
0080 unsigned int checksum_error = 0;
0081
0082
0083 unsigned short fee_id = 0;
0084 unsigned short layer = 0;
0085 unsigned short tile = 0;
0086
0087
0088 unsigned short sampa_address = 0;
0089 unsigned short sampa_channel = 0;
0090
0091
0092 unsigned short channel = 0;
0093
0094
0095 unsigned short strip = 0;
0096
0097 unsigned short sample = 0;
0098 unsigned short adc = 0;
0099
0100 double pedestal = 0;
0101 double rms = 0;
0102
0103 using List = std::vector<Sample>;
0104 };
0105
0106
0107
0108
0109
0110 class Waveform
0111 {
0112 public:
0113
0114 unsigned int packet_id = 0;
0115
0116
0117 uint64_t lvl1_bco = 0;
0118
0119
0120 unsigned int fee_bco = 0;
0121
0122
0123 unsigned int checksum = 0;
0124 unsigned int checksum_error = 0;
0125
0126
0127 unsigned short fee_id = 0;
0128 unsigned short layer = 0;
0129 unsigned short tile = 0;
0130
0131
0132 unsigned short sampa_address = 0;
0133 unsigned short sampa_channel = 0;
0134
0135
0136 unsigned short channel = 0;
0137
0138
0139 unsigned short strip = 0;
0140
0141 unsigned short sample_max = 0;
0142 unsigned short adc_max = 0;
0143
0144 double pedestal = 0;
0145 double rms = 0;
0146
0147 bool is_signal = false;
0148
0149
0150 Waveform() = default;
0151
0152
0153 Waveform(const Sample& sample)
0154 {
0155 copy_from(sample);
0156 }
0157
0158
0159 void copy_from(const Sample&);
0160
0161 using List = std::vector<Waveform>;
0162 };
0163
0164 class Container : public PHObject
0165 {
0166 public:
0167 void Reset();
0168
0169
0170 std::vector<int> n_tagger;
0171
0172
0173 std::vector<int> n_waveform;
0174
0175 Waveform::List waveforms;
0176 Sample::List samples;
0177
0178
0179 std::vector<uint64_t> lvl1_bco_list;
0180
0181
0182 std::vector<uint32_t> lvl1_count_list;
0183
0184 ClassDef(Container, 1)
0185 };
0186
0187 private:
0188
0189 std::string m_rawhitnodename = "MICROMEGASRAWHIT";
0190
0191
0192 std::string m_calibration_filename = "TPOT_Pedestal_000.root";
0193
0194
0195 MicromegasCalibrationData m_calibration_data;
0196
0197
0198 MicromegasMapping m_mapping;
0199
0200
0201 double m_n_sigma = 5;
0202
0203
0204
0205 double m_min_adc = 50;
0206
0207
0208 int m_sample_min = 0;
0209
0210
0211 int m_sample_max = 100;
0212
0213
0214 std::string m_evaluation_filename = "MicromegasCombinedDataEvaluation.root";
0215 std::unique_ptr<TFile> m_evaluation_file;
0216
0217
0218 TTree* m_evaluation_tree = nullptr;
0219
0220
0221 Container* m_container = nullptr;
0222
0223
0224
0225 using bco_map_t = std::map<uint64_t, unsigned int>;
0226 bco_map_t m_bco_map;
0227 };
0228
0229 #endif