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

#include <WireBoundedDepos.h>

Inheritance diagram for WireCell::Gen::WireBoundedDepos:
WireCell::IDrifter WireCell::IConfigurable WireCell::IQueuedoutNode< IDepo, IDepo > WireCell::IComponent< IConfigurable > WireCell::IQueuedoutNodeBase WireCell::Interface WireCell::INode WireCell::IComponent< INode > WireCell::Interface

Public Member Functions

 WireBoundedDepos ()
 
virtual ~WireBoundedDepos ()
 
virtual bool operator() (const input_pointer &depo, output_queue &outq)
 The calling signature: More...
 
virtual void configure (const WireCell::Configuration &config)
 Accept a configuration. More...
 
virtual WireCell::Configuration default_configuration () const
 Optional, override to return a hard-coded default configuration. More...
 
- Public Member Functions inherited from WireCell::IDrifter
virtual ~IDrifter ()
 
virtual std::string signature ()
 
- Public Member Functions inherited from WireCell::IQueuedoutNode< IDepo, IDepo >
virtual ~IQueuedoutNode ()
 
virtual bool operator() (const boost::any &anyin, queuedany &outanyq)
 The calling signature: More...
 
virtual std::vector< std::stringinput_types ()
 
virtual std::vector< std::stringoutput_types ()
 
- Public Member Functions inherited from WireCell::IQueuedoutNodeBase
virtual ~IQueuedoutNodeBase ()
 
virtual NodeCategory category ()
 Return the behavior category type. More...
 
virtual int concurrency ()
 By default assume all subclasses maintain state. More...
 
- Public Member Functions inherited from WireCell::INode
virtual ~INode ()
 
virtual void reset ()
 
- Public Member Functions inherited from WireCell::IComponent< INode >
virtual ~IComponent ()
 
- Public Member Functions inherited from WireCell::Interface
virtual ~Interface ()
 
- Public Member Functions inherited from WireCell::IConfigurable
virtual ~IConfigurable ()
 
- Public Member Functions inherited from WireCell::IComponent< IConfigurable >
virtual ~IComponent ()
 

Private Types

typedef std::tuple< int, int, int > wire_bounds_t
 
typedef std::vector< wire_bounds_twire_region_t
 

Private Attributes

IAnodePlane::pointer m_anode
 
bool m_accept
 
std::vector< const Pimpos * > m_pimpos
 
std::vector< wire_region_tm_regions
 

Additional Inherited Members

- Public Types inherited from WireCell::IDrifter
typedef std::shared_ptr< IDrifterpointer
 
- Public Types inherited from WireCell::IQueuedoutNode< IDepo, IDepo >
typedef std::shared_ptr< IQueuedoutNodeBasepointer
 
typedef IDepo input_type
 
typedef IDepo output_type
 
typedef std::shared_ptr< const IDepoinput_pointer
 
typedef std::shared_ptr< const IDepooutput_pointer
 
typedef std::deque< output_pointeroutput_queue
 
- Public Types inherited from WireCell::IQueuedoutNodeBase
typedef std::shared_ptr< IQueuedoutNodeBasepointer
 
typedef std::deque< boost::any > queuedany
 
- Public Types inherited from WireCell::INode
enum  NodeCategory {
  unknown, sourceNode, sinkNode, functionNode,
  queuedoutNode, joinNode, splitNode, faninNode,
  fanoutNode, multioutNode, hydraNode
}
 
- Public Types inherited from WireCell::IComponent< INode >
typedef std::shared_ptr< INodepointer
 Access subclass facet by pointer. More...
 
typedef std::vector< pointervector
 Vector of shared pointers. More...
 
- Public Types inherited from WireCell::Interface
typedef std::shared_ptr< Interfacepointer
 
- Public Types inherited from WireCell::IComponent< IConfigurable >
typedef std::shared_ptr< IConfigurablepointer
 Access subclass facet by pointer. More...
 
typedef std::vector< pointervector
 Vector of shared pointers. More...
 

Detailed Description

WireBoundedDepos outputs depos based on which wires they "land". To "land" means to drift antiparallel to the X-axis. The set of wire regions on which depos may or may not "land" is configured as an array of objects with three integer attributes:

[{ plane: <plane-number>, min: <min-wire-number>, max: <max-wire-number, },...]

Note the range is inclusive of the max.

Wire numbers must be counted along the positive pitch direction and starting at 0.

The filter can operate in "accept" or "reject" mode. In "accept" mode, a depo which "lands" on any configured wire region will be output. In "reject" mode a depo will not be output if it explicitly lands on any configured wire region. The first wire region landed will determine the fate of the depo.

If users desire to bound depos by the intersection of wires from multiple planes they may pipeline multiple WireBoundDepos serially, each configured to accept or reject wire regions defined for a given plane.

Definition at line 48 of file WireBoundedDepos.h.

Member Typedef Documentation

typedef std::tuple<int,int,int> WireCell::Gen::WireBoundedDepos::wire_bounds_t
private

Definition at line 61 of file WireBoundedDepos.h.

Definition at line 62 of file WireBoundedDepos.h.

Constructor & Destructor Documentation

Gen::WireBoundedDepos::WireBoundedDepos ( )

Definition at line 129 of file WireBoundedDepos.cxx.

130  : m_accept(true)
131 {
132 }
Gen::WireBoundedDepos::~WireBoundedDepos ( )
virtual

Definition at line 133 of file WireBoundedDepos.cxx.

134 {
135 }

Member Function Documentation

void Gen::WireBoundedDepos::configure ( const WireCell::Configuration config)
virtual

Accept a configuration.

Implements WireCell::IConfigurable.

Definition at line 40 of file WireBoundedDepos.cxx.

41 {
42  // we just want the pimpos but best to keep a handle on the anode
43  // since it's shared_ptr memory.
44  m_anode = Factory::find_tn<IAnodePlane>(cfg["anode"].asString());
45 
46  for (auto face : m_anode->faces()) {
47  if (face->planes().empty()) {
48  std::cerr << "Gen::WireBoundedDepos: not given multi-plane AnodeFace for face "
49  << face->ident() << "\n";
50  continue;
51  }
52  for (auto plane : face->planes()) {
53  const size_t iplane = plane->ident();
54  if (m_pimpos.size() <= iplane) {
55  m_pimpos.resize(iplane+1);
56  }
57  m_pimpos[iplane] = plane->pimpos();
58  }
59  break; // fixme:
60  }
61  m_accept = cfg["mode"].asString() == "accept";
62 
63  auto jregions = cfg["regions"];
64  for (auto jregion : jregions) {
65  wire_region_t wr;
66  for (auto jtrio : jregion) {
67  wr.push_back(wire_bounds_t(jtrio["plane"].asInt(),
68  jtrio["min"].asInt(),
69  jtrio["max"].asInt()));
70  }
71  m_regions.push_back(wr);
72  }
73 
74  std::cerr << "WireBoundedDepos: " << cfg ["mode"]
75  << " with " << m_regions.size() << " wires in "
76  << m_pimpos.size() << " planes\n";
77 }
std::vector< wire_bounds_t > wire_region_t
cfg
Definition: dbjson.py:29
std::vector< const Pimpos * > m_pimpos
std::vector< wire_region_t > m_regions
std::tuple< int, int, int > wire_bounds_t
WireCell::Configuration Gen::WireBoundedDepos::default_configuration ( ) const
virtual

Optional, override to return a hard-coded default configuration.

Reimplemented from WireCell::IConfigurable.

Definition at line 22 of file WireBoundedDepos.cxx.

23 {
25  cfg["anode"] = "";
26 
27  // A the list of wire regions
28  // [{
29  // plane: <plane-number>,
30  // min: <min-wire-number>,
31  // max: <max-wire-number,
32  // },...]
33  cfg["wires"] = Json::arrayValue;
34 
35  cfg["mode"] = "accept";
36 
37  return cfg;
38 }
cfg
Definition: dbjson.py:29
Json::Value Configuration
Definition: Configuration.h:50
bool Gen::WireBoundedDepos::operator() ( const input_pointer in,
output_queue outq 
)
virtual

The calling signature:

Implements WireCell::IQueuedoutNode< IDepo, IDepo >.

Definition at line 79 of file WireBoundedDepos.cxx.

80 {
81  if (!depo) { // EOS protocol
82  outq.push_back(nullptr);
83  return true;
84  }
85 
86  // lazily calculate nearest wire
87  const size_t nplanes = m_pimpos.size();
88  std::vector<bool> already(nplanes, false);
89  std::vector<int> closest_wire(nplanes, -1);
90 
91  for (const auto& region : m_regions) {
92 
93  bool inregion = true;
94  for (const auto& trio : region) {
95 
96  const int iplane = get<0>(trio);
97  const int imin = get<1>(trio);
98  const int imax = get<2>(trio);
99 
100  if (!already[iplane]) { // lazy
101  const double pitch = m_pimpos[iplane]->distance(depo->pos(), 2);
102  closest_wire[iplane] = m_pimpos[iplane]->region_binning().bin(pitch);
103  already[iplane] = true;
104  }
105  const int iwire = closest_wire[iplane];
106 
107  if (iwire < imin or iwire > imax) {
108  inregion = false;
109  break;
110  }
111  }
112 
113 
114  if (inregion) {
115  if (m_accept) {
116  outq.push_back(depo);
117  }
118  // accept or reject, we landed this depo in a configured
119  // region.
120  return true;
121  }
122  }
123  if (!m_accept) { // depo missed all rejections.
124  outq.push_back(depo);
125  }
126  return true;
127 }
std::vector< const Pimpos * > m_pimpos
std::vector< wire_region_t > m_regions

Member Data Documentation

bool WireCell::Gen::WireBoundedDepos::m_accept
private

Definition at line 58 of file WireBoundedDepos.h.

IAnodePlane::pointer WireCell::Gen::WireBoundedDepos::m_anode
private

Definition at line 57 of file WireBoundedDepos.h.

std::vector<const Pimpos*> WireCell::Gen::WireBoundedDepos::m_pimpos
private

Definition at line 59 of file WireBoundedDepos.h.

std::vector<wire_region_t> WireCell::Gen::WireBoundedDepos::m_regions
private

Definition at line 63 of file WireBoundedDepos.h.


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