10#include <ecl/modules/eclLOM/eclLOMModule.h>
13#include <Math/Boost.h>
28 addParam(
"discrTime",
m_discrTime,
"Duration of '1' (positive) signal from discriminators [ns]", 1000.0);
34 for (
int i = 0; i < 16; i++) {
35 for (
int j = 0; j < 16; j++) {
52 B2FATAL(
"Not all collections found, exiting processing");
85 m_h2Coin =
new TH2D(
"Coins",
"Coincidence Matrix", 16, 0, 16, 16, 0, 16);
86 m_h2SumCoin =
new TH2D(
"SumCoins",
"Sum Coincidence Matrix", 16, 0, 16, 16, 0, 16);
87 m_h2FEAmp =
new TH2D(
"FE_AmpId",
"", 16, 0, 16, 100, 0, 8);
88 m_h2BEAmp =
new TH2D(
"BE_AmpId",
"", 16, 0, 16, 100, 0, 8);
89 m_h1BEHits =
new TH1D(
"BE_Fired",
"", 16, 0, 16);
90 m_h1FEHits =
new TH1D(
"FE_Fired",
"", 16, 0, 16);
107 for (
int iSample = 300; iSample < 500; iSample++) {
112 for (
int iFESector = 0; iFESector < 16; iFESector++) {
114 int iBESector = (iFESector + 8) % 16;
133 for (
int i = 0; i < 16; i++) {
134 for (
int j = 0; j < 16; j++) {
139 std::cout << std::endl;
149 if (nm_MCParticles >= 4) {
150 for (
int ind = 2; ind < 4; ind++) {
157 ROOT::Math::XYZVector Boost_backV = SummP.BoostToCM();
158 ROOT::Math::PxPyPzEVector ComP[2];
161 ComP[0] = ROOT::Math::Boost(Boost_backV) * ComP[0];
162 ComP[1] = ROOT::Math::Boost(Boost_backV) * ComP[1];
163 for (
int ind = 0; ind < 2; ind++) {
177 for (
int i = 0; i < n_trg_wf; i++) {
180 int tc_theta_id = TCWaveform->getThetaID();
181 int tc_phi_id = TCWaveform->getPhiID();
183 TCWaveform->fillWaveform(m_wf);
185 int iSectorIndex = (tc_phi_id - 1) / 2;
188 for (
int iSample = 0; iSample < 64; iSample++) {
189 if (tc_theta_id <= 3) {
192 if (tc_theta_id == 16 || tc_theta_id == 17)
m_BE_Waveform_100ns[iSectorIndex][iSample] += m_wf[iSample];
200 for (
int iSector = 0; iSector < 16; iSector++) {
201 for (
int iSample = 15; iSample < 36; iSample++) {
207 for (
int iSector = 0; iSector < 16; iSector++) {
208 for (
int iSample = 0; iSample < 63; iSample++) {
223 for (
int iSector = 0; iSector < 16; iSector++) {
224 for (
int iSample = 1; iSample <
m_NSamples; iSample++) {
225 int iNextSector = (iSector + 1) % 16;
231 for (
int j = iSample; j < iSample + TimeOfDiscr; j++) {
236 for (
int j = iSample; j < iSample + TimeOfDiscr; j++) {
241 for (
int j = iSample; j < iSample + TimeOfDiscr; j++) {
246 for (
int j = iSample; j < iSample + TimeOfDiscr; j++) {
260 for (
int iBESector = 0; iBESector < 16; iBESector++) {
263 if (nhit == 1) First = iBESector;
264 if (nhit == 2 && !((iBESector + 1) % 16 == First || (First + 1) % 16 == iBESector))
return (
false);
265 if (nhit >= 3)
return (
false);
275 for (
int iFESector = 0; iFESector < 16; iFESector++) {
278 if (nhit == 1) First = iFESector;
279 if (nhit == 2 && !((iFESector + 1) % 16 == First || (First + 1) % 16 == iFESector))
return (
false);
280 if (nhit >= 3)
return (
false);
288 for (
int iFESector = 0; iFESector < 16; iFESector++) {
289 for (
int iBESector = 0; iBESector < 16; iBESector++) {
310 for (
int isector = 0; isector < 16; isector++) {
311 for (
int iSample = 0; iSample < 64; iSample++) {
315 for (
int iSample = 0; iSample <
m_NSamples; iSample++) {
331 for (
int jsector = 0; jsector < 16; jsector++) {
346 for (
int iSample = 0; iSample <
m_NSamples; iSample++) {
347 for (
int isector = 0; isector < 16; isector++) {
356 for (
int i = 0; i < 16; i++) {
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 endRun() override
end run.
virtual ~ECLLOMModule()
Destructor.
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.
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.
virtual void beginRun() override
begin run.
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.
ECLLOMModule()
Constructor.
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.
void setDescription(const std::string &description)
Sets the description of the module.
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
int getEntries() const
Get the number of objects in the array.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.