IDiffusion.h
Go to the documentation of this file.
1 #ifndef WIRECELL_IDIFFUSION
2 #define WIRECELL_IDIFFUSION
3 
4 #include "WireCellIface/IData.h"
5 #include "WireCellIface/IDepo.h"
6 
7 namespace WireCell {
8 
9  /** An interface to information about charge which has diffused in
10  * longitudinal and transverse directions.
11  *
12  * The diffusion is a rectangular patch of (charge) values on a
13  * regular grid defined in longitudinal vs. transverse space.
14  * Bins are typically tick vs. wire pitch or vs. impact position.
15  *
16  * See also WireCell::IDiffuser which is one interface that
17  * produces these objects.
18  */
19  class IDiffusion : public IData<IDiffusion>
20  {
21  public:
22 
23  virtual ~IDiffusion();
24 
25  /// Return the deposition that led to this diffusion.
26  virtual IDepo::pointer depo() const = 0;
27 
28  /// Get value at bin.
29  virtual double get(int lind, int tind) const = 0;
30 
31  /// Helper method to give the array size in longitudinal dimension.
32  virtual int lsize() const = 0 ;
33 
34  /// Helper method to give the array size in transverse dimension.
35  virtual int tsize() const = 0;
36 
37  // Longitudinal position at index with extra offset (0.5 is bin center).
38  virtual double lpos(int ind, double offset=0.0) const = 0;
39 
40  // Transverse position at index with extra offset (0.5 is bin center).
41  virtual double tpos(int ind, double offset=0.0) const = 0;
42 
43  /// Return begin of diffusion patch in longitudinal direction.
44  double lbegin() const { return lpos(0); }
45  /// Return begin of diffusion patch in transverse direction.
46  double tbegin() const { return tpos(0); }
47  /// Return end of diffusion patch in longitudinal direction.
48  double lend() const { return lpos(lsize()); }
49  /// Return end of diffusion patch in transverse direction.
50  double tend() const { return tpos(tsize()); }
51  /// Return bins size in longitudinal direction.
52  double lbin() const { return lpos(1) - lpos(0); }
53  /// Return bins size in transverse direction.
54  double tbin() const { return tpos(1) - tpos(0); }
55  };
56 
57  // A set ordered by beginning of patch
59  bool operator()(const IDiffusion::pointer& lhs, const IDiffusion::pointer& rhs) const {
60  if (lhs->lbegin() == rhs->lbegin()) {
61  return lhs.get() < rhs.get(); // break tie with pointer
62  }
63  return lhs->lbegin() < rhs->lbegin();
64  }
65  };
66  typedef std::set<IDiffusion::pointer, IDiffusionCompareLbegin> IDiffusionSet;
67 
68 
69 }
70 #endif
std::shared_ptr< const IDepo > pointer
Definition: IData.h:19
double tbegin() const
Return begin of diffusion patch in transverse direction.
Definition: IDiffusion.h:46
double lbin() const
Return bins size in longitudinal direction.
Definition: IDiffusion.h:52
bool operator()(const IDiffusion::pointer &lhs, const IDiffusion::pointer &rhs) const
Definition: IDiffusion.h:59
virtual int lsize() const =0
Helper method to give the array size in longitudinal dimension.
virtual double lpos(int ind, double offset=0.0) const =0
virtual IDepo::pointer depo() const =0
Return the deposition that led to this diffusion.
double lend() const
Return end of diffusion patch in longitudinal direction.
Definition: IDiffusion.h:48
Definition: Main.h:22
std::set< IDiffusion::pointer, IDiffusionCompareLbegin > IDiffusionSet
Definition: IDiffusion.h:66
virtual int tsize() const =0
Helper method to give the array size in transverse dimension.
double lbegin() const
Return begin of diffusion patch in longitudinal direction.
Definition: IDiffusion.h:44
virtual double tpos(int ind, double offset=0.0) const =0
double tend() const
Return end of diffusion patch in transverse direction.
Definition: IDiffusion.h:50
double tbin() const
Return bins size in transverse direction.
Definition: IDiffusion.h:54