HerdSoftware  0.1.1
CaloDBSCANClustering.h
Go to the documentation of this file.
1 /*
2  * CaloDBSCANClustering.h
3  *
4  * Created on: 24 Apr 2019
5  * Author: Valerio Formato
6  */
7 
8 #ifndef HERD_CaloDBSCANClustering_H_
9 #define HERD_CaloDBSCANClustering_H_
10 
11 // HerdSoftware headers
14 
15 // EventAnalysis headers
16 #include "algorithm/Algorithm.h"
17 
18 using namespace EA;
19 
20 namespace Herd {
21 
22 //clang-format off
51 //clang-format on
52 
53 class CaloDBSCANClustering : public Algorithm {
54 public:
59  CaloDBSCANClustering(const std::string &name);
60 
65  bool Initialize() override;
66 
71  bool Process() override;
72 
81  std::vector<std::string> FreeObjects(const std::vector<std::string> &objs, Memory::Status memStatus) override;
82 
83 private:
84  // Algorithm parameters
85  float _threshold;
86  float _maxDist;
87  unsigned int _minHits;
88  unsigned int _minShowerHits;
89  std::string _caloHitsName;
90 
91  // Class members
93  observer_ptr<CaloGeoParams> _caloGeoParams;
94  EventStorePtr _evStore;
95  GlobalStorePtr _globStore;
96 
97  int nShowers;
98  std::map<unsigned int, int> m_labels; // key: volumeID, value: shower number (label)
99  void FindShowers(CaloHits &caloHits);
100 
101  using HitIt = std::vector<Hit>::const_iterator;
102  void BuildShowerFromSeed(HitIt seedIt, const CaloHits &hits);
103  std::vector<unsigned int> FindNeighborsHitID(HitIt hitIt, const CaloHits &hits);
104  unsigned int CountHitNeighbors(HitIt hitIt, const CaloHits &hits);
105  std::vector<unsigned int> GetNeighboringCubesID(unsigned int volID, CaloGeoParams &caloGeoParams);
106 
107  // value: all neighboring cubes ID to volumeID
108  std::vector<std::vector<unsigned int>> m_neighborCubes;
109  void BuildNeighborsMap(CaloGeoParams &caloGeoParams);
110  const std::vector<unsigned int> &GetNeighboringCubesID(unsigned int volID) { return m_neighborCubes[volID]; };
111 };
112 
113 } // namespace Herd
114 
115 #endif /* HERD_CaloDBSCANClustering_H_ */
CssGeoParams.h CssGeoParams class declaration.
Definition: CaloPDCalibrationAlgo.h:24
observer_ptr< CaloGeoParams > _caloGeoParams
Definition: CaloDBSCANClustering.h:93
Container for a group of hits of the calorimeter.
float _threshold
Definition: CaloDBSCANClustering.h:85
Algorithm that clusters calorimeter hits into showers.
Definition: CaloDBSCANClustering.h:53
CaloClusters _showers
Definition: CaloDBSCANClustering.h:92
unsigned int _minHits
Definition: CaloDBSCANClustering.h:87
GlobalStorePtr _globStore
Definition: CaloDBSCANClustering.h:95
std::string _caloHitsName
Definition: CaloDBSCANClustering.h:89
Data structure for the Calo geometry parameters.
Definition: CaloGeoParams.h:29
const std::vector< unsigned int > & GetNeighboringCubesID(unsigned int volID)
Definition: CaloDBSCANClustering.h:110
unsigned int _minShowerHits
Definition: CaloDBSCANClustering.h:88
float _maxDist
Definition: CaloDBSCANClustering.h:86
std::vector< std::vector< unsigned int > > m_neighborCubes
Definition: CaloDBSCANClustering.h:108
EventStorePtr _evStore
Definition: CaloDBSCANClustering.h:94
int nShowers
Definition: CaloDBSCANClustering.h:97
std::map< unsigned int, int > m_labels
Definition: CaloDBSCANClustering.h:98
std::vector< Hit >::const_iterator HitIt
Definition: CaloDBSCANClustering.h:101
Container for the hits of a single CALO detector.