Belle II Software development
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#include <framework/database/DBObjPtr.h>
16
17// ECL
18#include <ecl/dbobjects/ECLClusteringParameters.h>
19
20// C++
21#include <set>
22
23namespace Belle2 {
29 class ECLCalDigit;
31
32 namespace ECL {
33 class ECLNeighbours;
34 }
35
37 class ECLCRFinderModule : public Module {
38
39 public:
42
44 virtual ~ECLCRFinderModule();
45
47 virtual void initialize() override;
48
50 virtual void beginRun() override;
51
53 virtual void event() override;
54
56 virtual void endRun() override;
57
59 virtual void terminate() override;
60
63
66
69
71 virtual const char* eclCalDigitArrayName() const
72 { return "ECLCalDigits" ; }
73
75 virtual const char* eclConnectedRegionArrayName() const
76 { return "ECLConnectedRegions" ; }
77
79 virtual const char* eventLevelClusteringInfoName() const
80 { return "EventLevelClusteringInfo" ; }
81
82 private:
83
84 // Module parameters
85 double m_energyCut[3];
86 double m_timeCut[3];
88 std::string m_mapType[2];
89 double m_mapPar[2];
92
95
97 std::vector <int> m_cellIdToCheckVec;
98 std::vector <int> m_cellIdToSeedVec;
99 std::vector <int> m_cellIdToGrowthVec;
100 std::vector <int> m_cellIdToDigitVec;
101
103 std::vector< int > m_calDigitStoreArrPosition;
104
106 std::vector < int > m_cellIdToTempCRIdVec;
107 std::map < int, int > m_cellIdToTempCRIdMap;
108
110 std::vector<ECL::ECLNeighbours*> m_neighbourMaps;
111
113 // void checkNeighbours(const int cellid, const int tempcrid, const int type);
114 bool areNeighbours(const int cellid1, const int cellid2, const int maptype);
115
117 std::vector<int> oneHotVector(std::vector<int>& A, const int n);
118
120 std::vector<int> flattenVector(std::vector<std::vector<int>>& A);
121
123 std::vector<std::set<int>> mergeVectorsUsingSets(std::vector<std::vector<int>>& A);
124
126 std::vector<std::vector<int>> getConnectedRegions(const std::vector<int>& A, const std::vector<int>& B, const int maptype);
127
128 };
129
132 public:
134 virtual const char* eclCalDigitArrayName() const override
135 { return "ECLCalDigitsPureCsI" ; }
136
138 virtual const char* eclConnectedRegionArrayName() const override
139 { return "ECLConnectedRegionsPureCsI" ; }
140
142 virtual const char* eventLevelClusteringInfoName() const override
143 { return "EventLevelClusteringInfoPureCsI" ; }
144
145 }; // end of ECLCovarianceMatrixPureCsIModule
146
148} // end of Belle2 namespace
Class for accessing objects in the database.
Definition DBObjPtr.h:21
double m_mapPar[2]
Parameters for neighbour maps.
virtual const char * eventLevelClusteringInfoName() const
Name to be used for default option: EventLevelClusteringInfo.
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.
std::vector< int > flattenVector(std::vector< std::vector< int > > &A)
Convert vector of vectors to one long vector.
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< std::set< int > > mergeVectorsUsingSets(std::vector< std::vector< int > > &A)
Find all lists of cell-ids that share at least one cell.
DBObjPtr< ECLClusteringParameters > m_eclClusteringParameters
ECLClusteringParameters payload for parameters.
bool m_useParametersFromDatabase
get energy and time cuts from payload
virtual const char * eclConnectedRegionArrayName() const
Name to be used for default option: ECLConnectedRegions.
std::vector< ECL::ECLNeighbours * > m_neighbourMaps
Neighbour maps.
virtual const char * eclCalDigitArrayName() const
Name to be used for default or PureCsI option: ECLCalDigits.
std::string m_mapType[2]
Neighbour map types.
double m_timeCut_maxEnergy[3]
Time cut is only applied below this energy, ...
StoreObjPtr< EventLevelClusteringInfo > m_eventLevelClusteringInfo
Store object pointer: EventLevelClusteringInfo.
StoreArray< ECLCalDigit > m_eclCalDigits
Store array: ECLCalDigit.
Class to find connected regions, pureCsI version.
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.
virtual const char * eclConnectedRegionArrayName() const override
Name to be used for PureCsI option: ECLConnectedRegionsPureCsI.
Class to store calibrated ECLDigits: ECLCalDigits.
Definition ECLCalDigit.h:23
Class to store connected regions (CRs)
Class to get the neighbours for a given cell id.
ECL/KLM clustering event level information:
Module()
Constructor.
Definition Module.cc:30
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.