IWireSelectors.h
Go to the documentation of this file.
1 /**
2  Some wire selectors.
3 
4  Fixme: this isn't really appropriate for an interface package.
5 
6  */
7 
8 #ifndef WIRECELL_WIRESELECTORS
9 #define WIRECELL_WIRESELECTORS
10 
11 #include "WireCellIface/IWire.h"
12 #include <boost/function.hpp>
13 
14 namespace WireCell {
15 
16  typedef boost::function<bool (IWire::pointer)> wire_selector;
17 
18  /// Select wires by plane (and apa/face)
20  int layers, face, apa;
21 
22  WirePlaneSelector(int layer_mask, int face=0, int apa=0)
23  : layers(layer_mask), face(face), apa(apa) {}
24 
25  bool operator()(IWire::pointer wire) {
26  WirePlaneId ident = wire->planeid();
27 
28  if (layers && !(layers&ident.ilayer())) { return false; }
29  if (apa >= 0 && ident.apa() != apa) { return false; }
30  if (face >= 0 && ident.face() != face) { return false; }
31 
32  return true;
33  }
34  };
35 
36  // Select all wires on default apa/face
37  extern wire_selector select_all_wires;
38 
39  // Select one plane on default apa/face
40  extern wire_selector select_u_wires;
41  extern wire_selector select_v_wires;
42  extern wire_selector select_w_wires;
43  extern wire_selector select_uvw_wires[3];
44 
45 }
46 
47 #endif
std::shared_ptr< const IWire > pointer
Definition: IData.h:19
bool operator()(IWire::pointer wire)
wire_selector select_all_wires
boost::function< bool(IWire::pointer)> wire_selector
Select wires by plane (and apa/face)
int ilayer() const
Layer as integer (not index!)
Definition: WirePlaneId.cxx:29
wire_selector select_uvw_wires[3]
wire_selector select_u_wires
wire_selector select_w_wires
Definition: Main.h:22
wire_selector select_v_wires
int apa() const
APA number.
Definition: WirePlaneId.cxx:48
static const int layer_mask
Definition: WirePlaneId.cxx:5
WirePlaneSelector(int layer_mask, int face=0, int apa=0)
int face() const
APA face number.
Definition: WirePlaneId.cxx:44