APRILContent
Algorithm of Particle Reconstruction for ILC - implementation with PandoraSDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations
CaloHitNeighborSearchHelper.h
Go to the documentation of this file.
1 /*
3  *
4  * CaloHitNeighborSearchHelper.h header template automatically generated by a class generator
5  * Creation date : lun. mars 30 2015
6  *
7  * This file is part of APRILContent libraries.
8  *
9  * APRILContent is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 3 of the License, or
12  * (at your option) any later version.
13  * based upon these libraries are permitted. Any copy of these libraries
14  * must include this copyright notice.
15  *
16  * APRILContent is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with APRILContent. If not, see <http://www.gnu.org/licenses/>.
23  *
24  * @author Remi Ete
25  * @copyright CNRS , IPNL
26  */
27 
28 
29 #ifndef CALOHITNEIGHBORSEARCHHELPER_H
30 #define CALOHITNEIGHBORSEARCHHELPER_H
31 
32 #include <vector>
33 
34 #include "Pandora/PandoraInternal.h"
35 #include "Pandora/StatusCodes.h"
36 
37 #include "APRILObjects/CaloHit.h"
38 #include "APRILObjects/Connector.h"
39 
41 
42 #include <mlpack/core.hpp>
43 #include <mlpack/core/math/range.hpp>
44 #include <mlpack/methods/neighbor_search/neighbor_search.hpp>
45 
46 #include <mlpack/methods/dbscan/dbscan.hpp>
47 
48 #include <mlpack/namespace_compat.hpp>
49 
50 namespace pandora { class Algorithm; class CaloHit; class Track; }
51 
52 namespace april_content
53 {
54 
55 typedef mlpack::neighbor::NeighborSearch<mlpack::neighbor::NearestNeighborSort, CaloMetric, arma::mat, mlpack::tree::MeanSplitBallTree> CaloKNN;
56 typedef mlpack::dbscan::DBSCAN< mlpack::range::RangeSearch<> > MLPACKDBSCAN;
57 typedef mlpack::dbscan::DBSCAN< mlpack::range::RangeSearch<CaloMetric, arma::mat, mlpack::tree::MeanSplitBallTree> > CaloDBSCAN;
58 
63 {
64 public:
65  // build
66  static pandora::StatusCode BuildNeighborSearch(const pandora::CaloHitList *const pCaloHitList);
67  static pandora::StatusCode BuildCaloNeighborSearch(const pandora::CaloHitVector& caloHitVector);
68 
69  // search
70  static pandora::StatusCode SearchNeighbourHits(pandora::CartesianVector testPosition, int nNeighbor, pandora::CaloHitList& neighborHits);
71 
72  static pandora::StatusCode SearchNeighbourHits4D(std::vector<float> testPosition, int nNeighbor, pandora::CaloHitList& neighborHits);
73 
74  static pandora::StatusCode ClusteringByDBSCAN(const pandora::CaloHitVector& caloHitVector,
75  std::vector<pandora::CaloHitVector>& hitsForCluster, float eps, int minPoints);
76 
77  static pandora::StatusCode ClusteringByDBSCAN4D(const pandora::CaloHitVector& caloHitVector,
78  std::vector<pandora::CaloHitVector>& hitsForCluster, float eps, int minPoints);
79 
80 private:
81 
82  static pandora::StatusCode FillMatixFromCaloHits(const pandora::CaloHitVector& caloHitVector, arma::mat& caloHitsMatrix);
83  static pandora::StatusCode FillMatix4DFromCaloHits(const pandora::CaloHitVector& caloHitVector, arma::mat& caloHitsMatrix4D);
84 
85  static arma::mat m_caloHitsMatrix;
86  static arma::mat m_caloHitsMatrix4D; // store calohit in 4D (x, y, z, layer)
87 
88  // all hits
89  static const pandora::CaloHitList* m_pCaloHitList;
90 
91  //-----------------
92  static pandora::CaloHitVector m_caloHitVector;
93 
94  static mlpack::neighbor::KNN m_neighborSearch;
95  static CaloKNN m_neighborSearch4D;
96 
97  static CaloDBSCAN m_caloDBSCAN;
98 };
99 
100 }
101 
102 #endif
CaloHitNeighborSearchHelper class.
Definition: CaloHitNeighborSearchHelper.h:62