Belle II Software  release-08-01-10
BKLMDigitAnalyzerModule.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 
9 #pragma once
10 
11 /* KLM headers. */
12 #include <klm/dataobjects/KLMDigit.h>
13 #include <klm/dataobjects/KLMDigitEventInfo.h>
14 #include <klm/dataobjects/KLMDigitRaw.h>
15 
16 /* Basf2 headers. */
17 #include <framework/core/Module.h>
18 #include <framework/datastore/StoreArray.h>
19 
20 /* ROOT headers. */
21 #include <TFile.h>
22 #include <TH1F.h>
23 #include <TH2F.h>
24 #include <TList.h>
25 #include <TTree.h>
26 
27 /* C++ headers. */
28 #include <sstream>
29 #include <string>
30 
31 namespace Belle2 {
44 
45  public:
46 
51 
55  ~BKLMDigitAnalyzerModule() override;
56 
60  void initialize() override;
61 
65  void beginRun() override;
66 
70  void event() override;
71 
75  void endRun() override;
76 
80  void terminate() override;
81 
82 
83  private:
84 
87 
90 
93 
96 
99 
101  std::string m_outputRootName;
102 
105 
107  TTree* m_extraInfo = nullptr;
108 
110  TList* m_histoList;
111 
114 
117 
119  TH1F* m_histoLayer[2][8];
120 
122  TH2F* m_histoChannel[2][8][2];
123 
125  TH2F* m_histoStrip[2][8][2];
126 
128  TH1F* m_histoTdc[2][8][2];
129 
131  TH1F* m_histoCTimeDiff[2][8][2];
132 
134  template <typename T>
135  std::string toString(T val)
136  {
137  std::ostringstream stream;
138  stream << val;
139  return stream.str();
140  }
141 
143  TH1F* createTH1(const char* name, const char* title, Int_t nBinsX, Double_t minX, Double_t maxX, const char* titleX,
144  const char* titleY, bool drawStat, TList* histoList = nullptr);
145 
147  TH2F* createTH2(const char* name, const char* title, Int_t nBinsX, Double_t minX, Double_t maxX, const char* titleX, Int_t nBinsY,
148  Double_t minY, Double_t maxY, const char* titleY, bool drawStat, TList* histoList = nullptr);
149  };
150 
152 }
Module useful to quickly analyze BKLM unpacked data.
int m_runNumber
Run number of the current data set.
TH2F * m_histoLayerVsSector[2]
Pointer to occupancy 2D histograms (numerator, denominator) of layer vs sector.
void initialize() override
Initializer.
void event() override
This method is called for each event.
void endRun() override
This method is called if the current run ends.
TFile * m_outputRootFile
Pointer to ROOT output file.
void terminate() override
This method is called at the end of the event processing.
StoreArray< KLMDigitEventInfo > m_digitEventInfo
Output data array of analyzed KLMDigit information.
TH2F * createTH2(const char *name, const char *title, Int_t nBinsX, Double_t minX, Double_t maxX, const char *titleX, Int_t nBinsY, Double_t minY, Double_t maxY, const char *titleY, bool drawStat, TList *histoList=nullptr)
Create a ROOT 2D histogram.
TH1F * m_histoLayer[2][8]
Pointer to occupancy 1D histogram of each layer for each sector.
StoreArray< KLMDigit > m_digitOutOfRange
Input BKLMDigits whose time is out of range.
TH1F * createTH1(const char *name, const char *title, Int_t nBinsX, Double_t minX, Double_t maxX, const char *titleX, const char *titleY, bool drawStat, TList *histoList=nullptr)
Create a ROOT 1D histogram.
void beginRun() override
Called when entering a new run.
StoreArray< KLMDigit > m_digit
Input KLMDigits.
~BKLMDigitAnalyzerModule() override
Destructor.
TH2F * m_histoChannel[2][8][2]
Pointer to occupancy 2D histogram of each channel.
TList * m_histoList
Pointer to ROOT list of histograms.
TH2F * m_histoLayerVsSectorPerPlane[2][2]
Pointer to occupancy 2D histogram of layer vs sector for each view (=plane)
TH1F * m_histoTdc[2][8][2]
Pointer to TDC 1D histogram of each channel for each sector and view.
TH2F * m_histoStrip[2][8][2]
Pointer to occupancy 2D histogram of each strip.
std::string toString(T val)
Convert a number of type T into a string.
std::string m_outputRootName
Output filename.
TH1F * m_histoCTimeDiff[2][8][2]
Pointer to TDC-difference 1D histogram of each channel for each sector and view.
TTree * m_extraInfo
Pointer to ROOT tree with extra info.
StoreArray< KLMDigitRaw > m_digitRaw
Input raw BLMDigits.
Base class for Modules.
Definition: Module.h:72
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
Abstract base class for different kinds of events.