Belle II Software  release-05-02-19
TOPInterimFENtupleModule.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2017 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Maeda Yosuke *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 
13 #include <framework/core/HistoModule.h>
14 
15 #include <TTree.h>
16 
17 namespace Belle2 {
29  class TOPInterimFENtupleModule : public HistoModule {
30 
31  public:
32 
37 
41  virtual ~TOPInterimFENtupleModule();
42 
47  virtual void initialize() override;
48 
53  virtual void beginRun() override;
54 
58  virtual void event() override;
59 
64  virtual void endRun() override;
65 
70  virtual void terminate() override;
71 
75  virtual void defineHisto() override;
76 
77  private:
78 
82  enum { c_NWindow = 4, c_NModule = 16, c_NSamplePerWindow = 64, c_NWaveformSample = 256,
83  c_NSampleTBC = 256, c_NPixelPerModule = 512, c_NWindowRingBuffer = 512,
84  c_NMaxHitPerChannel = 5, c_NMaxHitEvent = 5000, c_NTotalScrod = 64
85  };
86 
87  TTree* m_tree = 0;
88  unsigned m_calibrationChannel = 0;
89  bool m_saveWaveform = false;
90  bool m_useDoublePulse = true;
91  // float m_averageSamplingRate = 2.71394; /**< sampling rate with assumption of uniform interval in a unit of GHz */
93  600;
95  450;
98  float m_timePerWin = 23.581939;
99  int m_globalRefSlotNum =
100  1;
101  int m_globalRefAsicNum =
102  0;
104  int m_nHit = 0;
105  unsigned m_eventNumCopper[c_NModule] = {0};
106  unsigned m_ttuTime[c_NModule] = {0};
107  unsigned m_ttcTime[c_NModule] = {0};
108  short m_slotNum[c_NMaxHitEvent] = {0};
109  short m_pixelId[c_NMaxHitEvent] = {0};
110  short m_channelId[c_NMaxHitEvent] = {0};
111  bool m_isCalCh[c_NMaxHitEvent] = {0};
112  unsigned m_eventNum = 0;
113  short m_winNum[c_NMaxHitEvent] = {0};
114  short m_eventWinNum[c_NMaxHitEvent] = {0};
115  short m_trigWinNum[c_NMaxHitEvent] = {0};
116  short m_revo9Counter[c_NMaxHitEvent] = {0};
117  short m_winNumList[c_NMaxHitEvent][c_NWindow] = {0};
118  bool m_windowsInOrder[c_NMaxHitEvent] = {0};
119  unsigned char m_hitQuality[c_NMaxHitEvent] = {0};
120  bool m_isReallyJunk[c_NMaxHitEvent] = {0};
121  float m_time[c_NMaxHitEvent] = {0};
122  float m_rawTime[c_NMaxHitEvent] = {0};
123  float m_refTime[c_NMaxHitEvent] = {0};
125  0;
126  unsigned short m_sample[c_NMaxHitEvent] = {0};
127  float m_height[c_NMaxHitEvent] = {0};
128  float m_integral[c_NMaxHitEvent] = {0};
129  float m_width[c_NMaxHitEvent] = {0};
130  unsigned short m_peakSample[c_NMaxHitEvent] = {0};
131  char m_offlineFlag[c_NMaxHitEvent] = {0};
132  short m_nHitOfflineFE[c_NMaxHitEvent] = {0};
133  short m_waveformStartSample[c_NMaxHitEvent] = {0};
134  unsigned short m_nWaveformSample[c_NMaxHitEvent] = {0};
135  short m_waveform[c_NMaxHitEvent][c_NWaveformSample] = {0};
137  short m_nFEHeader = 0;
138  short m_nEmptyFEHeader = 0;
139  short m_nWaveform = 0;
140  unsigned m_errorFlag = 0;
142  unsigned m_eventErrorFlag = 0;
145  int m_nDebugInfo = 0;
146  unsigned short m_scrodCtime[c_NTotalScrod] = { 0 };
147  unsigned short m_phase[c_NTotalScrod] = { 0 };
148  unsigned short m_asicMask[c_NTotalScrod] = { 0 };
149  unsigned short m_eventQueuDepth[c_NTotalScrod] = { 0 };
150  unsigned short m_eventNumberByte[c_NTotalScrod] = { 0 };
159  void getReferenceTiming();
160 
161  };
162 
164 } //namespace Belle2
Belle2::TOPInterimFENtupleModule::~TOPInterimFENtupleModule
virtual ~TOPInterimFENtupleModule()
Destructor.
Definition: TOPInterimFENtupleModule.cc:73
Belle2::TOPInterimFENtupleModule::m_phase
unsigned short m_phase[c_NTotalScrod]
event phase
Definition: TOPInterimFENtupleModule.h:155
Belle2::TOPInterimFENtupleModule::m_tree
TTree * m_tree
ntuple
Definition: TOPInterimFENtupleModule.h:95
Belle2::TOPInterimFENtupleModule::m_calibrationPulseIntervalRange
float m_calibrationPulseIntervalRange
tolerable shift of DeltaT from its nominal before calibration in a unit of ns
Definition: TOPInterimFENtupleModule.h:105
Belle2::TOPInterimFENtupleModule::m_eventWinNum
short m_eventWinNum[c_NMaxHitEvent]
"m_firstWindow" in TOPDigit
Definition: TOPInterimFENtupleModule.h:122
Belle2::TOPInterimFENtupleModule::m_time
float m_time[c_NMaxHitEvent]
time in a unit of ns, defined as m_rawTime+64*m_winNum.
Definition: TOPInterimFENtupleModule.h:129
Belle2::TOPInterimFENtupleModule::m_eventNumCopper
unsigned m_eventNumCopper[c_NModule]
event number stored in COPPER
Definition: TOPInterimFENtupleModule.h:113
Belle2::TOPInterimFENtupleModule::m_rawTime
float m_rawTime[c_NMaxHitEvent]
"m_rawTime" [0-256] in new TOPDigit (update at May, 2017) in sample(time bin) unit
Definition: TOPInterimFENtupleModule.h:130
Belle2::TOPInterimFENtupleModule::m_useDoublePulse
bool m_useDoublePulse
set true when you require both of double calibration pulses for reference timing
Definition: TOPInterimFENtupleModule.h:98
Belle2::TOPInterimFENtupleModule::m_nWaveformSample
unsigned short m_nWaveformSample[c_NMaxHitEvent]
number of waveform samples
Definition: TOPInterimFENtupleModule.h:142
Belle2::TOPInterimFENtupleModule::m_globalRefSlotNum
int m_globalRefSlotNum
slot number used to define "global" reference timing (a single reference timing in an event for all t...
Definition: TOPInterimFENtupleModule.h:107
Belle2::TOPInterimFENtupleModule::m_isCalCh
bool m_isCalCh[c_NMaxHitEvent]
true if the hit is in the calibration channel
Definition: TOPInterimFENtupleModule.h:119
Belle2::TOPInterimFENtupleModule::event
virtual void event() override
Event processor.
Definition: TOPInterimFENtupleModule.cc:158
Belle2::TOPInterimFENtupleModule::m_nHitOfflineFE
short m_nHitOfflineFE[c_NMaxHitEvent]
number of hits for each pixel
Definition: TOPInterimFENtupleModule.h:140
Belle2::TOPInterimFENtupleModule::m_waveformStartSample
short m_waveformStartSample[c_NMaxHitEvent]
start sample number of waveform segment (only for production FW)
Definition: TOPInterimFENtupleModule.h:141
Belle2::TOPInterimFENtupleModule::terminate
virtual void terminate() override
Termination action.
Definition: TOPInterimFENtupleModule.cc:329
Belle2::TOPInterimFENtupleModule::TOPInterimFENtupleModule
TOPInterimFENtupleModule()
Constructor.
Definition: TOPInterimFENtupleModule.cc:42
Belle2::TOPInterimFENtupleModule::m_calibrationChannel
unsigned m_calibrationChannel
asic channel number where the calibration pulses are routed
Definition: TOPInterimFENtupleModule.h:96
Belle2::TOPInterimFENtupleModule::m_globalRefAsicNum
int m_globalRefAsicNum
asic number used to define "global" reference timing.
Definition: TOPInterimFENtupleModule.h:109
Belle2::TOPInterimFENtupleModule::m_hitQuality
unsigned char m_hitQuality[c_NMaxHitEvent]
"m_quality" in TOPDigit, =0:junk, =1:good, =2:charge sharing, =3:cross talk, =4:cal.
Definition: TOPInterimFENtupleModule.h:127
Belle2::TOPInterimFENtupleModule::m_sample
unsigned short m_sample[c_NMaxHitEvent]
(m_rawTDC+m_winNum*64)%256, for time base correction
Definition: TOPInterimFENtupleModule.h:134
Belle2::TOPInterimFENtupleModule::m_nFEHeader
short m_nFEHeader
m_FEHeaders in TOPInterimFEInfo, the total # of FE headers found
Definition: TOPInterimFENtupleModule.h:145
Belle2::TOPInterimFENtupleModule::m_saveWaveform
bool m_saveWaveform
set true when you want to save waveform data
Definition: TOPInterimFENtupleModule.h:97
Belle2::TOPInterimFENtupleModule::m_waveform
short m_waveform[c_NMaxHitEvent][c_NWaveformSample]
waveform from TOPRawWaveform, if not exist, filled with -32767
Definition: TOPInterimFENtupleModule.h:143
Belle2::TOPInterimFENtupleModule::m_revo9Counter
short m_revo9Counter[c_NMaxHitEvent]
"m_revo9Counter" in TOPRawDigit
Definition: TOPInterimFENtupleModule.h:124
Belle2::TOPInterimFENtupleModule::m_nHit
int m_nHit
number of hits for the event
Definition: TOPInterimFENtupleModule.h:112
Belle2::TOPInterimFENtupleModule::m_height
float m_height[c_NMaxHitEvent]
"m_pulseHeight" in new TOPDigit (update at May, 2017)
Definition: TOPInterimFENtupleModule.h:135
Belle2::TOPInterimFENtupleModule::beginRun
virtual void beginRun() override
Called when entering a new run.
Definition: TOPInterimFENtupleModule.cc:154
Belle2::TOPInterimFENtupleModule::m_nEmptyFEHeader
short m_nEmptyFEHeader
m_emptyFEHeaders in TOPInterimFEInfo, the total # of empty FE headers
Definition: TOPInterimFENtupleModule.h:146
Belle2::TOPInterimFENtupleModule::m_errorFlag
unsigned m_errorFlag
m_errorFlags in TOPInterimFEInfo, defined in the TOPInterimFEInfo.h
Definition: TOPInterimFENtupleModule.h:148
Belle2::TOPInterimFENtupleModule::m_timePerWin
float m_timePerWin
time interval of onw window (=64 samples) [ns]
Definition: TOPInterimFENtupleModule.h:106
Belle2::TOPInterimFENtupleModule::m_calibrationPulseThreshold1
float m_calibrationPulseThreshold1
minimum pulse height for the first calibration pulse to be qualified as calibration signals
Definition: TOPInterimFENtupleModule.h:100
Belle2::TOPInterimFENtupleModule::m_nDebugInfo
int m_nDebugInfo
number of ProductionEventDebug (in a unit of number of boardstack)
Definition: TOPInterimFENtupleModule.h:153
Belle2::TOPInterimFENtupleModule::endRun
virtual void endRun() override
End-of-run action.
Definition: TOPInterimFENtupleModule.cc:325
Belle2::TOPInterimFENtupleModule::m_asicMask
unsigned short m_asicMask[c_NTotalScrod]
asic mask bit pattern
Definition: TOPInterimFENtupleModule.h:156
Belle2::TOPInterimFENtupleModule::getReferenceTiming
void getReferenceTiming()
Find reference timing.
Definition: TOPInterimFENtupleModule.cc:333
Belle2::TOPInterimFENtupleModule::m_integral
float m_integral[c_NMaxHitEvent]
"m_integral" in TOPDigit, but not available
Definition: TOPInterimFENtupleModule.h:136
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TOPInterimFENtupleModule::m_eventQueuDepth
unsigned short m_eventQueuDepth[c_NTotalScrod]
trigger FIRO queue depth
Definition: TOPInterimFENtupleModule.h:157
Belle2::TOPInterimFENtupleModule::m_peakSample
unsigned short m_peakSample[c_NMaxHitEvent]
sample number for peak
Definition: TOPInterimFENtupleModule.h:138
Belle2::TOPInterimFENtupleModule::m_calibrationPulseInterval
float m_calibrationPulseInterval
nominal DeltaT value (time interval of two calibration signals) in a unit of ns
Definition: TOPInterimFENtupleModule.h:104
Belle2::TOPInterimFENtupleModule::m_windowsInOrder
bool m_windowsInOrder[c_NMaxHitEvent]
"areWindowsInOrder()" ; false if the window number of all (4) windows taken from TOPRawWaveform::getR...
Definition: TOPInterimFENtupleModule.h:126
Belle2::TOPInterimFENtupleModule::m_eventNum
unsigned m_eventNum
event number taken from EventMetaData
Definition: TOPInterimFENtupleModule.h:120
Belle2::TOPInterimFENtupleModule::m_globalRefTime
float m_globalRefTime
refTime of the specific asic, which is specified by parameters "globalRefSlotNum" and "globalRefAsicN...
Definition: TOPInterimFENtupleModule.h:132
Belle2::TOPInterimFENtupleModule::m_nWaveform
short m_nWaveform
m_waveforms in TOPInterimFEInfo, # of waveformes
Definition: TOPInterimFENtupleModule.h:147
Belle2::TOPInterimFENtupleModule::m_eventNumberByte
unsigned short m_eventNumberByte[c_NTotalScrod]
least significant byte of FE event number
Definition: TOPInterimFENtupleModule.h:158
Belle2::TOPInterimFENtupleModule::m_ttcTime
unsigned m_ttcTime[c_NModule]
counter for TTclock, stored in COPPER
Definition: TOPInterimFENtupleModule.h:115
Belle2::TOPInterimFENtupleModule::initialize
virtual void initialize() override
Initialize the Module.
Definition: TOPInterimFENtupleModule.cc:75
Belle2::TOPInterimFENtupleModule::defineHisto
virtual void defineHisto() override
Module funcions to define histograms.
Definition: TOPInterimFENtupleModule.cc:93
Belle2::TOPInterimFENtupleModule::m_pixelId
short m_pixelId[c_NMaxHitEvent]
"m_pixelID" in TOPDigit
Definition: TOPInterimFENtupleModule.h:117
Belle2::TOPInterimFENtupleModule::m_slotNum
short m_slotNum[c_NMaxHitEvent]
"m_moduleID" in TOPDigit, slot number
Definition: TOPInterimFENtupleModule.h:116
Belle2::TOPInterimFENtupleModule::m_isReallyJunk
bool m_isReallyJunk[c_NMaxHitEvent]
true if pedestal jump or other invalid hit is detected, not saved
Definition: TOPInterimFENtupleModule.h:128
Belle2::TOPInterimFENtupleModule::m_width
float m_width[c_NMaxHitEvent]
"m_pulseWidth" in TOPDigit, full width at half maximum of the pulse, converted into unit of samples f...
Definition: TOPInterimFENtupleModule.h:137
Belle2::TOPInterimFENtupleModule::m_winNumList
short m_winNumList[c_NMaxHitEvent][c_NWindow]
list of window numbers for recorded waveform, valid only when waveform analysis is enabled
Definition: TOPInterimFENtupleModule.h:125
Belle2::TOPInterimFENtupleModule::m_refTime
float m_refTime[c_NMaxHitEvent]
time of the first calibration signal as reference timing.
Definition: TOPInterimFENtupleModule.h:131
Belle2::TOPInterimFENtupleModule::m_calibrationPulseThreshold2
float m_calibrationPulseThreshold2
minimum pulse height for the secon calibration pulse to be qualified as calibration signals
Definition: TOPInterimFENtupleModule.h:102
Belle2::TOPInterimFENtupleModule::m_eventErrorFlag
unsigned m_eventErrorFlag
m_errorFlags in EventMetaData, 0x1 : CRC error
Definition: TOPInterimFENtupleModule.h:150
Belle2::TOPInterimFENtupleModule::m_channelId
short m_channelId[c_NMaxHitEvent]
"m_channel" in TOPDigit
Definition: TOPInterimFENtupleModule.h:118
Belle2::TOPInterimFENtupleModule::m_ttuTime
unsigned m_ttuTime[c_NModule]
counter for TTclock, stored in COPPER
Definition: TOPInterimFENtupleModule.h:114
Belle2::TOPInterimFENtupleModule::m_winNum
short m_winNum[c_NMaxHitEvent]
"m_window" in TOPRawDigit
Definition: TOPInterimFENtupleModule.h:121
Belle2::TOPInterimFENtupleModule::m_scrodCtime
unsigned short m_scrodCtime[c_NTotalScrod]
ctime recorded in scrod header
Definition: TOPInterimFENtupleModule.h:154
Belle2::TOPInterimFENtupleModule::m_trigWinNum
short m_trigWinNum[c_NMaxHitEvent]
"m_lastWriteAddr" in TOPRawDigit, window # when trigger is issued
Definition: TOPInterimFENtupleModule.h:123
Belle2::TOPInterimFENtupleModule::m_offlineFlag
char m_offlineFlag[c_NMaxHitEvent]
=-1 if the channel does not have waveform information, =0 when the hit comes from online FE,...
Definition: TOPInterimFENtupleModule.h:139