IDepo.h
Go to the documentation of this file.
1 #ifndef WIRECELL_IDEPO
2 #define WIRECELL_IDEPO
3 
4 #include "WireCellIface/IData.h"
5 #include "WireCellUtil/Point.h"
6 #include "WireCellUtil/Units.h"
7 
8 #include <set>
9 
10 namespace WireCell {
11 
12  /** An interface to information about a deposition of charge.
13  */
14  class IDepo : public IData<IDepo> {
15  public:
16 
17  virtual ~IDepo() ;
18 
19  /// The location of the deposition.
20  virtual const Point& pos() const = 0;
21 
22  /// The number of seconds from some absolute start time to
23  /// when the deposition occur ed.
24  virtual double time() const = 0;
25 
26  /// The number charge (in units of number of electrons) deposited.
27  virtual double charge() const = 0;
28 
29  /// The energy (in units of MeV) deposited.
30  virtual double energy() const = 0;
31 
32  /// Track ID from Geant4
33  virtual int id() const = 0;
34 
35  /// PDG code from Geant4
36  virtual int pdg() const = 0;
37 
38  /// If the deposition is drifted, this may allow access to the original.
39  virtual pointer prior() const = 0;
40 
41  /// Any (half width) extent in the longitudinal (drift)
42  /// direction (distance). The distribution is implicit but
43  /// typically it is taken that this is a Gaussian sigma.
44  virtual double extent_long() const { return 0.0; }
45 
46  /// Any (half width) extent in the transverse (pitch)
47  /// direction (distance). The distribution is implicit but
48  /// typically it is taken that this is a Gaussian sigma.
49  virtual double extent_tran() const { return 0.0; }
50 
51  };
52 
53  /// Simple utility to return a vector of depositions formed by
54  /// walking the prior() chain. The vector begins with the most
55  /// recent.
57 
58  /// Compare how "far" two depositions are from the origin along
59  /// the drift-line (metric: dT + dX/V_drift) given a drift
60  /// velocity. Note: if drifting is toward a "back" face of an
61  /// anode then the drift speed should be negative in order to
62  /// indicate drift is in the postitive X direction..
64  double drift_speed;
65  IDepoDriftCompare(double drift_speed = 1.6 *units::mm/units::microsecond)
66  : drift_speed(drift_speed) {};
67  bool operator()(const IDepo::pointer& lhs, const IDepo::pointer& rhs) const {
68  double t1 = lhs->time() + lhs->pos().x()/drift_speed;
69  double t2 = rhs->time() + rhs->pos().x()/drift_speed;
70  if (t1 == t2) {
71  // make sure there are no ties due to precision!
72  return lhs.get() < rhs.get();
73  }
74  return t1 < t2;
75  }
76  };
77  typedef std::set<IDepo::pointer, IDepoDriftCompare> DepoTauSortedSet;
78 
79  /// Compare two IDepo::pointer by time (ascending). x is used to break tie
81 
82  /// Compare two IDepo::pointers for by time, descending. x is used to break tie
84 
85 
86 }
87 
88 #endif
virtual int pdg() const =0
PDG code from Geant4.
std::shared_ptr< const IDepo > pointer
Definition: IData.h:19
IDepo::vector depo_chain(IDepo::pointer recent)
Definition: IDepo.cxx:4
virtual double extent_long() const
Definition: IDepo.h:44
virtual double extent_tran() const
Definition: IDepo.h:49
virtual const Point & pos() const =0
The location of the deposition.
static const double microsecond
Definition: Units.h:94
virtual pointer prior() const =0
If the deposition is drifted, this may allow access to the original.
std::vector< pointer > vector
Definition: IData.h:21
virtual double charge() const =0
The number charge (in units of number of electrons) deposited.
bool operator()(const IDepo::pointer &lhs, const IDepo::pointer &rhs) const
Definition: IDepo.h:67
std::set< IDepo::pointer, IDepoDriftCompare > DepoTauSortedSet
Definition: IDepo.h:77
const double drift_speed
static const double mm
Definition: Units.h:55
virtual int id() const =0
Track ID from Geant4.
Definition: Main.h:22
bool descending_time(const WireCell::IDepo::pointer &lhs, const WireCell::IDepo::pointer &rhs)
Compare two IDepo::pointers for by time, descending. x is used to break tie.
Definition: IDepo.cxx:29
virtual double energy() const =0
The energy (in units of MeV) deposited.
IDepoDriftCompare(double drift_speed=1.6 *units::mm/units::microsecond)
Definition: IDepo.h:65
bool ascending_time(const WireCell::IDepo::pointer &lhs, const WireCell::IDepo::pointer &rhs)
Compare two IDepo::pointer by time (ascending). x is used to break tie.
Definition: IDepo.cxx:17
virtual double time() const =0