Belle II Software  release-08-01-10
ECLCRFinderModule.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 // FRAMEWORK
12 #include <framework/core/Module.h>
13 #include <framework/datastore/StoreArray.h>
14 #include <framework/datastore/StoreObjPtr.h>
15 
16 // C++
17 #include <set>
18 
19 namespace Belle2 {
24  class ECLConnectedRegion;
25  class ECLCalDigit;
26  class EventLevelClusteringInfo;
27 
28  namespace ECL {
29  class ECLNeighbours;
30  }
31 
36  class ECLCRFinderModule : public Module {
37 
38  public:
41 
43  virtual ~ECLCRFinderModule();
44 
46  virtual void initialize() override;
47 
49  virtual void beginRun() override;
50 
52  virtual void event() override;
53 
55  virtual void endRun() override;
56 
58  virtual void terminate() override;
59 
62 
65 
68 
70  virtual const char* eclCalDigitArrayName() const
71  { return "ECLCalDigits" ; }
72 
74  virtual const char* eclConnectedRegionArrayName() const
75  { return "ECLConnectedRegions" ; }
76 
78  virtual const char* eventLevelClusteringInfoName() const
79  { return "EventLevelClusteringInfo" ; }
80 
81  private:
82 
83  // Module parameters
84  double m_energyCut[3];
85  double m_timeCut[3];
86  double m_timeCut_maxEnergy[3];
87  std::string m_mapType[2];
88  double m_mapPar[2];
92  std::vector <int> m_cellIdToCheckVec;
93  std::vector <int> m_cellIdToSeedVec;
94  std::vector <int> m_cellIdToGrowthVec;
95  std::vector <int> m_cellIdToDigitVec;
98  std::vector< int > m_calDigitStoreArrPosition;
99 
101  std::vector < int > m_cellIdToTempCRIdVec;
102  std::map < int, int > m_cellIdToTempCRIdMap;
105  std::vector<ECL::ECLNeighbours*> m_neighbourMaps;
106 
108  // void checkNeighbours(const int cellid, const int tempcrid, const int type);
109  bool areNeighbours(const int cellid1, const int cellid2, const int maptype);
110 
112  std::vector<int> oneHotVector(std::vector<int>& A, const int n);
113 
115  std::vector<int> flattenVector(std::vector<std::vector<int>>& A);
116 
118  std::vector<std::set<int>> mergeVectorsUsingSets(std::vector<std::vector<int>>& A);
119 
121  std::vector<std::vector<int>> getConnectedRegions(const std::vector<int>& A, const std::vector<int>& B, const int maptype);
122 
123  };
124 
127  public:
129  virtual const char* eclCalDigitArrayName() const override
130  { return "ECLCalDigitsPureCsI" ; }
131 
133  virtual const char* eclConnectedRegionArrayName() const override
134  { return "ECLConnectedRegionsPureCsI" ; }
135 
137  virtual const char* eventLevelClusteringInfoName() const override
138  { return "EventLevelClusteringInfoPureCsI" ; }
139 
140  }; // end of ECLCovarianceMatrixPureCsIModule
141 
143 } // end of Belle2 namespace
Class to find connected regions.
double m_mapPar[2]
Parameters for neighbour maps.
bool areNeighbours(const int cellid1, const int cellid2, const int maptype)
Check if two crystals are neighbours.
std::vector< int > m_cellIdToDigitVec
cellid -> above threshold digits.
virtual ~ECLCRFinderModule()
Destructor.
StoreArray< ECLConnectedRegion > m_eclConnectedRegions
Store array: ECLConnectedRegion.
double m_timeCut[3]
Time cut for seed, neighbours, ...
std::vector< int > oneHotVector(std::vector< int > &A, const int n)
Convert vector of cell ids to 0/1 vectors from 1-8737.
std::vector< int > m_cellIdToGrowthVec
cellid -> growth digits.
virtual void initialize() override
Initialize.
std::map< int, int > m_cellIdToTempCRIdMap
cellid -> temporary CR.
double m_energyCut[3]
Energy cut for seed, neighbours, ...
std::vector< int > m_cellIdToCheckVec
Digit vectors.
virtual void event() override
Event.
std::vector< int > m_cellIdToSeedVec
cellid -> seed digit.
virtual void endRun() override
End run.
virtual void terminate() override
Terminate (close ROOT files here if you have opened any).
std::vector< int > m_cellIdToTempCRIdVec
Connected Region map.
int m_skipFailedTimeFitDigits
Handling of digits with failed time fits.
std::vector< int > m_calDigitStoreArrPosition
vector (ECLElementNumbers::c_NCrystals + 1 entries) with cell id to store array positions
virtual void beginRun() override
Begin.
std::vector< std::vector< int > > getConnectedRegions(const std::vector< int > &A, const std::vector< int > &B, const int maptype)
Get all connected regions.
std::vector< int > flattenVector(std::vector< std::vector< int >> &A)
Convert vector of vectors to one long vector.
virtual const char * eventLevelClusteringInfoName() const
Name to be used for default option: EventLevelClusteringInfo.
std::vector< std::set< int > > mergeVectorsUsingSets(std::vector< std::vector< int >> &A)
Find all lists of cell-ids that share at least one cell.
std::vector< ECL::ECLNeighbours * > m_neighbourMaps
Neighbour maps.
std::string m_mapType[2]
Neighbour map types.
double m_timeCut_maxEnergy[3]
Time cut is only applied below this energy, ...
virtual const char * eclCalDigitArrayName() const
Name to be used for default or PureCsI option: ECLCalDigits.
StoreObjPtr< EventLevelClusteringInfo > m_eventLevelClusteringInfo
Store object pointer: EventLevelClusteringInfo.
StoreArray< ECLCalDigit > m_eclCalDigits
Store array: ECLCalDigit.
virtual const char * eclConnectedRegionArrayName() const
Name to be used for default option: ECLConnectedRegions.
Class to find connected regions, pureCsI version.
virtual const char * eclConnectedRegionArrayName() const override
Name to be used for PureCsI option: ECLConnectedRegionsPureCsI.
virtual const char * eclCalDigitArrayName() const override
Name to be used for PureCsI option: ECLCalDigitsPureCsI.
virtual const char * eventLevelClusteringInfoName() const override
Name to be used for PureCsI option: EventLevelClusteringInfoPureCsI.
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
Abstract base class for different kinds of events.