Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MicromegasCombinedDataEvaluation.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file MicromegasCombinedDataEvaluation.h
1 #ifndef MICROMEGAS_MICROMEGASCOMBINEDDATAEVALUATION_H
2 #define MICROMEGAS_MICROMEGASCOMBINEDDATAEVALUATION_H
3 
10 #include "MicromegasMapping.h"
11 
12 #include <fun4all/SubsysReco.h>
13 #include <phool/PHObject.h>
14 
15 #include <TTree.h>
16 
17 #include <map>
18 #include <memory>
19 #include <string>
20 #include <utility>
21 
22 class PHCompositeNode;
23 class TFile;
24 class TH1;
25 class TH2;
26 class TProfile;
27 
30 {
31  public:
32 
34  MicromegasCombinedDataEvaluation( const std::string &name = "MicromegasCombinedDataEvaluation" );
35 
37  int Init(PHCompositeNode*) override;
38 
40  int InitRun(PHCompositeNode*) override;
41 
43  int process_event(PHCompositeNode*) override;
44 
46  int End(PHCompositeNode*) override;
47 
50 
52  void set_n_sigma( double value ) { m_n_sigma = value; }
53 
55 
56  void set_min_adc( double value ) { m_min_adc = value; }
57 
60 
63 
65  void set_evaluation_outputfile(const std::string &outputfile) {m_evaluation_filename = outputfile;}
66 
67  class Sample
68  {
69  public:
71  unsigned int packet_id = 0;
72 
74  uint64_t lvl1_bco = 0;
75 
77  unsigned int fee_bco = 0;
78 
80  unsigned int checksum = 0;
81  unsigned int checksum_error = 0;
82 
84  unsigned short fee_id = 0;
85  unsigned short layer = 0;
86  unsigned short tile = 0;
87 
89  unsigned short sampa_address = 0;
90  unsigned short sampa_channel = 0;
91 
93  unsigned short channel = 0;
94 
96  unsigned short strip = 0;
97 
98  unsigned short sample = 0;
99  unsigned short adc = 0;
100 
101  double pedestal = 0;
102  double rms = 0;
103 
104  using List = std::vector<Sample>;
105  };
106 
111  class Waveform
112  {
113  public:
115  unsigned int packet_id = 0;
116 
118  uint64_t lvl1_bco = 0;
119 
121  unsigned int fee_bco = 0;
122 
124  unsigned int checksum = 0;
125  unsigned int checksum_error = 0;
126 
128  unsigned short fee_id = 0;
129  unsigned short layer = 0;
130  unsigned short tile = 0;
131 
133  unsigned short sampa_address = 0;
134  unsigned short sampa_channel = 0;
135 
137  unsigned short channel = 0;
138 
140  unsigned short strip = 0;
141 
142  unsigned short sample_max = 0;
143  unsigned short adc_max = 0;
144 
145  double pedestal = 0;
146  double rms = 0;
147 
148  bool is_signal = false;
149 
151  Waveform() = default;
152 
154  Waveform( const Sample& sample )
155  { copy_from( sample ); }
156 
158  void copy_from( const Sample& );
159 
160  using List = std::vector<Waveform>;
161  };
162 
163 
164  class Container: public PHObject
165  {
166  public:
167  void Reset();
168 
169  // number of taggers for each packet
170  std::vector<int> n_tagger;
171 
172  // number of waveform for each packet
173  std::vector<int> n_waveform;
174 
177 
178  // bco for this event
179  std::vector<uint64_t> lvl1_bco_list;
180 
181  // lvl1 count for this event
182  std::vector<uint32_t> lvl1_count_list;
183 
184  ClassDef(Container,1)
185  };
186 
187  private:
188 
190  std::string m_rawhitnodename = "MICROMEGASRAWHIT";
191 
193  std::string m_calibration_filename = "TPOT_Pedestal_000.root";
194 
197 
200 
202  double m_n_sigma = 5;
203 
205  /* This removes faulty channels for which calibration has failed */
206  double m_min_adc = 50;
207 
209  int m_sample_min = 0;
210 
212  int m_sample_max = 100;
213 
215  std::string m_evaluation_filename = "MicromegasCombinedDataEvaluation.root";
216  std::unique_ptr<TFile> m_evaluation_file;
217 
219  TTree* m_evaluation_tree = nullptr;
220 
222  Container* m_container = nullptr;
223 
225 
226  using bco_map_t = std::map<uint64_t,unsigned int>;
228 
229 };
230 
231 #endif