Diffusion.cxx
Go to the documentation of this file.
2 using namespace WireCell;
3 
5  int nlong, int ntrans, double lmin, double tmin, double lmax, double tmax)
6  : m_depo(depo),
7  array(boost::extents[nlong][ntrans])
8  , lmin(lmin), tmin(tmin), lmax(lmax), tmax(tmax)
9 {
10  lbin = (lmax-lmin) / nlong;
11  tbin = (tmax-tmin) / ntrans;
12 }
13 
15  : m_depo(other.m_depo)
16  , array(other.array)
17  , lmin(other.lmin), tmin(other.tmin), lmax(other.lmax), tmax(other.tmax)
18 {
19 }
20 
22 {
23  m_depo = other.m_depo;
24  array.resize(boost::extents[other.lsize()][other.tsize()]);
25  array = other.array;
26  lmin = other.lmin;
27  tmin = other.tmin;
28  lmax = other.lmax;
29  tmax = other.tmax;
30  // isn't C++ fun?
31  return *this;
32 }
33 
34 
36 {
37 }
38 
40 {
41  return m_depo;
42 }
43 int Diffusion::lsize() const
44 {
45  return array.shape()[0];
46 }
47 int Diffusion::tsize() const
48 {
49  return array.shape()[1];
50 }
51 
52 double Diffusion::get(int lind, int tind) const
53 {
54  return array[lind][tind];
55 }
56 double Diffusion::set(int lind, int tind, double value)
57 {
58  array[lind][tind] = value;
59  return value;
60 }
61 
62 double Diffusion::lpos(int ind, double offset) const
63 {
64  return lmin + (ind+offset)*lbin;
65 }
66 
67 double Diffusion::tpos(int ind, double offset) const
68 {
69  return tmin + (ind+offset)*tbin;
70 }
virtual int lsize() const
Helper method to give the array size in longitudinal dimension.
Definition: Diffusion.cxx:43
std::shared_ptr< const IDepo > pointer
Definition: IData.h:19
virtual double tpos(int ind, double offset=0.0) const
Definition: Diffusion.cxx:67
Diffusion(IDepo::pointer depo, int nlong, int ntrans, double lmin, double tmin, double lmax, double tmax)
Definition: Diffusion.cxx:4
virtual ~Diffusion()
Definition: Diffusion.cxx:35
virtual double set(int lind, int tind, double value)
Definition: Diffusion.cxx:56
double lbin() const
Return bins size in longitudinal direction.
Definition: IDiffusion.h:52
IDepo::pointer m_depo
Definition: Diffusion.h:14
virtual double lpos(int ind, double offset=0.0) const
Definition: Diffusion.cxx:62
auto array(Array const &a)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:228
virtual int tsize() const
Helper method to give the array size in transverse dimension.
Definition: Diffusion.cxx:47
virtual IDepo::pointer depo() const
Return the deposition that led to this diffusion.
Definition: Diffusion.cxx:39
Diffusion & operator=(const Diffusion &other)
Definition: Diffusion.cxx:21
Definition: Main.h:22
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1225
virtual double get(int lind, int tind) const
Get value at bin.
Definition: Diffusion.cxx:52
boost::multi_array< double, 2 > array
Definition: Diffusion.h:15
double tbin() const
Return bins size in transverse direction.
Definition: IDiffusion.h:54