Belle II Software  release-06-01-15
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 //STL
12 #include <vector>
13 
14 // FRAMEWORK
15 #include <framework/core/Module.h>
16 #include <framework/gearbox/Unit.h>
17 #include <framework/datastore/StoreArray.h>
18 #include <framework/datastore/StoreObjPtr.h>
19 
20 class TGraph2D;
21 class TFile;
22 class TH1F;
23 
24 namespace Belle2 {
29  class ECLCalDigit;
30  class ECLConnectedRegion;
31  class ECLShower;
32  class ECLLocalMaximum;
33  class EventLevelClusteringInfo;
34 
35  namespace ECL {
36  class ECLNeighbours;
37  class ECLGeometryPar;
38  }
39 
44  class ECLSplitterN1Module : public Module {
45 
46  public:
49 
52 
54  virtual void initialize() override;
55 
57  virtual void beginRun() override;
58 
60  virtual void event() override;
61 
63  virtual void endRun() override;
64 
66  virtual void terminate() override;
67 
68  private:
69  // Module parameters:
70 
71  // Splitter
72  double m_threshold;
73  double m_expConstant;
78  const double c_molierRadius = 3.581 *
86  std::string m_fileNOptimalFWDName;
88  std::string m_fileNOptimalBWDName;
89  TFile* m_fileBackgroundNorm{nullptr};
90  TFile* m_fileNOptimalFWD{nullptr};
91  TFile* m_fileNOptimalBarrel{nullptr};
92  TFile* m_fileNOptimalBWD{nullptr};
93  TH1F* m_th1fBackgroundNorm{nullptr};
94  TGraph2D* m_tg2dNOptimalFWD[13][9] {};
95  TGraph2D* m_tg2dNOptimalBWD[10][9] {};
96  TGraph2D* m_tg2dNOptimalBarrel{nullptr};
98  // Position
99  std::string m_positionMethod;
103  std::vector<double> m_liloParameters;
105  // Background
108  const unsigned short c_nSectorCellIdBWD[10] = {9, 9, 6, 6, 6, 6, 6, 4, 4, 4};
109  const unsigned short c_nSectorCellIdFWD[13] = {3, 3, 4, 4, 4, 6, 6, 6, 6, 6, 6, 9, 9};
111  // Crystals per Ring
112  const unsigned short c_crystalsPerRing[69] = {48, 48, 64, 64, 64, 96, 96, 96, 96, 96, 96, 144, 144, //FWD (13)
113  144, 144, 144, 144, 144, 144, 144, // BARREL 20
114  144, 144, 144, 144, 144, 144, 144, 144, 144, 144, //30
115  144, 144, 144, 144, 144, 144, 144, 144, 144, 144, //40
116  144, 144, 144, 144, 144, 144, 144, 144, 144, 144, //50
117  144, 144, 144, 144, 144, 144, 144, 144, 144,//59
118  144, 144, 96, 96, 96, 96, 96, 64, 64, 64
119  };
122  std::vector< int > m_StoreArrPosition;
123 
125  std::vector< int > m_StoreArrPositionLM;
126 
128  std::vector< int > m_cellIdInCR;
129 
136 
139 
142 
145 
148 
150  virtual const char* eclCalDigitArrayName() const
151  { return "ECLCalDigits" ; }
152 
154  virtual const char* eclConnectedRegionArrayName() const
155  { return "ECLConnectedRegions" ; }
156 
158  virtual const char* eclLocalMaximumArrayName() const
159  { return "ECLLocalMaximums" ; }
160 
162  virtual const char* eclShowerArrayName() const
163  { return "ECLShowers" ; }
164 
166  virtual const char* eventLevelClusteringInfoName() const
167  { return "EventLevelClusteringInfo" ; }
168 
171 
174 
176  int getNeighbourMap(const double energy, const double background);
177 
179  unsigned int getOptimalNumberOfDigits(const int cellid, const double energy, const double background);
180 
182  double getEnergySum(std::vector < std::pair<double, double> >& weighteddigits, const unsigned int n);
183 
185  double estimateEnergy(const int centerid);
186 
187  }; // end of ECLSplitterN1Module
188 
189 
192  public:
194  virtual const char* eclCalDigitArrayName() const override
195  { return "ECLCalDigitsPureCsI" ; }
196 
198  virtual const char* eclConnectedRegionArrayName() const override
199  { return "ECLConnectedRegionsPureCsI" ; }
200 
202  virtual const char* eclLocalMaximumArrayName() const override
203  { return "ECLLocalMaximumsPureCsI" ; }
204 
206  virtual const char* eclShowerArrayName() const override
207  { return "ECLShowersPureCsI" ; }
208 
210  virtual const char* eventLevelClusteringInfoName() const override
211  { return "EventLevelClusteringInfoPureCsI" ; }
212 
213  }; // end of ECLSplitterN1PureCsIModule
214 
216 } // end of Belle2 namespace
Class to store connected regions (CRs)
Class to perform the shower correction.
ECL::ECLNeighbours * m_NeighbourMap9
Neighbour maps.
const unsigned short c_nSectorCellIdBWD[10]
crystals per sector for theta rings
double m_liloParameterB
lin-log parameter B
int m_maxIterations
Maximum number of iterations.
StoreArray< ECLShower > m_eclShowers
Store array: ECLShower.
std::string m_fileNOptimalBWDName
BWD number of optimal neighbours filename.
ECL::ECLNeighbours * m_NeighbourMap21
5x5 neighbours excluding corners = 21
StoreArray< ECLConnectedRegion > m_eclConnectedRegions
Store array: ECLConnectedRegion.
double m_minimumSharedEnergy
Minimum shared energy.
const unsigned short c_nSectorCellIdFWD[13]
crystals per sector for theta rings
TGraph2D * m_tg2dNOptimalBarrel
Array of 2D graphs used for interpolation between background and energy.
std::string m_positionMethod
Position calculation: lilo or linear.
void splitConnectedRegion(ECLConnectedRegion &aCR)
Split connected region into showers.
virtual void initialize() override
Initialize.
TFile * m_fileBackgroundNorm
Background normalization file.
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.
TFile * m_fileNOptimalBarrel
Barrel number of optimal neighbours.
std::string m_fileBackgroundNormName
Background normalization filename.
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.
TFile * m_fileNOptimalFWD
FWD number of optimal neighbours.
virtual void terminate() override
Terminate.
ECL::ECLGeometryPar * m_geom
Geometry.
TGraph2D * m_tg2dNOptimalBWD[10][9]
Array of 2D graphs used for interpolation between background and energy.
std::string m_fileNOptimalFWDName
FWD number of optimal neighbours filename.
std::vector< int > m_cellIdInCR
list with all cellid of this connected region
double m_shiftTolerance
Tolerance level for centroid shifts.
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.
TH1F * m_th1fBackgroundNorm
Background normalization histogram.
std::string m_fileNOptimalBarrelName
Barrel number of optimal neighbours filename.
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 (8736+1 entries) with cell id to store array positions
TGraph2D * m_tg2dNOptimalFWD[13][9]
Array of 2D graphs used for interpolation between background and energy.
std::vector< int > m_StoreArrPositionLM
vector (8736+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.
unsigned int getOptimalNumberOfDigits(const int cellid, const double energy, const double background)
Get optimal number of digits (out of 21) based on first energy estimation and background level per ev...
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.
TFile * m_fileNOptimalBWD
BWD number of optimal neighbours.
virtual const char * eclLocalMaximumArrayName() const
Default name ECLLocalMaximums.
const unsigned short c_crystalsPerRing[69]
Number of crystals per theta ring.
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:23
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:95
static const double cm
Standard units with the value = 1.
Definition: Unit.h:47
Abstract base class for different kinds of events.