APRILContent
Algorithm of Particle Reconstruction for ILC - implementation with PandoraSDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations
CaloHitRangeSearchHelper.h
Go to the documentation of this file.
1 /*
3  *
4  * CaloHitRangeSearchHelper.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 CALOHITRANGESEARCHHELPER_H
30 #define CALOHITRANGESEARCHHELPER_H
31 
32 #include "Pandora/PandoraInternal.h"
33 #include "Pandora/StatusCodes.h"
34 
35 #include "APRILObjects/CaloHit.h"
36 #include "APRILObjects/Connector.h"
38 
39 #include <mlpack/core.hpp>
40 #include <mlpack/core/math/range.hpp>
41 #include <mlpack/methods/range_search/range_search.hpp>
42 
43 #include <mlpack/namespace_compat.hpp>
44 
45 namespace pandora { class Algorithm; class CaloHit; class Track; }
46 
47 namespace april_content
48 {
49 typedef mlpack::range::RangeSearch<CaloMetric, arma::mat, mlpack::tree::MeanSplitBallTree> CaloRangeSearch;
50 
55 {
56 public:
57  // build
58  static pandora::StatusCode FillMatixByPoints(const std::vector<pandora::CartesianVector>& points, arma::mat& caloHitsMatrix);
59 
60  static pandora::StatusCode BuildRangeSearch(const pandora::CaloHitList *const pCaloHitList);
61 
62  static pandora::StatusCode BuildHitCollectionOfLayers(const pandora::CaloHitList *const pCaloHitList);
63 
64  static pandora::StatusCode BuildHitCollectionOfEcalLayers(const pandora::CaloHitList *const pEcalCaloHitList);
65 
66  static pandora::StatusCode BuildHitCollectionOfHcalLayers(const pandora::CaloHitList *const pHcalCaloHitList);
67 
68  static pandora::StatusCode BuildHitCollectionOfMuonLayers(const pandora::CaloHitList *const pMuonCaloHitList);
69 
70  static pandora::StatusCode BuildCaloRangeSearch(const pandora::CaloHitVector& caloHitVector);
71 
72  // search
73 
74  static pandora::StatusCode SearchNeighbourHitsInRange(pandora::CartesianVector testPosition, float distance, pandora::CaloHitList& hitsInRange);
75 
76  static pandora::StatusCode SearchHitsInLayer(pandora::CartesianVector testPosition, int pseudoLayer,
77  float distance, pandora::CaloHitList& hitsInRange);
78 
79  static pandora::StatusCode SearchEcalHitsInLayer(pandora::CartesianVector testPosition, int pseudoLayer,
80  float distance, pandora::CaloHitList& hitsInRange);
81 
82  static pandora::StatusCode SearchHcalHitsInLayer(pandora::CartesianVector testPosition, int pseudoLayer,
83  float distance, pandora::CaloHitList& hitsInRange);
84 
85  static pandora::StatusCode SearchMuonHitsInLayer(pandora::CartesianVector testPosition, int pseudoLayer,
86  float distance, pandora::CaloHitList& hitsInRange);
87 
88  static pandora::StatusCode SearchHitsInRange4D(const pandora::CaloHitVector& caloHitVector, const std::vector<float>& testPosition,
89  float distance, pandora::CaloHitList& hitsInRange);
90 
91  static pandora::OrderedCaloHitList* GetOrderedCaloHitList() { return &m_orderedCaloHitList; }
92  static pandora::OrderedCaloHitList* GetOrderedEcalCaloHitList() { return &m_orderedEcalCaloHitList; }
93  static pandora::OrderedCaloHitList* GetOrderedHcalCaloHitList() { return &m_orderedHcalCaloHitList; }
94  static pandora::OrderedCaloHitList* GetOrderedMuonCaloHitList() { return &m_orderedMuonCaloHitList; }
95 
97 
98  static double m_fFillingTime;
99  static double m_fGetttingTime;
100 
101  static pandora::OrderedCaloHitList m_orderedCaloHitList;
102  static pandora::OrderedCaloHitList m_orderedEcalCaloHitList;
103  static pandora::OrderedCaloHitList m_orderedHcalCaloHitList;
104  static pandora::OrderedCaloHitList m_orderedMuonCaloHitList;
105 
106 private:
107  static arma::mat m_caloHitsMatrix;
108 
109  static pandora::StatusCode FillMatixFromCaloHits(const pandora::CaloHitVector& caloHitVector, arma::mat& caloHitsMatrix);
110  static pandora::StatusCode FillMatix4DFromCaloHits(const pandora::CaloHitVector& caloHitVector, arma::mat& caloHitsMatrix4D);
111 
112  // all hits
113  static const pandora::CaloHitList* m_pCaloHitList;
114 
115  // all hits on each layer
116  static const pandora::CaloHitList* m_pCaloHitListOfLayers;
117 
118  // all ecal hits on each layer
119  static const pandora::CaloHitList* m_pEcalCaloHitListOfLayers;
120 
121  // all hcal hits on each layer
122  static const pandora::CaloHitList* m_pHcalCaloHitListOfLayers;
123 
124  // all muon hits on each layer
125  static const pandora::CaloHitList* m_pMuonCaloHitListOfLayers;
126 
127  //-----------------
128  static pandora::CaloHitVector m_caloHitVector;
129 
130  static std::vector<pandora::CaloHitVector> m_caloHitVectorOfLayers;
131  static std::vector<pandora::CaloHitVector> m_ecalCaloHitVectorOfLayers;
132  static std::vector<pandora::CaloHitVector> m_hcalCaloHitVectorOfLayers;
133  static std::vector<pandora::CaloHitVector> m_muonCaloHitVectorOfLayers;
134 
135  static mlpack::range::RangeSearch<> m_rangeSearch;
136  static CaloRangeSearch m_caloRangeSearch;
137 
138  static std::vector< mlpack::range::RangeSearch<> > m_rangeSearchOfLayers;
139  static std::vector< mlpack::range::RangeSearch<> > m_ecalRangeSearchOfLayers;
140  static std::vector< mlpack::range::RangeSearch<> > m_hcalRangeSearchOfLayers;
141  static std::vector< mlpack::range::RangeSearch<> > m_muonRangeSearchOfLayers;
142 
143  //----------------
144  static pandora::StatusCode BuildOrderedHitsAndSearchRange(const pandora::CaloHitList *const pCaloHitList,
145  pandora::OrderedCaloHitList& orderedCaloHitList, std::vector<pandora::CaloHitVector>& caloHitVectorOfLayers,
146  std::vector< mlpack::range::RangeSearch<> >& rangeSearchOfLayers);
147 
148  static pandora::StatusCode BuildHitCollectionForSearching(
149  const pandora::CaloHitList *const pCaloHitList,
150  const pandora::CaloHitList*& pCaloHitListOfLayers,
151  pandora::OrderedCaloHitList& orderedCaloHitList,
152  std::vector<pandora::CaloHitVector>& caloHitVectorOfLayers,
153  std::vector< mlpack::range::RangeSearch<> >& rangeSearchOfLayers);
154 
155  static pandora::StatusCode SearchHitsInRange(mlpack::range::RangeSearch<>& rangeSearch, pandora::CaloHitVector& caloHitVector,
156  pandora::CartesianVector testPosition, float distance, pandora::CaloHitList& hitsInRange);
157 };
158 
159 }
160 
161 #endif
CaloHitRangeSearchHelper class.
Definition: CaloHitRangeSearchHelper.h:54