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();
41
43 virtual void initialize() override;
44
46 virtual void beginRun() override;
47
49 virtual void event() override;
50
52 virtual void endRun() override;
53
55 virtual void terminate() override;
56
57 protected:
58
59 private:
60
64 void get_MCparticles();
65
70 void get_waveforms();
71
79
82
84 bool calculate_BE_quality(int iSample);
85
87 bool calculate_FE_quality(int iSample);
88
93 void calculate_coincidence(int iSample);
94
96 void clear_lom_data();
97
98 //module parameters
99 std::string m_testFileName;
103 double m_discrTime;
107 //input data
109 double m_BE_Waveform_100ns[16][64];
110 double m_FE_Waveform_100ns[16][64];
111 double m_mcen[2];
112 double m_mcth[2];
113 double m_mcph[2];
114 double m_com_en[2];
115 double m_com_th[2];
116 double m_com_ph[2];
120
123
124 //important output
128 double m_BE_Amplitude[16];
129 double m_FE_Amplitude[16];
130 double m_BESum_Amplitude[16];
131 double m_FESum_Amplitude[16];
132 double m_BE_Pedal[16];
133 double m_FE_Pedal[16];
139 //validation output
140 TH2D* m_h2Coin;
142 TH2D* m_h2FEAmp;
143 TH2D* m_h2BEAmp;
147 //internal variables
148 TFile* m_testfile;
149 TTree* m_testtree;
151 double m_BE_Waveform_10ns[16][631];
152 double m_FE_Waveform_10ns[16][631];
153 double m_BESum_Waveform_10ns[16][631];
154 double m_FESum_Waveform_10ns[16][631];
155 bool m_FESum_Discr[16][631];
156 bool m_BESum_Discr[16][631];
157 bool m_FEQual_Discr[16][631];
158 bool m_BEQual_Discr[16][631];
165 };
166 }//namespace ECL
168}//namespace Belle2
This module simulates ECL Luminosity Online Monitor logic, i.e.
Definition: eclLOMModule.h:33
bool m_isBhabhaPatternBE
Quality signal for Backward endcap.
Definition: eclLOMModule.h:160
double m_FESum_MaxAmp
Maximum running sum amplitude in an event for Forward endcap.
Definition: eclLOMModule.h:134
int m_BESum_MaxId
Id of a sector with maximum amplitude in Backward endcap.
Definition: eclLOMModule.h:137
int m_BhNum
Number of Bha-bha signals in an event.
Definition: eclLOMModule.h:127
TH2D * m_h2BEAmp
Store sectors amplitudes for Backward endcap over all events.
Definition: eclLOMModule.h:143
TH2D * m_h2FEAmp
Store sectors amplitudes for Forward endcap over all events.
Definition: eclLOMModule.h:142
TH2D * m_h2SumCoin
Store number of coincedencies in running sums for i:j sectors (Forward:Backward) over all events.
Definition: eclLOMModule.h:141
double m_FE_Waveform_100ns[16][64]
Waveforms with 100ns sampling for Forward Endcap sectors.
Definition: eclLOMModule.h:110
double m_mcph[2]
Monte Carlo phi of the final state particles in main frame.
Definition: eclLOMModule.h:113
int m_NSamples
m_NSamples=631, number of samples for 10ns sampling.
Definition: eclLOMModule.h:150
int m_evtNum
Event number.
Definition: eclLOMModule.h:108
TFile * m_testfile
File to save output.
Definition: eclLOMModule.h:148
void calculate_discr_output()
Transforms waveforms into discriminators output.
double m_BESum_MaxAmp
Maximum running sum amplitude in an event for Backward endcap.
Definition: eclLOMModule.h:135
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).
Definition: eclLOMModule.h:163
int m_FESum_MaxId
Id of a sector with maximum amplitude in Forward endcap.
Definition: eclLOMModule.h:136
virtual void initialize() override
Initialize variables.
Definition: eclLOMModule.cc:47
double m_thresholdBE
Threshold [GeV] on signal for Backward Endcap .
Definition: eclLOMModule.h:101
TH1D * m_h1BEHits
Store number of events when Backward sector i has signal exceeding Bha-Bha threshold over all events.
Definition: eclLOMModule.h:144
virtual void event() override
event per event.
Definition: eclLOMModule.cc:99
void get_MCparticles()
Get MC particles parameters.
double m_thresholdFE
Threshold [GeV] on signal for Forward Endcap .
Definition: eclLOMModule.h:100
double m_BE_Waveform_10ns[16][631]
Waveforms with 10ns sampling for Backward Endcap sectors.
Definition: eclLOMModule.h:151
StoreArray< TRGECLWaveform > m_TrgEclWaveforms
Trigger waveforms.
Definition: eclLOMModule.h:122
bool m_FESum_Discr[16][631]
Discriminators values for running sums of Forward Endcap.
Definition: eclLOMModule.h:155
int m_SumCoincidenceMatrix[16][16]
Stores current coincidence duration [in samples] between running sums discriminators in i:j sectors (...
Definition: eclLOMModule.h:162
virtual void endRun() override
end run.
virtual ~ECLLOMModule()
Destructor.
Definition: eclLOMModule.cc:42
virtual void terminate() override
terminate.
void get_waveforms()
Get ECL waveforms comdined into sectors.
double m_discrTime
Discriminator's signal duration in ns.
Definition: eclLOMModule.h:103
double m_FESum_Amplitude[16]
Calculated amplitudes in running sums of Forward Endcap.
Definition: eclLOMModule.h:131
bool m_FEQual_Discr[16][631]
Discriminators values for Quality signal of Forward Endcap.
Definition: eclLOMModule.h:157
int m_CoincidenceMatrix[16][16]
Stores current coincidence duration [in samples] between waveforms exceeding threshold in i:j sectors...
Definition: eclLOMModule.h:161
void clear_lom_data()
Clear internal data.
double m_com_th[2]
Monte Carlo thetha of the final state particles in CMS frame.
Definition: eclLOMModule.h:115
TH1D * m_h1FEHits
Store number of events when Forward sector i has signal exceeding Bha-Bha threshold over all events.
Definition: eclLOMModule.h:145
bool m_BEQual_Discr[16][631]
Discriminators values for Quality signal of Backward Endcap.
Definition: eclLOMModule.h:158
double m_BE_Waveform_100ns[16][64]
Waveforms with 100ns sampling for Backward Endcap sectors.
Definition: eclLOMModule.h:109
double m_mcth[2]
Monte Carlo thetha of the final state particles in main frame.
Definition: eclLOMModule.h:112
virtual void beginRun() override
begin run.
Definition: eclLOMModule.cc:95
double m_FE_Pedal[16]
Calculated pedestal values for Forward Endcap.
Definition: eclLOMModule.h:133
TTree * m_testtree
Tree to store output.
Definition: eclLOMModule.h:149
double m_BESum_Amplitude[16]
Calculated amplitudes in running sums of Backward Endcap.
Definition: eclLOMModule.h:130
bool m_isBhabhaPatternFE
Quality signal for Forward endcap.
Definition: eclLOMModule.h:159
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.
Definition: eclLOMModule.h:154
ECLLOMModule()
Constructor.
Definition: eclLOMModule.cc:22
bool m_BESum_Discr[16][631]
Discriminators values for running sums of Backward Endcap.
Definition: eclLOMModule.h:156
bool m_isBhabha
Bha-bha signal for an event.
Definition: eclLOMModule.h:125
double m_BESum_Waveform_10ns[16][631]
Running sum's waveforms with 10ns sampling for Backward Endcap sectors.
Definition: eclLOMModule.h:153
TH2D * m_h2Coin
Store number of coincedencies for i:j sectors (Forward:Backward) over all events.
Definition: eclLOMModule.h:140
double m_mcen[2]
Monte Carlo energy of the final state particles in main frame.
Definition: eclLOMModule.h:111
double m_FE_Amplitude[16]
Calculated amplitudes in sectors of Forward Endcap.
Definition: eclLOMModule.h:129
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).
Definition: eclLOMModule.h:164
double m_BE_Amplitude[16]
Calculated amplitudes in sectors of Backward Endcap.
Definition: eclLOMModule.h:128
double m_com_en[2]
Monte Carlo energy of the final state particles in CMS frame.
Definition: eclLOMModule.h:114
double m_FE_Waveform_10ns[16][631]
Waveforms with 10ns sampling for Forward Endcap sectors.
Definition: eclLOMModule.h:152
double m_BE_Pedal[16]
Calculated pedestal values for Backward Endcap.
Definition: eclLOMModule.h:132
bool m_includeInnerFE
Flag to include Inner part of the Forward Endcap.
Definition: eclLOMModule.h:104
bool m_saveSignal
Flag to save signal wavefroms into file.
Definition: eclLOMModule.h:105
StoreArray< MCParticle > m_MCParticles
MC particles.
Definition: eclLOMModule.h:119
void calculate_amplitudes()
Calculates amplitude [GeV] in an event for each sector.
double m_thresholdBkg
Threshold [GeV] on signal when sector considered as lighted.
Definition: eclLOMModule.h:102
std::string m_testFileName
Name of file to save output.
Definition: eclLOMModule.h:99
double m_com_ph[2]
Monte Carlo phi of the final state particles in CMS frame.
Definition: eclLOMModule.h:116
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.