APRILContent
Algorithm of Particle Reconstruction for ILC - implementation with PandoraSDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations
Cluster.h
Go to the documentation of this file.
1 /*
3  *
4  * Cluster.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 APRILCLUSTER_H
30 #define APRILCLUSTER_H
31 
32 #include "Objects/Cluster.h"
33 
34 #include "Api/PandoraApi.h"
35 #include "Api/PandoraContentApi.h"
36 
37 
38 #include "Pandora/PandoraInputTypes.h"
40 
42 
43 //#include "APRILObjects/APRILMetaData.h"
44 
45 namespace april_content
46 {
47 
48 class ClusterFactory;
49 
51 {
52 public:
54  : m_orderParameter(std::numeric_limits<float>::max())
55  {
56  }
57 
58  ClustersOrderParameter(std::vector<float> parameters, std::vector<float> powers)
59  : m_parameters(parameters), m_powers(powers)
60  {
61  if(m_parameters.size() != m_powers.size())
62  {
63  std::cout << "parameters and powers length are not consistent!" << std::endl;
64  throw pandora::StatusCodeException(pandora::STATUS_CODE_FAILURE);
65  }
66 
67  m_orderParameter = 1.;
68 
69  for(int i = 0; i < m_parameters.size(); ++i)
70  {
71  m_orderParameter *= std::pow(m_parameters.at(i), m_powers.at(i));
72  }
73  }
74 
75  bool operator<(const ClustersOrderParameter& a) const
76  {
77  return m_orderParameter < a.m_orderParameter;
78  }
79 
80  std::vector<float> m_parameters;
81  std::vector<float> m_powers;
82 
83  float m_orderParameter;
84 };
85 
89 class APRILCluster : public pandora::Cluster
90 {
91 public:
92  float GetMergedHadronicEnergy();
93 
94  std::vector<APRILCluster*>& GetMotherCluster();
95 
96  void Reset();
97  void ResetRelationShip();
98  void ClearMotherCluster();
99  const std::set<APRILCluster*>& GetClustersToMerge() const;
100  void ClearClustersToMerge();
101  void GetAllClustersToMerge(std::set<APRILCluster*>& allClustersToMerge) const;
102  const std::vector<APRILCluster*>& GetNearbyClusters() const;
103  const APRILCluster* GetMotherAtSearch() const;
104 
105  const pandora::CartesianVector& GetAxis() const;
106  const pandora::CartesianVector& GetIntercept() const;
107  const pandora::CartesianVector& GetCentroid() const;
108  const pandora::CartesianVector& GetStartingPoint() const;
109  const pandora::CartesianVector& GetEndpoint() const;
110 
111  const pandora::OrderedCaloHitList& GetMainOrderedClusterHits() const;
112  const pandora::CaloHitList& GetMainClusterHits() const;
113 
114  bool IsRoot();
115  bool HasMotherAtSearch();
116  bool IsDaughter(APRILCluster* cluster);
117  bool IsPhoton();
118  bool IsFragment();
119 
120  void SetHasMotherAtSearch(bool hasMotherAtSearch = true);
121  void SetMotherAtSearch(APRILCluster* cluster);
122  void ResetMotherAtSearch();
123  void SetMotherCluster(APRILCluster* cluster);
124  void SetClustersToMerge(const std::vector<APRILCluster*>& clusterVector);
125  void RemoveFromClustersToMerge(APRILCluster* cluster);
126  void SetNearbyClusters(const std::vector<APRILCluster*>& clusterVector);
127 
128  void SetAxis(pandora::CartesianVector axis);
129  void SetIntercept(pandora::CartesianVector intercept);
130  void SetCentroid(pandora::CartesianVector centrod);
131  void SetStartingPoint(pandora::CartesianVector startingPoint);
132  void SetEndpoint(pandora::CartesianVector endpoint);
133 
134  void SetMainOrderedClusterHits(pandora::OrderedCaloHitList mainOrderedClusterHits);
135  void SetMainClusterHits(pandora::CaloHitList mainClusterHits);
136 
137  void SetOrderParameterWithMother(APRILCluster* motherCluster, ClustersOrderParameter& clustersOrderParameter);
138 
139  ClustersOrderParameter GetOrderParameterWithMother(APRILCluster* motherCluster);
140 
141  void SetPhoton(bool isPhoton);
142  void SetRoot();
143  void SetFragment();
144 
145 private:
146 
147  //
148  APRILCluster(const PandoraContentApi::Cluster::Parameters &parameters);
149 
150  ~APRILCluster();
151 
152 
153 protected:
154  std::vector<APRILCluster*> m_motherCluster;
155 
156  std::set<APRILCluster*> m_clustersToMerge;
157  std::vector<APRILCluster*> m_nearbyClusters;
158 
159  pandora::CartesianVector m_axis;
160  pandora::CartesianVector m_intercept;
161  pandora::CartesianVector m_centroid;
162  pandora::CartesianVector m_startingPoint;
163  pandora::CartesianVector m_endpoint;
164 
165  bool m_isPhoton;
166  bool m_isRoot;
167  bool m_hasMotherAtSearch;
168  bool m_isFragment;
169 
170  APRILCluster* m_motherAtSearch;
171 
172  std::map<APRILCluster*, ClustersOrderParameter> m_orderWithMotherClusters;
173 
174  pandora::OrderedCaloHitList m_mainOrderedClusterHits;
175  pandora::CaloHitList m_mainClusterHits;
176 
177  friend class ClusterFactory;
178 };
179 
180 }
181 
182 #endif
ClusterFactory class.
Definition: ObjectFactories.h:126
Cluster class.
Definition: Cluster.h:89