Belle II Software  release-05-02-19
TOPDQMModule.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Marko Staric, Dan Santel, Boqun Wang *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 // Module manager
12 #include <framework/core/HistoModule.h>
13 
14 // Own include
15 #include <top/modules/TOPDQM/TOPDQMModule.h>
16 #include <top/geometry/TOPGeometryPar.h>
17 
18 // framework - DataStore
19 #include <framework/datastore/StoreArray.h>
20 #include <framework/datastore/StoreObjPtr.h>
21 
22 // framework aux
23 #include <framework/gearbox/Unit.h>
24 #include <framework/gearbox/Const.h>
25 #include <framework/logging/Logger.h>
26 
27 // dataobject classes
28 #include <top/dataobjects/TOPDigit.h>
29 #include <top/dataobjects/TOPPull.h>
30 #include <top/dataobjects/TOPLikelihood.h>
31 #include <mdst/dataobjects/Track.h>
32 
33 // root
34 #include "TVector3.h"
35 #include "TDirectory.h"
36 
37 // boost
38 #include <boost/format.hpp>
39 
40 using namespace std;
41 using boost::format;
42 
43 namespace Belle2 {
49  using namespace TOP;
50 
51  //-----------------------------------------------------------------
52  // Register module
53  //-----------------------------------------------------------------
54 
55  REG_MODULE(TOPDQM)
56 
57  //-----------------------------------------------------------------
58  // Implementation
59  //-----------------------------------------------------------------
60 
62  {
63  // set module description (e.g. insert text)
64  setDescription("TOP DQM histogrammer");
65  setPropertyFlags(c_ParallelProcessingCertified);
66 
67  // Add parameters
68  addParam("histogramDirectoryName", m_histogramDirectoryName,
69  "histogram directory in ROOT file", string("TOP"));
70  addParam("momentumCut", m_momentumCut,
71  "momentum cut used to histogram pulls etc.", 2.0);
72  addParam("pValueCut", m_pValueCut,
73  "track p-value cut used to histogram pulls etc.", 0.001);
74  addParam("usePionID", m_usePionID,
75  "use pion ID from TOP to histogram pulls etc.", true);
76  addParam("cutNphot", m_cutNphot, "Cut on total number of photons", 3);
77  }
78 
79 
80  TOPDQMModule::~TOPDQMModule()
81  {
82  }
83 
84  void TOPDQMModule::defineHisto()
85  {
86  // Create a separate histogram directory and cd into it.
87  TDirectory* oldDir = gDirectory;
88  oldDir->mkdir(m_histogramDirectoryName.c_str())->cd();
89 
90  // variables needed for booking
91  const auto* geo = TOPGeometryPar::Instance()->getGeometry();
92  m_numModules = geo->getNumModules();
93  double bunchTimeSep = geo->getNominalTDC().getSyncTimeBase() / 24;
94 
95  m_BoolEvtMonitor = new TH1F("BoolEvtMonitor", "Event desynchronization monitoring",
96  2, -0.5, 1.5);
97  m_BoolEvtMonitor->GetXaxis()->SetTitle("good/bad event entries");
98 
99  m_recoTime = new TH1F("recoTime", "reco: time distribution",
100  500, 0, 50);
101  m_recoTime->GetXaxis()->SetTitle("time [ns]");
102 
103  m_recoTimeBg = new TH1F("recoTimeBg", "reco: time distribution (bkg)",
104  500, 0, 50);
105  m_recoTimeBg->GetXaxis()->SetTitle("time [ns]");
106 
107  m_recoTimeMinT0 = new TH1F("recoTimeMinT0", "reco: time in respect to first PDF peak",
108  200, -10, 10);
109  m_recoTimeMinT0->GetXaxis()->SetTitle("time [ns]");
110 
111  m_recoTimeDiff = new TH1F("recoTimeDiff", "reco: time resolution",
112  100, -1.0, 1.0);
113  m_recoTimeDiff->GetXaxis()->SetTitle("time residual [ns]");
114 
115  m_recoPull = new TH1F("recoPull", "reco: pulls",
116  100, -10, 10);
117  m_recoPull->GetXaxis()->SetTitle("pull");
118 
119  m_recoTimeDiff_Phic = new TH2F("recoTimeDiff_Phic",
120  "reco: time resolution vs. phiCer",
121  90, -180, 180, 100, -1.0, 1.0);
122  m_recoTimeDiff_Phic->GetXaxis()->SetTitle("Cerenkov azimuthal angle [deg]");
123  m_recoTimeDiff_Phic->GetYaxis()->SetTitle("time residuals [ns]");
124 
125  m_recoPull_Phic = new TProfile("recoPull_Phic",
126  "reco: pulls vs phiCer",
127  90, -180, 180, -10, 10, "S");
128  m_recoPull_Phic->GetXaxis()->SetTitle("Cerenkov azimuthal angle [deg]");
129  m_recoPull_Phic->GetYaxis()->SetTitle("pulls");
130 
131  // Histograms from TOPDataQualtiyOnline
132  m_goodHits = new TH1F("goodHits", "Number of good hits per bar", m_numModules, 0.5, m_numModules + 0.5);
133  m_badHits = new TH1F("badHits", "Number of bad hits per bar", m_numModules, 0.5, m_numModules + 0.5);
134  m_goodHits->SetOption("LIVE");
135  m_badHits->SetOption("LIVE");
136  m_goodHits->SetMinimum(0);
137  m_badHits->SetMinimum(0);
138 
139  m_goodHits->GetXaxis()->SetTitle("slot no.");
140  m_goodHits->GetYaxis()->SetTitle("hits / slot");
141  m_badHits->GetXaxis()->SetTitle("slot number");
142  m_badHits->GetYaxis()->SetTitle("hits / slot");
143 
144  // New histograms
145  m_window_vs_slot = new TH2F("window_vs_slot", "Distribution of hits: raw timing",
146  16, 0.5, 16.5, 512, 0, 512);
147  m_window_vs_slot->SetXTitle("slot number");
148  m_window_vs_slot->SetYTitle("window number w.r.t reference window");
149  m_window_vs_slot->SetOption("LIVE");
150  m_window_vs_slot->SetStats(kFALSE);
151 
152  m_bunchOffset = new TH1F("bunchOffset", "Reconstructed bunch: current offset",
153  100, -bunchTimeSep / 2, bunchTimeSep / 2);
154  m_bunchOffset->SetXTitle("offset [ns]");
155  m_bunchOffset->SetYTitle("events/bin");
156  m_bunchOffset->SetOption("LIVE");
157  m_bunchOffset->SetMinimum(0);
158 
159  m_time = new TH1F("goodHitTimes", "Time distribution of good hits",
160  1000, -20, 80);
161  m_time->SetXTitle("time [ns]");
162  m_time->SetYTitle("hits/bin");
163  m_time->SetOption("LIVE");
164  m_time->SetMinimum(0);
165 
166  int MaxEvents(1000);
167  m_goodHitsPerEventAll = new TH1F("goodHitsPerEventAll", "Number of good hits per event", MaxEvents, 0, MaxEvents);
168  m_badHitsPerEventAll = new TH1F("badHitsPerEventAll", "Number of bad hits per event", MaxEvents, 0, MaxEvents);
169  m_goodHitsPerEventAll->SetOption("LIVE");
170  m_badHitsPerEventAll->SetOption("LIVE");
171  m_goodHitsPerEventAll->SetMinimum(0);
172  m_badHitsPerEventAll->SetMinimum(0);
173  m_goodHitsPerEventAll->GetXaxis()->SetTitle("hits / event");
174  m_goodHitsPerEventAll->GetYaxis()->SetTitle("Events");
175  m_badHitsPerEventAll->GetXaxis()->SetTitle("hits / event");
176  m_badHitsPerEventAll->GetYaxis()->SetTitle("Events");
177 
178  int MaxRawTime(800);
179  int BinNumRT(400);
180  m_goodTDCAll = new TH1F("goodTDCAll", "Raw time distribution of good hits",
181  BinNumRT, 0, MaxRawTime);
182  m_goodTDCAll->SetXTitle("raw time [samples]");
183  m_goodTDCAll->SetYTitle("hits / sample");
184  m_goodTDCAll->SetOption("LIVE");
185  m_goodTDCAll->SetMinimum(0);
186 
187  m_badTDCAll = new TH1F("badTDCAll", "Raw time distribution of bad hits",
188  BinNumRT, 0, MaxRawTime);
189  m_badTDCAll->SetXTitle("raw time [samples]");
190  m_badTDCAll->SetYTitle("hits / sample");
191  m_badTDCAll->SetOption("LIVE");
192  m_badTDCAll->SetMinimum(0);
193 
194  m_goodHitsPerEventProf = new TProfile("goodHitsPerEventProf", "Good hits per event vs. slot number",
195  16, 0.5, 16.5, 0, MaxEvents);
196  m_goodHitsPerEventProf->SetXTitle("slot number");
197  m_goodHitsPerEventProf->SetYTitle("hits per event");
198  m_goodHitsPerEventProf->SetOption("LIVE");
199  m_goodHitsPerEventProf->SetStats(kFALSE);
200  m_goodHitsPerEventProf->SetMinimum(0);
201 
202  m_badHitsPerEventProf = new TProfile("badHitsPerEventProf", "Bad hits per event vs. slot number",
203  16, 0.5, 16.5, 0, MaxEvents);
204  m_badHitsPerEventProf->SetXTitle("slot number");
205  m_badHitsPerEventProf->SetYTitle("hits per event");
206  m_badHitsPerEventProf->SetOption("LIVE");
207  m_badHitsPerEventProf->SetStats(kFALSE);
208  m_badHitsPerEventProf->SetMinimum(0);
209 
210  m_TOPOccAfterInjLER = new TH1F("TOPOccInjLER", "TOPOccInjLER/Time;Time in #mus;Nhits/Time (#mus bins)", 4000, 0, 20000);
211  m_TOPOccAfterInjHER = new TH1F("TOPOccInjHER", "TOPOccInjHER/Time;Time in #mus;Nhits/Time (#mus bins)", 4000, 0, 20000);
212  m_TOPEOccAfterInjLER = new TH1F("TOPEOccInjLER", "TOPEOccInjLER/Time;Time in #mus;Triggers/Time (#mus bins)", 4000, 0, 20000);
213  m_TOPEOccAfterInjHER = new TH1F("TOPEOccInjHER", "TOPEOccInjHER/Time;Time in #mus;Triggers/Time (#mus bins)", 4000, 0, 20000);
214 
215  for (int i = 0; i < m_numModules; i++) {
216  int module = i + 1;
217  string name, title;
218  TH1F* h1 = 0;
219  TH2F* h2 = 0;
220  TProfile2D* h3 = 0;
221 
222  name = str(format("window_vs_asic_%1%") % (module));
223  title = str(format("Distribution of hits: raw timing for slot #%1%") % (module));
224  h2 = new TH2F(name.c_str(), title.c_str(), 64, 0, 64, 512, 0, 512);
225  h2->SetOption("LIVE");
226  h2->SetStats(kFALSE);
227  h2->SetXTitle("ASIC number");
228  h2->SetYTitle("window number w.r.t reference window");
229  h2->SetMinimum(0);
230  m_window_vs_asic.push_back(h2);
231 
232  name = str(format("good_hits_xy_%1%") % (module));
233  title = str(format("Number of good hits in x-y for slot #%1%") % (module));
234  h2 = new TH2F(name.c_str(), title.c_str(), 64, 0.5, 64.5, 8, 0.5, 8.5);
235  h2->SetOption("LIVE");
236  h2->SetStats(kFALSE);
237  h2->GetXaxis()->SetTitle("pixel column");
238  h2->GetYaxis()->SetTitle("pixel row");
239  h2->SetMinimum(0);
240  m_goodHitsXY.push_back(h2);
241 
242  name = str(format("bad_hits_xy_%1%") % (module));
243  title = str(format("Number of bad hits in x-y for slot #%1%") % (module));
244  h2 = new TH2F(name.c_str(), title.c_str(), 64, 0.5, 64.5, 8, 0.5, 8.5);
245  h2->SetOption("LIVE");
246  h2->SetStats(kFALSE);
247  h2->GetXaxis()->SetTitle("pixel column");
248  h2->GetYaxis()->SetTitle("pixel row");
249  h2->SetMinimum(0);
250  m_badHitsXY.push_back(h2);
251 
252  name = str(format("good_hits_asics_%1%") % (module));
253  title = str(format("Number of good hits for asics for slot #%1%") % (module));
254  h2 = new TH2F(name.c_str(), title.c_str(), 64, 0, 64, 8, 0, 8);
255  h2->SetOption("LIVE");
256  h2->SetStats(kFALSE);
257  h2->GetXaxis()->SetTitle("ASIC number");
258  h2->GetYaxis()->SetTitle("ASIC channel");
259  h2->SetMinimum(0);
260  m_goodHitsAsics.push_back(h2);
261 
262  name = str(format("bad_hits_asics_%1%") % (module));
263  title = str(format("Number of bad hits for asics for slot #%1%") % (module));
264  h2 = new TH2F(name.c_str(), title.c_str(), 64, 0, 64, 8, 0, 8);
265  h2->SetOption("LIVE");
266  h2->SetStats(kFALSE);
267  h2->GetXaxis()->SetTitle("ASIC number");
268  h2->GetYaxis()->SetTitle("ASIC channel");
269  h2->SetMinimum(0);
270  m_badHitsAsics.push_back(h2);
271 
272  name = str(format("good_TDC_%1%") % (module));
273  title = str(format("Raw time distribution of good hits for slot #%1%") % (module));
274  h1 = new TH1F(name.c_str(), title.c_str(), BinNumRT, 0, MaxRawTime);
275  h1->SetOption("LIVE");
276  h1->GetXaxis()->SetTitle("raw time [samples]");
277  h1->GetYaxis()->SetTitle("hits per sample");
278  h1->SetMinimum(0);
279  m_goodTdc.push_back(h1);
280 
281  name = str(format("bad_TDC_%1%") % (module));
282  title = str(format("Raw time distribution of bad hits for slot #%1%") % (module));
283  h1 = new TH1F(name.c_str(), title.c_str(), BinNumRT, 0, MaxRawTime);
284  h1->SetOption("LIVE");
285  h1->GetXaxis()->SetTitle("raw time [samples]");
286  h1->GetYaxis()->SetTitle("hits per sample");
287  h1->SetMinimum(0);
288  m_badTdc.push_back(h1);
289 
290  name = str(format("good_timing_%1%") % (module));
291  title = str(format("Timing distribution of good hits for slot #%1%") % (module));
292  h1 = new TH1F(name.c_str(), title.c_str(), 100, -20, 80);
293  h1->SetOption("LIVE");
294  h1->GetXaxis()->SetTitle("time [ns]");
295  h1->GetYaxis()->SetTitle("hits per time bin");
296  h1->SetMinimum(0);
297  m_goodTiming.push_back(h1);
298 
299  name = str(format("good_channel_hits_%1%") % (module));
300  title = str(format("Number of good hits by channel for slot #%1%") % (module));
301  int numPixels = geo->getModule(i + 1).getPMTArray().getNumPixels();
302  h1 = new TH1F(name.c_str(), title.c_str(), numPixels, 0, numPixels);
303  h1->SetOption("LIVE");
304  h1->GetXaxis()->SetTitle("channel number");
305  h1->GetYaxis()->SetTitle("hits pre channel");
306  h1->SetMinimum(0);
307  m_goodChannelHits.push_back(h1);
308 
309  name = str(format("bad_channel_hits_%1%") % (module));
310  title = str(format("Number of bad hits by channel for slot #%1%") % (module));
311  h1 = new TH1F(name.c_str(), title.c_str(), numPixels, 0, numPixels);
312  h1->SetOption("LIVE");
313  h1->GetXaxis()->SetTitle("channel number");
314  h1->GetYaxis()->SetTitle("hits pre channel");
315  h1->SetMinimum(0);
316  m_badChannelHits.push_back(h1);
317 
318  name = str(format("good_hits_per_event%1%") % (module));
319  title = str(format("Number of good hits per event for slot #%1%") % (module));
320  h1 = new TH1F(name.c_str(), title.c_str(), MaxEvents, 0, MaxEvents);
321  h1->SetOption("LIVE");
322  h1->GetXaxis()->SetTitle("hits / event");
323  h1->SetMinimum(0);
324  m_goodHitsPerEvent.push_back(h1);
325 
326  name = str(format("bad_hits_per_event%1%") % (module));
327  title = str(format("Number of bad hits per event for slot #%1%") % (module));
328  h1 = new TH1F(name.c_str(), title.c_str(), MaxEvents, 0, MaxEvents);
329  h1->SetOption("LIVE");
330  h1->GetXaxis()->SetTitle("hits / event");
331  h1->SetMinimum(0);
332  m_badHitsPerEvent.push_back(h1);
333 
334  name = str(format("good_hits_xy_track_%1%") % (module));
335  title = str(format("Hits per track, each channel, slot #%1%") % (module));
336  h3 = new TProfile2D(name.c_str(), title.c_str(), 64, 0.5, 64.5, 8, 0.5, 8.5, 0, 1000);
337  h3->SetOption("LIVE");
338  h3->SetStats(kFALSE);
339  h3->GetXaxis()->SetTitle("pixel column");
340  h3->GetYaxis()->SetTitle("pixel row");
341  h3->SetMinimum(0);
342  m_goodHitsXYTrack.push_back(h3);
343 
344  name = str(format("good_hits_xy_track_bkg_%1%") % (module));
345  title = str(format("Hits per bkg track, each channel, slot #%1%") % (module));
346  h3 = new TProfile2D(name.c_str(), title.c_str(), 64, 0.5, 64.5, 8, 0.5, 8.5, 0, 1000);
347  h3->SetOption("LIVE");
348  h3->SetStats(kFALSE);
349  h3->GetXaxis()->SetTitle("pixel column");
350  h3->GetYaxis()->SetTitle("pixel row");
351  h3->SetMinimum(0);
352  m_goodHitsXYTrackBkg.push_back(h3);
353  }
354 
355  // cd back to root directory
356  oldDir->cd();
357  }
358 
359  void TOPDQMModule::initialize()
360  {
361  // Register histograms (calls back defineHisto)
362  REG_HISTOGRAM;
363 
364  // register dataobjects
365  m_rawFTSW.isOptional();
366  m_digits.isRequired();
367  m_recBunch.isOptional();
368  m_tracks.isOptional();
369 
370  }
371 
372  void TOPDQMModule::beginRun()
373  {
374  m_BoolEvtMonitor->Reset();
375 
376  m_recoTimeDiff->Reset();
377  m_recoTimeDiff_Phic->Reset();
378  m_recoPull->Reset();
379  m_recoPull_Phic->Reset();
380  m_recoTime->Reset();
381  m_recoTimeBg->Reset();
382  m_recoTimeMinT0->Reset();
383 
384  m_goodHits->Reset();
385  m_badHits->Reset();
386  m_window_vs_slot->Reset();
387  m_bunchOffset->Reset();
388  m_time->Reset();
389  m_goodTDCAll->Reset();
390  m_badTDCAll->Reset();
391  m_goodHitsPerEventProf->Reset();
392  m_goodHitsPerEventAll->Reset();
393  m_badHitsPerEventProf->Reset();
394  m_badHitsPerEventAll->Reset();
395  m_TOPOccAfterInjLER->Reset();
396  m_TOPOccAfterInjHER->Reset();
397  m_TOPEOccAfterInjLER->Reset();
398  m_TOPEOccAfterInjHER->Reset();
399 
400  for (int i = 0; i < m_numModules; i++) {
401  m_window_vs_asic[i]->Reset();
402  m_goodHitsXY[i]->Reset();
403  m_badHitsXY[i]->Reset();
404  m_goodHitsAsics[i]->Reset();
405  m_badHitsAsics[i]->Reset();
406  m_goodTdc[i]->Reset();
407  m_badTdc[i]->Reset();
408  m_goodTiming[i]->Reset();
409  m_goodChannelHits[i]->Reset();
410  m_badChannelHits[i]->Reset();
411  m_goodHitsPerEvent[i]->Reset();
412  m_badHitsPerEvent[i]->Reset();
413  m_goodHitsXYTrack[i]->Reset();
414  m_goodHitsXYTrackBkg[i]->Reset();
415  }
416  }
417 
418  void TOPDQMModule::event()
419  {
420 
421  bool recBunchValid = false;
422  if (m_recBunch.isValid()) {
423  recBunchValid = m_recBunch->isReconstructed();
424  }
425 
426  if (recBunchValid) {
427  m_bunchOffset->Fill(m_recBunch->getCurrentOffset());
428  }
429 
430  std::vector<int> n_good(16, 0);
431  std::vector<int> n_bad(16, 0);
432  std::vector<int> n_good_first(16, 0);
433  std::vector<int> n_good_second(16, 0);
434  std::vector<int> n_good_pixel_hits(16 * 512, 0);
435 
436  int Ndigits = m_digits.getEntries();
437  if (Ndigits > 0) {
438  for (const auto& digit : m_digits) {
439  int x = digit.getFirstWindow() != m_digits[0]->getFirstWindow() ? 1 : 0 ;
440  m_BoolEvtMonitor->Fill(x);
441  }
442  }
443 
444  for (const auto& digit : m_digits) {
445  int i = digit.getModuleID() - 1;
446  if (i < 0 || i >= m_numModules) {
447  B2ERROR("Invalid module ID found in TOPDigits: ID = " << i + 1);
448  continue;
449  }
450 
451  int ch = digit.getChannel();
452  int asic_no = ch / 8, asic_ch = ch % 8;
453 
454  m_window_vs_slot->Fill(digit.getModuleID(), digit.getRawTime() / 64 + 220);
455  m_window_vs_asic[i]->Fill(digit.getChannel() / 8, digit.getRawTime() / 64 + 220);
456 
457  if (digit.getHitQuality() != TOPDigit::c_Junk) { // good hits
458  m_goodHits->Fill(i + 1);
459  m_goodHitsXY[i]->Fill(digit.getPixelCol(), digit.getPixelRow());
460  m_goodHitsAsics[i]->Fill(asic_no, asic_ch);
461  m_goodTdc[i]->Fill(digit.getRawTime());
462  m_goodTDCAll->Fill(digit.getRawTime());
463  if (recBunchValid) {
464  m_goodTiming[i]->Fill(digit.getTime());
465  m_time->Fill(digit.getTime());
466  }
467  m_goodChannelHits[i]->Fill(digit.getChannel());
468  if (digit.getTime() > 0 && digit.getTime() < 20) n_good_first[i]++;
469  if (digit.getTime() > 20 && digit.getTime() < 50) n_good_second[i]++;
470  n_good_pixel_hits[(digit.getModuleID() - 1) * 512 + (digit.getPixelID() - 1)]++;
471  n_good[i]++;
472  } else { // bad hits: FE not valid, pedestal jump, too short or too wide pulses
473  m_badHits->Fill(i + 1);
474  m_badHitsXY[i]->Fill(digit.getPixelCol(), digit.getPixelRow());
475  m_badHitsAsics[i]->Fill(asic_no, asic_ch);
476  m_badTdc[i]->Fill(digit.getRawTime());
477  m_badTDCAll->Fill(digit.getRawTime());
478  m_badChannelHits[i]->Fill(digit.getChannel());
479  n_bad[i]++;
480  }
481  }
482 
483  for (int i = 0; i < 16; i++) {
484  m_goodHitsPerEventProf->Fill(i + 1, n_good[i]);
485  m_badHitsPerEventProf->Fill(i + 1, n_bad[i]);
486  m_goodHitsPerEvent[i]->Fill(n_good[i]);
487  m_goodHitsPerEventAll->Fill(n_good[i]);
488  m_badHitsPerEvent[i]->Fill(n_bad[i]);
489  m_badHitsPerEventAll->Fill(n_bad[i]);
490 
491  bool slot_has_track = (n_good_first[i] + n_good_second[i]) > m_cutNphot;
492  for (int j = 0; j < 512; j++) {
493  int col = j % 64 + 1, row = j / 64 + 1;
494  if (slot_has_track)
495  m_goodHitsXYTrack[i]->Fill(col, row, n_good_pixel_hits[i * 512 + j]);
496  else
497  m_goodHitsXYTrackBkg[i]->Fill(col, row, n_good_pixel_hits[i * 512 + j]);
498  }
499  }
500 
501  for (const auto& track : m_tracks) {
502  const auto* trackFit = track.getTrackFitResultWithClosestMass(Const::pion);
503  if (!trackFit) continue;
504  if (trackFit->getMomentum().Mag() < m_momentumCut) continue;
505  if (trackFit->getPValue() < m_pValueCut) continue;
506  if (m_usePionID) {
507  const auto* top = track.getRelated<TOPLikelihood>();
508  if (!top) continue;
509  if (top->getLogL_pi() < top->getLogL_K()) continue;
510  if (top->getLogL_pi() < top->getLogL_p()) continue;
511  }
512 
513  const auto pulls = track.getRelationsWith<TOPPull>();
514  for (const auto& pull : pulls) {
515  if (pull.isSignal()) {
516  double phiCer = pull.getPhiCer() / Unit::deg;
517  m_recoTimeDiff->Fill(pull.getTimeDiff(), pull.getWeight());
518  m_recoTimeDiff_Phic->Fill(phiCer, pull.getTimeDiff(), pull.getWeight());
519  m_recoPull->Fill(pull.getPull(), pull.getWeight());
520  m_recoPull_Phic->Fill(phiCer, pull.getPull(), pull.getWeight());
521  } else {
522  m_recoTime->Fill(pull.getTime());
523  m_recoTimeBg->Fill(pull.getTime(), pull.getWeight());
524  m_recoTimeMinT0->Fill(pull.getTimeDiff());
525  }
526  }
527  }
528 
529  for (auto& it : m_rawFTSW) {
530  B2DEBUG(29, "TTD FTSW : " << hex << it.GetTTUtime(0) << " " << it.GetTTCtime(0) << " EvtNr " << it.GetEveNo(0) << " Type " <<
531  (it.GetTTCtimeTRGType(0) & 0xF) << " TimeSincePrev " << it.GetTimeSincePrevTrigger(0) << " TimeSinceInj " <<
532  it.GetTimeSinceLastInjection(0) << " IsHER " << it.GetIsHER(0) << " Bunch " << it.GetBunchNumber(0));
533  auto difference = it.GetTimeSinceLastInjection(0);
534  if (difference != 0x7FFFFFFF) {
535  unsigned int nentries = m_digits.getEntries();
536  float diff2 = difference / 127.; // 127MHz clock ticks to us, inexact rounding
537  if (it.GetIsHER(0)) {
538  m_TOPOccAfterInjHER->Fill(diff2, nentries);
539  m_TOPEOccAfterInjHER->Fill(diff2);
540  } else {
541  m_TOPOccAfterInjLER->Fill(diff2, nentries);
542  m_TOPEOccAfterInjLER->Fill(diff2);
543  }
544  }
545  }
546 
547  }
548 
549 
550  void TOPDQMModule::endRun()
551  {
552  }
553 
554  void TOPDQMModule::terminate()
555  {
556  }
557 
558 
560 } // end Belle2 namespace
561 
Belle2::TOPPull::getPhiCer
double getPhiCer() const
Return Cerenkov azimuthal angle.
Definition: TOPPull.h:95
REG_MODULE
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:652
Belle2::TOPDQMModule
TOP DQM histogrammer.
Definition: TOPDQMModule.h:49
Belle2::TOPPull
Class to store photon pull in respect to PDF used in reconstruction.
Definition: TOPPull.h:33
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TOPLikelihood
Class to store TOP log likelihoods (output of TOPReconstructor).
Definition: TOPLikelihood.h:37
Belle2::HistoModule
HistoModule.h is supposed to be used instead of Module.h for the modules with histogram definitions t...
Definition: HistoModule.h:29