LArXOverlap.h
Go to the documentation of this file.
1 /**
2  * @file larpandoracontent/LArObjects/LArXOverlap.h
3  *
4  * @brief Header file for the lar x overlap class.
5  *
6  * $Log: $
7  */
8 #ifndef LAR_X_OVERLAP_H
9 #define LAR_X_OVERLAP_H 1
10 
11 namespace lar_content
12 {
13 
14 /**
15  * @brief XOverlap class
16  */
17 class XOverlap
18 {
19 public:
20  /**
21  * @brief Constructor
22  *
23  * @param uMinX min x value in the u view
24  * @param uMaxX max x value in the u view
25  * @param vMinX min x value in the v view
26  * @param vMaxX max x value in the v view
27  * @param wMinX min x value in the w view
28  * @param wMaxX max x value in the w view
29  * @param xOverlapSpan the x overlap span
30  */
31  XOverlap(const float uMinX, const float uMaxX, const float vMinX, const float vMaxX, const float wMinX, const float wMaxX, const float xOverlapSpan);
32 
33  /**
34  * @brief Get the min x value in the u view
35  *
36  * @return the min x value in the u view
37  */
38  float GetUMinX() const;
39 
40  /**
41  * @brief Get the max x value in the u view
42  *
43  * @return the max x value in the u view
44  */
45  float GetUMaxX() const;
46 
47  /**
48  * @brief Get the min x value in the v view
49  *
50  * @return the min x value in the v view
51  */
52  float GetVMinX() const;
53 
54  /**
55  * @brief Get the max x value in the v view
56  *
57  * @return the max x value in the v view
58  */
59  float GetVMaxX() const;
60 
61  /**
62  * @brief Get the min x value in the w view
63  *
64  * @return the min x value in the w view
65  */
66  float GetWMinX() const;
67 
68  /**
69  * @brief Get the max x value in the w view
70  *
71  * @return the max x value in the w view
72  */
73  float GetWMaxX() const;
74 
75  /**
76  * @brief Get the x span in the u view
77  *
78  * @return the x span in the u view
79  */
80  float GetXSpanU() const;
81 
82  /**
83  * @brief Get the x span in the v view
84  *
85  * @return the x span in the v view
86  */
87  float GetXSpanV() const;
88 
89  /**
90  * @brief Get the x span in the w view
91  *
92  * @return the x span in the w view
93  */
94  float GetXSpanW() const;
95 
96  /**
97  * @brief Get the x overlap span
98  *
99  * @return the x overlap span
100  */
101  float GetXOverlapSpan() const;
102 
103 private:
104  float m_uMinX; ///< The min x value in the u view
105  float m_uMaxX; ///< The max x value in the u view
106  float m_vMinX; ///< The min x value in the v view
107  float m_vMaxX; ///< The max x value in the v view
108  float m_wMinX; ///< The min x value in the w view
109  float m_wMaxX; ///< The max x value in the w view
110  float m_xOverlapSpan; ///< The x overlap span
111 };
112 
113 /**
114  * @brief x overlap result + operator
115  *
116  * @param lhs the first x overlap result to add
117  * @param rhs the second x overlap result to add
118  */
119 XOverlap operator+(const XOverlap &lhs, const XOverlap &rhs);
120 
121 //------------------------------------------------------------------------------------------------------------------------------------------
122 
123 inline XOverlap::XOverlap(const float uMinX, const float uMaxX, const float vMinX, const float vMaxX, const float wMinX, const float wMaxX,
124  const float xOverlapSpan) :
125  m_uMinX(uMinX),
126  m_uMaxX(uMaxX),
127  m_vMinX(vMinX),
128  m_vMaxX(vMaxX),
129  m_wMinX(wMinX),
130  m_wMaxX(wMaxX),
131  m_xOverlapSpan(xOverlapSpan)
132 {
133 }
134 
135 //------------------------------------------------------------------------------------------------------------------------------------------
136 
137 inline float XOverlap::GetUMinX() const
138 {
139  return m_uMinX;
140 }
141 
142 //------------------------------------------------------------------------------------------------------------------------------------------
143 
144 inline float XOverlap::GetUMaxX() const
145 {
146  return m_uMaxX;
147 }
148 
149 //------------------------------------------------------------------------------------------------------------------------------------------
150 
151 inline float XOverlap::GetVMinX() const
152 {
153  return m_vMinX;
154 }
155 
156 //------------------------------------------------------------------------------------------------------------------------------------------
157 
158 inline float XOverlap::GetVMaxX() const
159 {
160  return m_vMaxX;
161 }
162 
163 //------------------------------------------------------------------------------------------------------------------------------------------
164 
165 inline float XOverlap::GetWMinX() const
166 {
167  return m_wMinX;
168 }
169 
170 //------------------------------------------------------------------------------------------------------------------------------------------
171 
172 inline float XOverlap::GetWMaxX() const
173 {
174  return m_wMaxX;
175 }
176 
177 //------------------------------------------------------------------------------------------------------------------------------------------
178 
179 inline float XOverlap::GetXSpanU() const
180 {
181  return std::fabs(m_uMaxX - m_uMinX);
182 }
183 
184 //------------------------------------------------------------------------------------------------------------------------------------------
185 
186 inline float XOverlap::GetXSpanV() const
187 {
188  return std::fabs(m_vMaxX - m_vMinX);
189 }
190 
191 //------------------------------------------------------------------------------------------------------------------------------------------
192 
193 inline float XOverlap::GetXSpanW() const
194 {
195  return std::fabs(m_wMaxX - m_wMinX);
196 }
197 
198 //------------------------------------------------------------------------------------------------------------------------------------------
199 
200 inline float XOverlap::GetXOverlapSpan() const
201 {
202  return m_xOverlapSpan;
203 }
204 
205 //------------------------------------------------------------------------------------------------------------------------------------------
206 
207 inline XOverlap operator+(const XOverlap &lhs, const XOverlap &rhs)
208 {
209  const float uMinX(std::min(lhs.GetUMinX(), rhs.GetUMinX()));
210  const float uMaxX(std::max(lhs.GetUMaxX(), rhs.GetUMaxX()));
211  const float vMinX(std::min(lhs.GetVMinX(), rhs.GetVMinX()));
212  const float vMaxX(std::max(lhs.GetVMaxX(), rhs.GetVMaxX()));
213  const float wMinX(std::min(lhs.GetWMinX(), rhs.GetWMinX()));
214  const float wMaxX(std::max(lhs.GetWMaxX(), rhs.GetWMaxX()));
215  const float minX(std::max(uMinX, std::max(vMinX, wMinX)));
216  const float maxX(std::min(uMaxX, std::min(vMaxX, wMaxX)));
217  const float xOverlapSpan(maxX - minX);
218 
219  return XOverlap(uMinX, uMaxX, vMinX, vMaxX, wMinX, wMaxX, xOverlapSpan);
220 }
221 
222 } // namespace lar_content
223 
224 #endif // #ifndef LAR_X_OVERLAP_H
float GetWMinX() const
Get the min x value in the w view.
Definition: LArXOverlap.h:165
float GetXSpanV() const
Get the x span in the v view.
Definition: LArXOverlap.h:186
float GetUMinX() const
Get the min x value in the u view.
Definition: LArXOverlap.h:137
TransverseOverlapResult operator+(const TransverseOverlapResult &lhs, const TransverseOverlapResult &rhs)
Transverse overlap result + operator.
float GetXSpanW() const
Get the x span in the w view.
Definition: LArXOverlap.h:193
float GetVMinX() const
Get the min x value in the v view.
Definition: LArXOverlap.h:151
XOverlap(const float uMinX, const float uMaxX, const float vMinX, const float vMaxX, const float wMinX, const float wMaxX, const float xOverlapSpan)
Constructor.
Definition: LArXOverlap.h:123
float m_wMinX
The min x value in the w view.
Definition: LArXOverlap.h:108
float m_vMinX
The min x value in the v view.
Definition: LArXOverlap.h:106
float m_xOverlapSpan
The x overlap span.
Definition: LArXOverlap.h:110
float GetVMaxX() const
Get the max x value in the v view.
Definition: LArXOverlap.h:158
float GetXOverlapSpan() const
Get the x overlap span.
Definition: LArXOverlap.h:200
static int max(int a, int b)
float m_vMaxX
The max x value in the v view.
Definition: LArXOverlap.h:107
float GetUMaxX() const
Get the max x value in the u view.
Definition: LArXOverlap.h:144
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
float GetXSpanU() const
Get the x span in the u view.
Definition: LArXOverlap.h:179
float GetWMaxX() const
Get the max x value in the w view.
Definition: LArXOverlap.h:172
float m_wMaxX
The max x value in the w view.
Definition: LArXOverlap.h:109
XOverlap class.
Definition: LArXOverlap.h:17
float m_uMinX
The min x value in the u view.
Definition: LArXOverlap.h:104
float m_uMaxX
The max x value in the u view.
Definition: LArXOverlap.h:105