Belle II Software  release-08-01-10
ECLSplitterN1Module.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/database/DBObjPtr.h>
16 #include <framework/gearbox/Unit.h>
17 
18 /* Root headers */
19 #include <TH2F.h>
20 
21 /* C++ headers. */
22 #include <vector>
23 
24 namespace Belle2 {
29  class ECLCalDigit;
30  class ECLConnectedRegion;
31  class ECLShower;
32  class ECLLocalMaximum;
33  class EventLevelClusteringInfo;
34  class ECLnOptimal;
35 
36  namespace ECL {
37  class ECLNeighbours;
38  class ECLGeometryPar;
39  }
40 
45  class ECLSplitterN1Module : public Module {
46 
47  public:
50 
53 
55  virtual void initialize() override;
56 
58  virtual void beginRun() override;
59 
61  virtual void event() override;
62 
64  virtual void endRun() override;
65 
67  virtual void terminate() override;
68 
69  private:
70  // Module parameters:
71 
72  // Splitter
73  double m_threshold;
74  double m_expConstant;
79  const double c_molierRadius = 3.581 *
88  TH2F m_nOptimal2D;
89  std::vector<int> m_groupNumber;
90  const int m_nLeakReg = 3;
91  int m_nEnergyBins = 0;
92  std::vector< std::vector<float> > m_eBoundaries;
94  // Position
95  std::string m_positionMethod;
99  std::vector<double> m_liloParameters;
101  // Background
105  std::vector< int > m_StoreArrPosition;
106 
108  std::vector< int > m_StoreArrPositionLM;
109 
111  std::vector< int > m_cellIdInCR;
112 
119 
122 
125 
128 
131 
133  virtual const char* eclCalDigitArrayName() const
134  { return "ECLCalDigits" ; }
135 
137  virtual const char* eclConnectedRegionArrayName() const
138  { return "ECLConnectedRegions" ; }
139 
141  virtual const char* eclLocalMaximumArrayName() const
142  { return "ECLLocalMaximums" ; }
143 
145  virtual const char* eclShowerArrayName() const
146  { return "ECLShowers" ; }
147 
149  virtual const char* eventLevelClusteringInfoName() const
150  { return "EventLevelClusteringInfo" ; }
151 
154 
157 
159  int getNeighbourMap(const double energy, const double background);
160 
162  std::vector<int> getOptimalNumberOfDigits(const int cellid, const double energy);
163 
165  double getEnergySum(std::vector < std::pair<double, double> >& weighteddigits, const unsigned int n);
166 
168  double estimateEnergy(const int centerid);
169 
170  }; // end of ECLSplitterN1Module
171 
172 
175  public:
177  virtual const char* eclCalDigitArrayName() const override
178  { return "ECLCalDigitsPureCsI" ; }
179 
181  virtual const char* eclConnectedRegionArrayName() const override
182  { return "ECLConnectedRegionsPureCsI" ; }
183 
185  virtual const char* eclLocalMaximumArrayName() const override
186  { return "ECLLocalMaximumsPureCsI" ; }
187 
189  virtual const char* eclShowerArrayName() const override
190  { return "ECLShowersPureCsI" ; }
191 
193  virtual const char* eventLevelClusteringInfoName() const override
194  { return "EventLevelClusteringInfoPureCsI" ; }
195 
196  }; // end of ECLSplitterN1PureCsIModule
197 
199 } // end of Belle2 namespace
Class for accessing objects in the database.
Definition: DBObjPtr.h:21
Class to store connected regions (CRs)
Class to perform the shower correction.
ECL::ECLNeighbours * m_NeighbourMap9
Neighbour maps.
double m_liloParameterB
lin-log parameter B
int m_maxIterations
Maximum number of iterations.
StoreArray< ECLShower > m_eclShowers
Store array: ECLShower.
ECL::ECLNeighbours * m_NeighbourMap21
5x5 neighbours excluding corners = 21
StoreArray< ECLConnectedRegion > m_eclConnectedRegions
Store array: ECLConnectedRegion.
double m_minimumSharedEnergy
Minimum shared energy.
const int m_nLeakReg
3 ECL regions: 0 = forward, 1 = barrel, 2 = backward
std::string m_positionMethod
Position calculation: lilo or linear.
void splitConnectedRegion(ECLConnectedRegion &aCR)
Split connected region into showers.
virtual void initialize() override
Initialize.
double m_cutDigitTimeResidualForEnergy
Maximum time residual to be included in the shower energy calculation.
StoreArray< ECLLocalMaximum > m_eclLocalMaximums
Store array: ECLLocalMaximum.
virtual void event() override
Event.
double m_threshold
Local maximum threshold after splitting.
double estimateEnergy(const int centerid)
Estimate energy using 3x3 around central crystal.
virtual const char * eclShowerArrayName() const
Default name ECLShowers.
virtual void endRun() override
End run.
virtual void terminate() override
Terminate.
std::vector< int > getOptimalNumberOfDigits(const int cellid, const double energy)
Get optimal number of digits (out of 21) based on first energy estimation and background level per ev...
ECL::ECLGeometryPar * m_geom
Geometry.
std::vector< int > m_cellIdInCR
list with all cellid of this connected region
double m_shiftTolerance
Tolerance level for centroid shifts.
DBObjPtr< ECLnOptimal > m_eclNOptimal
nOptimal payload
virtual void beginRun() override
Begin run.
int m_fullBkgdCount
Number of expected background digits at full background, FIXME: move to database.
virtual const char * eventLevelClusteringInfoName() const
Name to be used for default option: EventLevelClusteringInfo.
int m_nEnergyBins
number of energies bins in nOptimal payload
const double c_molierRadius
Constant RM (Molier Radius) from exp(-a*dist/RM), http://pdg.lbl.gov/2009/AtomicNuclearProperties/HTM...
int m_maxSplits
Maximum number of splits.
int m_useOptimalNumberOfDigitsForEnergy
Optimize the number of neighbours for energy calculations.
int getNeighbourMap(const double energy, const double background)
Get number of neighbours based on first energy estimation and background level per event.
double m_cutDigitEnergyForEnergy
Minimum digit energy to be included in the shower energy calculation.
std::vector< double > m_liloParameters
lin-log parameters A, B, and C
virtual const char * eclCalDigitArrayName() const
Default name ECLCalDigits.
std::vector< int > m_StoreArrPosition
vector (ECLElementNumbers::c_NCrystals + 1 entries) with cell id to store array positions
std::vector< int > m_StoreArrPositionLM
vector (ECLElementNumbers::c_NCrystals + 1 entries) with cell id to store array positions for LM
double m_liloParameterA
lin-log parameter A
StoreObjPtr< EventLevelClusteringInfo > m_eventLevelClusteringInfo
Store object pointer: EventLevelClusteringInfo.
std::vector< std::vector< float > > m_eBoundaries
energy boundaries each region
TH2F m_nOptimal2D
2D hist of nOptimal for Ebin vs groupID
std::vector< int > m_groupNumber
group number for each crystal
double getEnergySum(std::vector< std::pair< double, double > > &weighteddigits, const unsigned int n)
Get energy sum for weighted entries.
StoreArray< ECLCalDigit > m_eclCalDigits
Store array: ECLCalDigit.
double m_expConstant
Constant a from exp(-a*dist/RM), 1.5 to 2.5.
double m_liloParameterC
lin-log parameter C
virtual const char * eclConnectedRegionArrayName() const
Default name ECLConnectedRegions.
virtual const char * eclLocalMaximumArrayName() const
Default name ECLLocalMaximums.
The very same module but for PureCsI.
virtual const char * eclConnectedRegionArrayName() const override
PureCsI name ECLConnectedRegionsPureCsI.
virtual const char * eclLocalMaximumArrayName() const override
PureCsI name ECLLocalMaximumsPureCsI.
virtual const char * eclShowerArrayName() const override
PureCsI name ECLShowersPureCsI.
virtual const char * eclCalDigitArrayName() const override
PureCsI name ECLCalDigitsPureCsI.
virtual const char * eventLevelClusteringInfoName() const override
Name to be used for PureCsI option: EventLevelClusteringInfoPureCsI.
The Class for ECL Geometry Parameters.
Class to get the neighbours for a given cell id.
Definition: ECLNeighbours.h:25
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 cm
Standard units with the value = 1.
Definition: Unit.h:47
Abstract base class for different kinds of events.