Belle II Software development
eclLOMModule.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/* Basf2 headers. */
12#include <framework/datastore/StoreArray.h>
13#include <framework/core/Module.h>
14#include <mdst/dataobjects/MCParticle.h>
15#include <trg/ecl/dataobjects/TRGECLWaveform.h>
16
17/* ROOT headers. */
18#include <TTree.h>
19#include <TFile.h>
20#include <TH1D.h>
21#include <TH2D.h>
22
23namespace Belle2 {
28 namespace ECL {
29
33 class ECLLOMModule : public Module {
34 public:
35
38
40 virtual ~ECLLOMModule() override;
41
43 virtual void initialize() override;
44
46 virtual void event() override;
47
49 virtual void terminate() override;
50
51 protected:
52
53 private:
54
58 void get_MCparticles();
59
64 void get_waveforms();
65
73
76
78 bool calculate_BE_quality(int iSample);
79
81 bool calculate_FE_quality(int iSample);
82
87 void calculate_coincidence(int iSample);
88
90 void clear_lom_data();
91
92 //module parameters
93 std::string m_testFileName;
94 double m_thresholdFE = 0.0;
95 double m_thresholdBE = 0.0;
96 double m_thresholdBkg = 0.0;
97 double m_discrTime = 0.0;
98 bool m_includeInnerFE = false;
99 bool m_saveSignal = false;
100
101 //input data
103 double m_BE_Waveform_100ns[16][64] = {};
104 double m_FE_Waveform_100ns[16][64] = {};
105 double m_mcen[2] = {};
106 double m_mcth[2] = {};
107 double m_mcph[2] = {};
108 double m_com_en[2] = {};
109 double m_com_th[2] = {};
110 double m_com_ph[2] = {};
111
114
117
118 //important output
119 bool m_isBhabha = false;
120
121 int m_BhNum = 0;
122 double m_BE_Amplitude[16] = {};
123 double m_FE_Amplitude[16] = {};
124 double m_BESum_Amplitude[16] = {};
125 double m_FESum_Amplitude[16] = {};
126 double m_BE_Pedal[16] = {};
127 double m_FE_Pedal[16] = {};
128 double m_FESum_MaxAmp = 0.0;
129 double m_BESum_MaxAmp = 0.0;
132
133 //validation output
134 TH2D* m_h2Coin = nullptr;
136 nullptr;
137 TH2D* m_h2FEAmp = nullptr;
138 TH2D* m_h2BEAmp = nullptr;
140 nullptr;
142 nullptr;
143
144 //internal variables
145 TFile* m_testfile = nullptr;
146 TTree* m_testtree = nullptr;
147 int m_NSamples = 0;
148 double m_BE_Waveform_10ns[16][631] = {};
149 double m_FE_Waveform_10ns[16][631] = {};
150 double m_BESum_Waveform_10ns[16][631] = {};
151 double m_FESum_Waveform_10ns[16][631] = {};
152 bool m_FESum_Discr[16][631] = {};
153 bool m_BESum_Discr[16][631] = {};
154 bool m_FEQual_Discr[16][631] = {};
155 bool m_BEQual_Discr[16][631] = {};
156 bool m_isBhabhaPatternFE = false;
157 bool m_isBhabhaPatternBE = false;
158 int m_CoincidenceMatrix[16][16] = {};
159 int m_SumCoincidenceMatrix[16][16] = {};
160 int m_CoincidenceCounterMatrix[16][16] = {};
162 };
163 }//namespace ECL
165}//namespace Belle2
bool m_isBhabhaPatternBE
Quality signal for Backward endcap.
double m_FESum_MaxAmp
Maximum running sum amplitude in an event for Forward endcap.
int m_BESum_MaxId
Id of a sector with maximum amplitude in Backward endcap.
int m_BhNum
Number of Bha-bha signals in an event.
TH2D * m_h2BEAmp
Store sectors amplitudes for Backward endcap over all events.
TH2D * m_h2FEAmp
Store sectors amplitudes for Forward endcap over all events.
TH2D * m_h2SumCoin
Store number of coincedencies in running sums for i:j sectors (Forward:Backward) over all events.
double m_FE_Waveform_100ns[16][64]
Waveforms with 100ns sampling for Forward Endcap sectors.
double m_mcph[2]
Monte Carlo phi of the final state particles in main frame.
int m_NSamples
m_NSamples=631, number of samples for 10ns sampling.
int m_evtNum
Event number.
TFile * m_testfile
File to save output.
void calculate_discr_output()
Transforms waveforms into discriminators output.
double m_BESum_MaxAmp
Maximum running sum amplitude in an event for Backward endcap.
bool calculate_BE_quality(int iSample)
Return Quality (topology) flag at sample point, iSample, for Backward Endcap.
int m_CoincidenceCounterMatrix[16][16]
Stores number of concidences between waveforms exceeding threshold in i:j sectors (Forward:Backward).
int m_FESum_MaxId
Id of a sector with maximum amplitude in Forward endcap.
virtual void initialize() override
Initialize variables.
double m_thresholdBE
Threshold [GeV] on signal for Backward Endcap .
TH1D * m_h1BEHits
Store number of events when Backward sector i has signal exceeding Bha-Bha threshold over all events.
virtual void event() override
event per event.
void get_MCparticles()
Get MC particles parameters.
double m_thresholdFE
Threshold [GeV] on signal for Forward Endcap .
double m_BE_Waveform_10ns[16][631]
Waveforms with 10ns sampling for Backward Endcap sectors.
StoreArray< TRGECLWaveform > m_TrgEclWaveforms
Trigger waveforms.
bool m_FESum_Discr[16][631]
Discriminators values for running sums of Forward Endcap.
int m_SumCoincidenceMatrix[16][16]
Stores current coincidence duration [in samples] between running sums discriminators in i:j sectors (...
virtual void terminate() override
terminate.
void get_waveforms()
Get ECL waveforms comdined into sectors.
double m_discrTime
Discriminator's signal duration in ns.
double m_FESum_Amplitude[16]
Calculated amplitudes in running sums of Forward Endcap.
bool m_FEQual_Discr[16][631]
Discriminators values for Quality signal of Forward Endcap.
int m_CoincidenceMatrix[16][16]
Stores current coincidence duration [in samples] between waveforms exceeding threshold in i:j sectors...
void clear_lom_data()
Clear internal data.
double m_com_th[2]
Monte Carlo thetha of the final state particles in CMS frame.
TH1D * m_h1FEHits
Store number of events when Forward sector i has signal exceeding Bha-Bha threshold over all events.
bool m_BEQual_Discr[16][631]
Discriminators values for Quality signal of Backward Endcap.
virtual ~ECLLOMModule() override
Destructor.
double m_BE_Waveform_100ns[16][64]
Waveforms with 100ns sampling for Backward Endcap sectors.
double m_mcth[2]
Monte Carlo thetha of the final state particles in main frame.
double m_FE_Pedal[16]
Calculated pedestal values for Forward Endcap.
TTree * m_testtree
Tree to store output.
double m_BESum_Amplitude[16]
Calculated amplitudes in running sums of Backward Endcap.
bool m_isBhabhaPatternFE
Quality signal for Forward endcap.
bool calculate_FE_quality(int iSample)
Return Quality (topology) flag at sample point, iSample, for Forward Endcap.
double m_FESum_Waveform_10ns[16][631]
Running sum's waveforms with 10ns sampling for Forward Endcap sectors.
bool m_BESum_Discr[16][631]
Discriminators values for running sums of Backward Endcap.
bool m_isBhabha
Bha-bha signal for an event.
double m_BESum_Waveform_10ns[16][631]
Running sum's waveforms with 10ns sampling for Backward Endcap sectors.
TH2D * m_h2Coin
Store number of coincedencies for i:j sectors (Forward:Backward) over all events.
double m_mcen[2]
Monte Carlo energy of the final state particles in main frame.
double m_FE_Amplitude[16]
Calculated amplitudes in sectors of Forward Endcap.
void calculate_coincidence(int iSample)
Calculates Coincidence Matrix at sample point, iSample.
int m_SumCoincidenceCounterMatrix[16][16]
Stores number of concidences between running sums discriminators in i:j sectors (Forward:Backward).
double m_BE_Amplitude[16]
Calculated amplitudes in sectors of Backward Endcap.
double m_com_en[2]
Monte Carlo energy of the final state particles in CMS frame.
double m_FE_Waveform_10ns[16][631]
Waveforms with 10ns sampling for Forward Endcap sectors.
double m_BE_Pedal[16]
Calculated pedestal values for Backward Endcap.
bool m_includeInnerFE
Flag to include Inner part of the Forward Endcap.
bool m_saveSignal
Flag to save signal wavefroms into file.
StoreArray< MCParticle > m_MCParticles
MC particles.
void calculate_amplitudes()
Calculates amplitude [GeV] in an event for each sector.
double m_thresholdBkg
Threshold [GeV] on signal when sector considered as lighted.
std::string m_testFileName
Name of file to save output.
double m_com_ph[2]
Monte Carlo phi of the final state particles in CMS frame.
Module()
Constructor.
Definition Module.cc:30
Accessor to arrays stored in the data store.
Definition StoreArray.h:113
Abstract base class for different kinds of events.