LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
LArXOverlap.h
Go to the documentation of this file.
1 
8 #ifndef LAR_X_OVERLAP_H
9 #define LAR_X_OVERLAP_H 1
10 
11 namespace lar_content
12 {
13 
17 class XOverlap
18 {
19 public:
31  XOverlap(const float uMinX, const float uMaxX, const float vMinX, const float vMaxX, const float wMinX, const float wMaxX, const float xOverlapSpan);
32 
38  float GetUMinX() const;
39 
45  float GetUMaxX() const;
46 
52  float GetVMinX() const;
53 
59  float GetVMaxX() const;
60 
66  float GetWMinX() const;
67 
73  float GetWMaxX() const;
74 
80  float GetXSpanU() const;
81 
87  float GetXSpanV() const;
88 
94  float GetXSpanW() const;
95 
101  float GetXOverlapSpan() const;
102 
103 private:
104  float m_uMinX;
105  float m_uMaxX;
106  float m_vMinX;
107  float m_vMaxX;
108  float m_wMinX;
109  float m_wMaxX;
111 };
112 
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,
124  const float wMinX, const float wMaxX, 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
Int_t max
Definition: plot.C:27
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
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
Int_t min
Definition: plot.C:26
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