Belle II Software  release-08-01-10
TRGGDLDQMModule.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 #ifndef TRCGDLDQMMODULE_h
9 #define TRCGDLDQMMODULE_h
10 
11 #include <framework/core/HistoModule.h>
12 #include <trg/gdl/dataobjects/TRGGDLUnpackerStore.h>
13 #include <trg/gdl/modules/trggdlUnpacker/trggdlUnpackerModule.h>
14 #include <trg/gdl/TrgBit.h>
15 #include <framework/database/DBObjPtr.h>
16 #include <trg/gdl/dbobjects/TRGGDLDBUnpacker.h>
17 #include <mdst/dbobjects/TRGGDLDBInputBits.h>
18 #include <mdst/dbobjects/TRGGDLDBFTDLBits.h>
19 #include <string>
20 
21 #include <TH2I.h>
22 #include <TH1I.h>
23 #include "trg/ecl/TrgEclMapping.h"
24 #include <ecl/dataobjects/ECLDigit.h>
25 #include <ecl/dataobjects/ECLCalDigit.h>
26 #include <mdst/dataobjects/SoftwareTriggerResult.h>
27 #include <mdst/dataobjects/Track.h>
28 #include <mdst/dataobjects/HitPatternCDC.h>
29 #include <mdst/dataobjects/ECLCluster.h>
30 #include "trg/ecl/dataobjects/TRGECLCluster.h"
31 
32 
33 namespace Belle2 {
40  class TRGGDLDQMModule : public HistoModule {
41 
42  public:
46  virtual ~TRGGDLDQMModule() {}
47 
48  public:
50  virtual void initialize() override;
52  virtual void beginRun() override;
54  virtual void event() override;
56  virtual void endRun() override;
58  virtual void terminate() override {}
60  virtual void defineHisto() override;
61 
62  protected:
63  //number of skims
64  static const int nskim_gdldqm = 11;
65  int start_skim_gdldqm = 0;
66  int end_skim_gdldqm = 0;
67  int m_skim = -1;
68 
70  TH1I* h_c8_gdlL1TocomL1[nskim_gdldqm] = {nullptr};
72  TH1I* h_c8_topTogdlL1[nskim_gdldqm] = {nullptr};
74  TH1I* h_c8_eclTogdlL1[nskim_gdldqm] = {nullptr};
76  TH1I* h_c8_cdcTogdlL1[nskim_gdldqm] = {nullptr};
78  TH1I* h_c8_ecl8mToGDL[nskim_gdldqm] = {nullptr};
80  TH1I* h_c8_topToGDL[nskim_gdldqm] = {nullptr};
82  TH1I* h_c8_eclToGDL[nskim_gdldqm] = {nullptr};
84  TH1I* h_c8_cdcToGDL[nskim_gdldqm] = {nullptr};
86  TH1I* h_c2_cdcTocomL1[nskim_gdldqm] = {nullptr};
88  TH1D* h_ns_cdcTocomL1[nskim_gdldqm] = {nullptr};
90  TH1D* h_ns_cdcTogdlL1[nskim_gdldqm] = {nullptr};
92  TH1D* h_ns_topToecl[nskim_gdldqm] = {nullptr};
94  TH1D* h_ns_topTocdc[nskim_gdldqm] = {nullptr};
96  TH1I* h_c2_cdcToecl[nskim_gdldqm] = {nullptr};
98  TH1D* h_ns_cdcToecl[nskim_gdldqm] = {nullptr};
99 
101  // TH1I* h_inp;
102  // TH1I* h_inp_rise[N_BITS_RESERVED][nskim_gdldqm];
103  // TH1I* h_inp_fall[N_BITS_RESERVED][nskim_gdldqm];
105  TH1I* h_itd[nskim_gdldqm] = {nullptr};
106  TH1I* h_itd_rise[N_BITS_RESERVED][nskim_gdldqm] = {{nullptr}};
107  TH1I* h_itd_fall[N_BITS_RESERVED][nskim_gdldqm] = {{nullptr}};
109  TH1I* h_ftd[nskim_gdldqm] = {nullptr};
110  TH1I* h_ftd_rise[N_BITS_RESERVED][nskim_gdldqm] = {{nullptr}};
111  TH1I* h_ftd_fall[N_BITS_RESERVED][nskim_gdldqm] = {{nullptr}};
113  TH1I* h_psn[nskim_gdldqm] = {nullptr};
114  TH1I* h_psn_rise[N_BITS_RESERVED][nskim_gdldqm] = {{nullptr}};
115  TH1I* h_psn_fall[N_BITS_RESERVED][nskim_gdldqm] = {{nullptr}};
116  TH1I* h_psn_extra[nskim_gdldqm] = {nullptr};
117  TH1I* h_psn_extra_fast[nskim_gdldqm] = {nullptr};
118  TH1I* h_psn_effect_to_l1[nskim_gdldqm] = {nullptr};
119  TH1I* h_psn_raw_rate[nskim_gdldqm] = {nullptr};
120  TH1I* h_psn_pure_extra[nskim_gdldqm] = {nullptr};
122  TH1I* h_timtype[nskim_gdldqm] = {nullptr};
123  std::vector<int> h_0_vec;
125  std::vector<int> h_p_vec;
127  std::vector<int> h_f_vec;
129  std::vector<int> h_i_vec;
130 
131  TDirectory* oldDir = nullptr;
132  TDirectory* dirDQM = nullptr;
133 
134  bool m_eventByEventTimingHistRecord;
135  bool m_dumpVcdFile;
136  bool m_bitNameOnBinLabel;
137  bool m_generatePostscript;
138  unsigned m_vcdEventStart = 0;
139  unsigned m_vcdNumberOfEvents = 0;
140  std::string m_bitConditionToDumpVcd;
141  std::string m_postScriptName;
142  void fillRiseFallTimings(void);
143  void fillOutputExtra(void);
144  void fillOutputOverlap(void);
145  void fillOutputPureExtra(void);
146 
147  void genVcd(void);
148  bool anaBitCondition(void);
149  bool isFired(std::string bitname);
150  bool isFired_quick(const std::string& bitname, const bool& isPsnm);
151  int getinbitnum(const char* c) const;
152  int getoutbitnum(const char* c) const;
153  unsigned n_clocks = 0;
154  unsigned evtno = 0;
155  unsigned _exp = 0;
156  unsigned _run = 0;
157  std::vector<int> skim;
158 
159  static const int n_output_extra = 105;
160  static const char* output_extra[n_output_extra];
161  static const int n_output_overlap = 130;
162  static const char* output_overlap[n_output_overlap];
163  static const int n_output_pure_extra = 13;
164  static const char* output_pure_extra[n_output_pure_extra];
165  static const int nsample_fast = 500; //number of sample for fast efficiency monitor
166  int array_psn_extra_fast[nskim_gdldqm][nsample_fast][n_output_extra] = {{{0}}}; //array to store past nsample events
167 
168  //condition database for unpacker
169  DBObjPtr<TRGGDLDBUnpacker> m_unpacker;
170  int LeafBitMap[320] = {0};
171  char LeafNames[320][100] = {{0}};
172  int _e_timtype = 0;
173  int _e_gdll1rvc = 0;
174  int _e_coml1rvc = 0;
175  int _e_toptiming = 0;
176  int _e_ecltiming = 0;
177  int _e_cdctiming = 0;
178  int _e_toprvc = 0;
179  int _e_eclrvc = 0;
180  int _e_cdcrvc = 0;
181  int ee_psn[10] = {0};
182  int ee_ftd[10] = {0};
183  int ee_itd[10] = {0};
184  int n_leafs = 0;
185  int n_leafsExtra = 0;
186  int nconf = 0;
187  int nword_input = 0;
188  int nword_output = 0;
189 
190  //condition database for input bits
191  DBObjPtr<TRGGDLDBInputBits>m_dbinput;
192  unsigned n_inbit = 0;
193  char inbitname[320][100] = {""};
194 
195  //condition database for output bits
196  DBObjPtr<TRGGDLDBFTDLBits> m_dbftdl;
197  unsigned n_outbit = 0;
198  char outbitname[320][100] = {""};
199 
200 
201  //name of skim from hlt/softwaretrigger/scripts/softwaretrigger/db_access.py
202  std::string skim_menu[nskim_gdldqm] = {
203  "all",
204  "software_trigger_cut&skim&accept_hadron",
205  "software_trigger_cut&skim&accept_tau_tau",
206  "software_trigger_cut&skim&accept_mumu_1trk",
207  "software_trigger_cut&skim&accept_mumu_2trk",
208  "software_trigger_cut&skim&accept_gamma_gamma",
209  "software_trigger_cut&skim&accept_bhabha",
210  "software_trigger_cut&skim&accept_hadronb",
211  "software_trigger_cut&skim&accept_hadronb1",
212  "software_trigger_cut&skim&accept_hadronb2",
213  "software_trigger_cut&skim&accept_mumutight"
214  };
215 
216  //name of histgrams
217  std::string skim_smap[nskim_gdldqm] = {
218  "all",
219  "hadron",
220  "tautau",
221  "mumu1trk",
222  "mumu2trk",
223  "gammagamma",
224  "bhabha",
225  "hadronb",
226  "hadronb1",
227  "hadronb2",
228  "mumutight"
229  };
230 
231  private:
232 
233  //ecltrg<->ecl mappint
234  TrgEclMapping* trgeclmap = nullptr;
235 
236  //Input store array of GDL data
237  StoreArray<TRGGDLUnpackerStore> entAry;
238 
239  //Input store array of metadata
240  StoreObjPtr<EventMetaData> bevt;
241 
242  //Input store array of HLT
243  StoreObjPtr<SoftwareTriggerResult> result_soft;
244 
245  //Input store array of track
246  StoreArray<Track> Tracks;
247 
248  //Input store array of ECL
249  //StoreArray<ECLCluster> ECLClusters;
250  StoreArray<ECLCalDigit> m_ECLCalDigitData;
251  StoreArray<ECLDigit> m_ECLDigitData;
252 
253  };
254 
256 }
257 
258 #endif
HistoModule.h is supposed to be used instead of Module.h for the modules with histogram definitions t...
Definition: HistoModule.h:29
virtual ~TRGGDLDQMModule()
Destrunctor.
TH1I * h_c8_cdcTogdlL1[nskim_gdldqm]
timestamp diff from t0(cdc) to gdlL1 in LSB8nsec
TH1I * h_c8_eclTogdlL1[nskim_gdldqm]
timestamp diff from t0(ecl) to gdlL1 in LSB8nsec
virtual void terminate() override
terminate
TH1I * h_c8_topTogdlL1[nskim_gdldqm]
timestamp diff from t0(top) to gdlL1 in LSB8nsec
virtual void initialize() override
initialize
TH1I * h_c8_eclToGDL[nskim_gdldqm]
timestamp diff from t0(ecl) to GDL in LSB8nsec
virtual void event() override
Event.
TH1D * h_ns_topTocdc[nskim_gdldqm]
timestamp diff from top_timing to cdc_timing in nsec
TH1I * h_ftd[nskim_gdldqm]
ftd bits
virtual void endRun() override
End Run.
TH1D * h_ns_cdcToecl[nskim_gdldqm]
timestamp diff from cdc_timing to ecl_timing in nsec
TH1I * h_c8_ecl8mToGDL[nskim_gdldqm]
timestamp diff from fit on fam to GDL in LSB8nsec
TH1I * h_c2_cdcToecl[nskim_gdldqm]
timestamp from cdc_timing to ecl_timing to L1 in LSB2nsec
TH1I * h_c8_gdlL1TocomL1[nskim_gdldqm]
timestamp diff from gdlL1 to comL1 in LSB8nsec
TH1D * h_ns_cdcTocomL1[nskim_gdldqm]
timestamp diff from cdc_timing to comL1 in nsec
virtual void beginRun() override
begin Run
TH1I * h_c2_cdcTocomL1[nskim_gdldqm]
timestamp diff from cdc_timing to comL1 in LSB2nsec
TH1I * h_c8_topToGDL[nskim_gdldqm]
timestamp diff from t0(top) to GDL in LSB8nsec
TH1I * h_psn[nskim_gdldqm]
psn bits
TH1D * h_ns_topToecl[nskim_gdldqm]
timestamp diff from top_timing to ecl_timing in nsec
TH1I * h_itd[nskim_gdldqm]
input bits
TH1D * h_ns_cdcTogdlL1[nskim_gdldqm]
timestamp diff from cdc_timing to gdlL1 in nsec
TH1I * h_timtype[nskim_gdldqm]
timtype
TH1I * h_c8_cdcToGDL[nskim_gdldqm]
timestamp diff from t0(cdc) to GDL in LSB8nsec
virtual void defineHisto() override
Define Histogram.
Abstract base class for different kinds of events.