Belle II Software development
ECLLocalMaximumFinderModule.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/core/Module.h>
13#include <framework/datastore/StoreArray.h>
14#include <framework/datastore/StoreObjPtr.h>
15#include <framework/gearbox/Unit.h>
16#include <framework/geometry/B2Vector3.h>
17#include <mdst/dataobjects/EventLevelClusteringInfo.h>
18
19class TTree;
20class TFile;
21
22namespace Belle2 {
28 class MCParticle;
29 class ECLHit;
30 class ECLDigit;
31 class ECLCalDigit;
32 class ECLLocalMaximum;
33 class ECLConnectedRegion;
34
35 namespace ECL {
36 class ECLNeighbours;
37 class ECLGeometryPar;
38 }
39
42
43 public:
46
49
51 virtual void initialize() override;
52
54 virtual void beginRun() override;
55
57 virtual void event() override;
58
60 virtual void endRun() override;
61
63 virtual void terminate() override;
64
67
70
73
76
79
82
85
87 virtual const char* mcParticleArrayName() const
88 { return "MCParticles" ; }
89
91 virtual const char* eclHitArrayName() const
92 { return "ECLHits" ; }
93
95 virtual const char* eclDigitArrayName() const
96 { return "ECLDigits" ; }
97
99 virtual const char* eclCalDigitArrayName() const
100 { return "ECLCalDigits" ; }
101
103 virtual const char* eclConnectedRegionArrayName() const
104 { return "ECLConnectedRegions" ; }
105
107 virtual const char* eclLocalMaximumArrayName() const
108 { return "ECLLocalMaximums" ; }
109
112
115
117 void makeLocalMaximum(const ECLConnectedRegion& aCR, const int cellId, const int lmId);
118
120 void addToSignalEnergy(int motherpdg, int motherindex, int pi0index, double weight);
121
123 bool isEnteringECL(const B2Vector3D& vec);
124
126 void getEnteringMother(const MCParticle& particle, int& pdg, int& arrayindex, int& pi0arrayindex);
127
129 int getIdPosition(const int type, const int id);
130
132 void getMax(int& maxtype, int& maxpos);
133
134 private:
135
136 // Module parameters
137 double m_energyCut;
139 std::string m_outfileName;
140 std::string m_method;
142 double m_cutOffset;
143 double m_cutSlope;
146 // Constants
147 const double c_minEnergyCut = 5.0 * Belle2::Unit::MeV;
150 std::vector< int > m_StoreArrPosition;
151
154
157
159 TFile* m_outfile{nullptr};
160 TTree* m_tree{nullptr};
163 const static unsigned c_nMaxNeighbours = 12;
165 float m_time = 0.0;
168 float m_energy = 0.0;
169 float m_thetaId = 0.0;
170 float m_phiId = 0.0;
171 float m_cellId = 0.0;
173 float m_timeResolution = 0.0;
174 float m_timeFitFailed = 0.0;
175 float m_CRId = 0.0;
176 float m_LMId = 0.0;
179 float m_target = 0.0;
180 float m_targetindex = 0.0;
181 float m_targetpi0index = 0.0;
184 float m_nNeighbours10 = 0.0;
185 float m_maxEnergyRatio = 0.0;
187 double m_totalSignalEnergy = 0.0;
188 double m_signalEnergy[10][5] {};
189 int m_signalId[10][5] {};
190 };
191
194 public:
196 //virtual const char* eclHitArrayName() const override
197 //{ return "ECLHitsPureCsI" ; }
198
200 virtual const char* eclDigitArrayName() const override
201 { return "ECLDigitsPureCsI" ; }
202
204 virtual const char* eclCalDigitArrayName() const override
205 { return "ECLCalDigitsPureCsI" ; }
206
208 virtual const char* eclConnectedRegionArrayName() const override
209 { return "ECLConnectedRegionsPureCsI" ; }
210
212 virtual const char* eclLocalMaximumArrayName() const override
213 { return "ECLLocalMaximumsPureCsI" ; }
214
215 }; // end of ECLLocalMaximumFinderPureCsIModule
216
218} // end of Belle2 namespace
Class to store connected regions (CRs)
TTree * m_tree
tree that contain information for MVA training
double m_cutRatioCorrection
correction for nominator and denominator of the ratio.
double m_signalEnergy[10][5]
total energy per MC matching type of this digit
void getEnteringMother(const MCParticle &particle, int &pdg, int &arrayindex, int &pi0arrayindex)
Get enterging mother of this particle.
StoreArray< ECLConnectedRegion > m_eclConnectedRegions
Store array: ECLConnectedRegion.
float m_energyRatioNeighbour[c_nMaxNeighbours]
energy ratio of neighbour 0..9 to center
double m_totalSignalEnergy
total energy of this digit
float m_phiId
local maximum center theta Id
virtual void initialize() override
Initialize.
virtual const char * eclHitArrayName() const
Name to be used for default or PureCsI option: ECLHits.
StoreArray< ECLLocalMaximum > m_eclLocalMaximums
Store array: ECLLocalMaximum.
float m_cellId
local maximum center cell Id
virtual const char * eclLocalMaximumArrayName() const
Name to be used for default option: ECLLocalMaximums.
int getIdPosition(const int type, const int id)
Get Id position in the vector.
float m_energy
Variables to monitor the MVA training.
std::string m_method
Method to find the local maximum.
virtual void terminate() override
Terminate (close ROOT files here if you have opened any).
std::string m_outfileName
file name prefix of the training output file
StoreArray< ECLDigit > m_eclDigits
Store array: ECLDigit.
ECL::ECLNeighbours * m_neighbourMap
Neighbour maps.
void makeLocalMaximum(const ECLConnectedRegion &aCR, const int cellId, const int lmId)
Make local maximum for a given connected region.
void resetClassifierVariables()
Reset Classifier Variables.
float m_thetaId
local maximum center theta Id
virtual const char * mcParticleArrayName() const
MCParticles.
float m_maxNeighbourEnergy
highest energy of all neighbours
bool isEnteringECL(const B2Vector3D &vec)
Check if particle is produced outside of the ECL.
TFile * m_outfile
Output training files and trees.
void addToSignalEnergy(int motherpdg, int motherindex, int pi0index, double weight)
Add energy to vector.
virtual const char * eclDigitArrayName() const
Name to be used for default or PureCsI option: ECLDigits.
StoreArray< ECLHit > m_eclHits
Store array: ECLHit.
virtual const char * eclConnectedRegionArrayName() const
Name to be used for default option: ECLConnectedRegions.
static const unsigned c_nMaxNeighbours
Variables (possibly) used for MVA classification.
StoreArray< MCParticle > m_mcParticles
Store array: MCParticle.
virtual const char * eclCalDigitArrayName() const
Name to be used for default or PureCsI option: ECLCalDigits.
float m_maxEnergyRatio
Highest energetic neighbour energy divided by LM energy.
int m_signalId[10][5]
total energy per MC matching type of this digit
const double c_minEnergyCut
Minimum LM energy.
std::vector< int > m_StoreArrPosition
vector (ECLElementNumbers::c_NCrystals + 1 entries) with cell id to store array positions
StoreObjPtr< EventLevelClusteringInfo > m_eventLevelClusteringInfo
EventLevelClusteringInfo.
void resetTrainingVariables()
Reset Debug Variables.
void getMax(int &maxtype, int &maxpos)
Get the highest energy deposition particle type.
StoreArray< ECLCalDigit > m_eclCalDigits
Store array: ECLCalDigit.
int m_isTrainingMode
training mode for MVA methods (i.e.
float m_nNeighbours10
Variables (possibly) used for cut classification.
Class to find connected regions, pureCsI version.
virtual const char * eclCalDigitArrayName() const override
Name to be used for PureCsI option: ECLCalDigitsPureCsI.
virtual const char * eclDigitArrayName() const override
Name to be used for PureCsI option: ECLHitsPureCsI.
virtual const char * eclLocalMaximumArrayName() const override
Name to be used for PureCsI option: ECLLocalMaximumsPureCsI.
virtual const char * eclConnectedRegionArrayName() const override
Name to be used for PureCsI option: ECLConnectedRegionsPureCsI.
The Class for ECL Geometry Parameters.
Class to get the neighbours for a given cell id.
Definition: ECLNeighbours.h:25
A Class to store the Monte Carlo particle information.
Definition: MCParticle.h:32
Base class for Modules.
Definition: Module.h:72
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:96
static const double MeV
[megaelectronvolt]
Definition: Unit.h:114
Abstract base class for different kinds of events.