Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
WireCell::Gen::DepoPlaneX Class Reference

#include <DepoPlaneX.h>

Public Types

typedef std::deque< IDepo::pointerfrozen_queue_t
 
typedef DepoTauSortedSet working_queue_t
 

Public Member Functions

 DepoPlaneX (double planex=0.0 *units::cm, double speed=1.6 *units::millimeter/units::microsecond)
 
IDepo::pointer add (const IDepo::pointer &depo)
 
double proper_time (IDepo::pointer depo) const
 The time a deposition would have if it drifts to the plane. More...
 
double freezeout_time () const
 
void freezeout ()
 Force any remaining "thawed" depos in the queue to be frozen out. More...
 
IDepo::vector pop (double time)
 
const frozen_queue_tfrozen_queue () const
 
const working_queue_tworking_queue () const
 

Private Member Functions

void drain (double time)
 Move all froze-out depos to the frozen queue. More...
 

Private Attributes

double m_planex
 
double m_speed
 
working_queue_t m_queue
 
frozen_queue_t m_frozen
 

Detailed Description

A DepoPlaneX collects depositions and drifts them to the given plane assuming a uniform drift velocity which is in the negative X direction.

It is assumed new depositions are added strictly in time order. They will then be drifted and maintained in the order of their time at the plane.

The time of the most recently added depo sets a high water mark in time at the plane such that all newly added depos must (causally) come later. Any depos older than this time are considered "frozen out" as nothing can change their ordering.

Definition at line 28 of file DepoPlaneX.h.

Member Typedef Documentation

Definition at line 30 of file DepoPlaneX.h.

Definition at line 31 of file DepoPlaneX.h.

Constructor & Destructor Documentation

Gen::DepoPlaneX::DepoPlaneX ( double  planex = 0.0*units::cm,
double  speed = 1.6*units::millimeter/units::microsecond 
)

Definition at line 6 of file DepoPlaneX.cxx.

7  : m_planex(planex)
8  , m_speed(speed)
9  , m_queue(IDepoDriftCompare(speed))
10 {
11 }
working_queue_t m_queue
Definition: DepoPlaneX.h:65

Member Function Documentation

IDepo::pointer Gen::DepoPlaneX::add ( const IDepo::pointer depo)

Add a deposition and drift it into the queue at the plane. Depos must be strictly added in (local) time order. The drifted depo is returned (and held).

Definition at line 14 of file DepoPlaneX.cxx.

15 {
16  drain(depo->time());
17  IDepo::pointer newdepo(new TransportedDepo(depo, m_planex, m_speed));
18  m_queue.insert(newdepo);
19  return newdepo;
20 }
std::shared_ptr< const IDepo > pointer
Definition: IData.h:19
void drain(double time)
Move all froze-out depos to the frozen queue.
Definition: DepoPlaneX.cxx:30
working_queue_t m_queue
Definition: DepoPlaneX.h:65
void Gen::DepoPlaneX::drain ( double  time)
private

Move all froze-out depos to the frozen queue.

Definition at line 30 of file DepoPlaneX.cxx.

31 {
32  IDepo::vector doomed;
33  for (auto depo : m_queue) {
34  if (depo->time() < time) {
35  m_frozen.push_back(depo);
36  doomed.push_back(depo);
37  }
38  }
39  for (auto depo : doomed) {
40  m_queue.erase(depo);
41  }
42 }
frozen_queue_t m_frozen
Definition: DepoPlaneX.h:66
std::vector< pointer > vector
Definition: IData.h:21
working_queue_t m_queue
Definition: DepoPlaneX.h:65
void Gen::DepoPlaneX::freezeout ( )

Force any remaining "thawed" depos in the queue to be frozen out.

Definition at line 44 of file DepoPlaneX.cxx.

45 {
46  IDepo::vector doomed;
47  for (auto depo : m_queue) {
48  m_frozen.push_back(depo);
49  doomed.push_back(depo);
50 
51  }
52  for (auto depo : doomed) {
53  m_queue.erase(depo);
54  }
55 }
frozen_queue_t m_frozen
Definition: DepoPlaneX.h:66
std::vector< pointer > vector
Definition: IData.h:21
working_queue_t m_queue
Definition: DepoPlaneX.h:65
double Gen::DepoPlaneX::freezeout_time ( ) const

Return the time at the plane before which the order of collected depositions are guaranteed (causally) to remain unchanged as any new depos are added.

Definition at line 22 of file DepoPlaneX.cxx.

23 {
24  if (m_frozen.empty()) {
25  return -1.0*units::second;
26  }
27  return m_frozen.back()->time();
28 }
frozen_queue_t m_frozen
Definition: DepoPlaneX.h:66
static const double second
Definition: Units.h:92
const frozen_queue_t& WireCell::Gen::DepoPlaneX::frozen_queue ( ) const
inline

Definition at line 60 of file DepoPlaneX.h.

60 { return m_frozen; }
frozen_queue_t m_frozen
Definition: DepoPlaneX.h:66
IDepo::vector Gen::DepoPlaneX::pop ( double  time)

Return ordered vector of all depositions at the plane with times not later than the given time. The given time is typically the freezeout time. If a time later than the freezout time is given it may cause depos to be artificially frozen out.

Definition at line 57 of file DepoPlaneX.cxx.

58 {
59  drain(time);
60  auto found = std::find_if_not (m_frozen.begin(), m_frozen.end(), [time](IDepo::pointer p){return p->time() <= time;} );
61  IDepo::vector ret(m_frozen.begin(), found);
62  m_frozen.erase(m_frozen.begin(), found);
63  return ret;
64 }
std::shared_ptr< const IDepo > pointer
Definition: IData.h:19
frozen_queue_t m_frozen
Definition: DepoPlaneX.h:66
std::vector< pointer > vector
Definition: IData.h:21
void drain(double time)
Move all froze-out depos to the frozen queue.
Definition: DepoPlaneX.cxx:30
p
Definition: test.py:223
double WireCell::Gen::DepoPlaneX::proper_time ( IDepo::pointer  depo) const

The time a deposition would have if it drifts to the plane.

const working_queue_t& WireCell::Gen::DepoPlaneX::working_queue ( ) const
inline

Definition at line 61 of file DepoPlaneX.h.

61 { return m_queue; }
working_queue_t m_queue
Definition: DepoPlaneX.h:65

Member Data Documentation

frozen_queue_t WireCell::Gen::DepoPlaneX::m_frozen
private

Definition at line 66 of file DepoPlaneX.h.

double WireCell::Gen::DepoPlaneX::m_planex
private

Definition at line 64 of file DepoPlaneX.h.

working_queue_t WireCell::Gen::DepoPlaneX::m_queue
private

Definition at line 65 of file DepoPlaneX.h.

double WireCell::Gen::DepoPlaneX::m_speed
private

Definition at line 64 of file DepoPlaneX.h.


The documentation for this class was generated from the following files: