Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
wire-cell-build
util
inc
WireCellUtil
BufferedHistogram2D.h
Go to the documentation of this file.
1
#ifndef WIRECELL_BUFFEREDHISTOGRAM2D
2
#define WIRECELL_BUFFEREDHISTOGRAM2D
3
4
#include <vector>
5
#include <deque>
6
7
namespace
WireCell
{
8
9
/** A 2D histogram which can expand its range based on filling and
10
* have its edge sliced off.
11
*/
12
class
BufferedHistogram2D
{
13
double
m_xmin
,
m_ymin
,
m_xbinsize
,
m_ybinsize
;
14
15
16
typedef
std::vector<double>
XBin
;
17
typedef
std::deque<XBin>
XBinDeque
;
18
XBinDeque
m_xbindeque
;
19
public
:
20
21
/// Create a buffered 2d histogram with lower corner at xmin,
22
/// ymin and with bins of given sizes.
23
BufferedHistogram2D
(
double
xbinsize
=1.0,
double
ybinsize
=1.0,
24
double
xmin
=0.0,
double
ymin
=0.0);
25
26
/// Add v to the bin holding x,y. Return false if point is out of bounds.
27
bool
fill
(
double
x
,
double
y
,
double
v=1.0);
28
29
/// Slice off the lowest X bin and return it as a vector.
30
/// Note, the zeroth element of the vector corresponds to the
31
/// bin starting at ymin but the length of vector may not
32
/// represent the global ymax.
33
std::vector<double>
popx
();
34
35
/// popy is not yet implemented.
36
// std::vector<double> popy();
37
38
// return buffer depth
39
int
size
()
const
{
return
m_xbindeque.size(); }
40
int
xsize
()
const
{
return
size
(); }
41
// return the maximum size in Y
42
int
ysize
()
const
;
43
44
double
xmin
()
const
{
return
m_xmin
; }
45
double
ymin
()
const
{
return
m_ymin
; }
46
double
xmax
()
const
;
47
double
ymax
()
const
;
48
double
xbinsize
()
const
{
return
m_xbinsize
; }
49
double
ybinsize
()
const
{
return
m_ybinsize
; }
50
51
};
52
53
}
54
55
#endif
WireCell::BufferedHistogram2D::ysize
int ysize() const
Definition:
BufferedHistogram2D.cxx:21
WireCell::BufferedHistogram2D::fill
bool fill(double x, double y, double v=1.0)
Add v to the bin holding x,y. Return false if point is out of bounds.
Definition:
BufferedHistogram2D.cxx:31
WireCell::BufferedHistogram2D
Definition:
BufferedHistogram2D.h:12
WireCell::BufferedHistogram2D::BufferedHistogram2D
BufferedHistogram2D(double xbinsize=1.0, double ybinsize=1.0, double xmin=0.0, double ymin=0.0)
Definition:
BufferedHistogram2D.cxx:7
WireCell::BufferedHistogram2D::ymax
double ymax() const
Definition:
BufferedHistogram2D.cxx:17
WireCell::BufferedHistogram2D::ymin
double ymin() const
Definition:
BufferedHistogram2D.h:45
WireCell::BufferedHistogram2D::m_xmin
double m_xmin
Definition:
BufferedHistogram2D.h:13
WireCell::BufferedHistogram2D::xmin
double xmin() const
Definition:
BufferedHistogram2D.h:44
WireCell::BufferedHistogram2D::xbinsize
double xbinsize() const
Definition:
BufferedHistogram2D.h:48
WireCell::BufferedHistogram2D::m_ymin
double m_ymin
Definition:
BufferedHistogram2D.h:13
y
double y
Definition:
GapWidth_module.cc:109
WireCell::BufferedHistogram2D::XBin
std::vector< double > XBin
Definition:
BufferedHistogram2D.h:16
WireCell::BufferedHistogram2D::popx
std::vector< double > popx()
Definition:
BufferedHistogram2D.cxx:54
WireCell::BufferedHistogram2D::xsize
int xsize() const
Definition:
BufferedHistogram2D.h:40
WireCell
Definition:
Main.h:22
WireCell::BufferedHistogram2D::m_xbinsize
double m_xbinsize
Definition:
BufferedHistogram2D.h:13
WireCell::BufferedHistogram2D::ybinsize
double ybinsize() const
Definition:
BufferedHistogram2D.h:49
WireCell::BufferedHistogram2D::m_ybinsize
double m_ybinsize
Definition:
BufferedHistogram2D.h:13
train.x
list x
Definition:
train.py:276
WireCell::BufferedHistogram2D::xmax
double xmax() const
Definition:
BufferedHistogram2D.cxx:13
WireCell::BufferedHistogram2D::XBinDeque
std::deque< XBin > XBinDeque
Definition:
BufferedHistogram2D.h:17
WireCell::BufferedHistogram2D::size
int size() const
popy is not yet implemented.
Definition:
BufferedHistogram2D.h:39
WireCell::BufferedHistogram2D::m_xbindeque
XBinDeque m_xbindeque
Definition:
BufferedHistogram2D.h:18
Generated by
1.8.11