Public Types | Public Member Functions | Private Attributes | List of all members
WireCell::RayGrid::Activity Class Reference

#include <RayTiling.h>

Public Types

typedef double value_t
 
typedef std::vector< value_tvector_t
 
typedef vector_t::const_iterator iterator_t
 
typedef std::pair< iterator_t, iterator_trange_t
 
typedef std::vector< range_tranges_t
 

Public Member Functions

 Activity (layer_index_t layer)
 
 Activity (layer_index_t layer, const range_t &span, int offset=0, double threshold=0.0)
 
 Activity (layer_index_t layer, size_t span, double value, int offset=0, double threshold=0.0)
 
Activity subspan (int pi_begin, int pi_end) const
 
layer_index_t layer () const
 
iterator_t begin () const
 
iterator_t end () const
 
bool empty () const
 
int pitch_index (const iterator_t &it) const
 
Strip make_strip (const range_t &subspan) const
 
strips_t make_strips () const
 
ranges_t active_ranges () const
 
int offset () const
 
std::string as_string () const
 

Private Attributes

vector_t m_span
 
layer_index_t m_layer
 
int m_offset
 
double m_threshold
 

Detailed Description

Definition at line 51 of file RayTiling.h.

Member Typedef Documentation

Definition at line 55 of file RayTiling.h.

Definition at line 56 of file RayTiling.h.

Definition at line 57 of file RayTiling.h.

Definition at line 53 of file RayTiling.h.

Definition at line 54 of file RayTiling.h.

Constructor & Destructor Documentation

Activity::Activity ( layer_index_t  layer)

Definition at line 11 of file RayTiling.cxx.

12  : m_span{}
13  , m_layer(layer)
14  , m_offset(0)
15  , m_threshold(0)
16 {
17 }
layer_index_t layer() const
Definition: RayTiling.h:75
Activity::Activity ( layer_index_t  layer,
const range_t span,
int  offset = 0,
double  threshold = 0.0 
)

Definition at line 28 of file RayTiling.cxx.

30  : m_span{}
31  , m_layer(layer)
32  , m_offset(offset)
33  , m_threshold(threshold)
34 {
35  if (span.first == span.second) {
36  return;
37  }
38  iterator_t b = span.first;
39  while (b != span.second and *b <= m_threshold) {
40  ++b;
41  ++m_offset;
42  }
43  iterator_t e = span.second;
44  while (e > b and *(e-1) <= m_threshold) {
45  --e;
46  }
47  m_span.insert(m_span.begin(), b,e);
48 }
span(IterB &&b, IterE &&e, Adaptor &&adaptor) -> span< decltype(adaptor(std::forward< IterB >(b))), decltype(adaptor(std::forward< IterE >(e))) >
vector_t::const_iterator iterator_t
Definition: RayTiling.h:55
const double e
layer_index_t layer() const
Definition: RayTiling.h:75
static bool * b
Definition: config.cpp:1043
Activity::Activity ( layer_index_t  layer,
size_t  span,
double  value,
int  offset = 0,
double  threshold = 0.0 
)

Definition at line 19 of file RayTiling.cxx.

21  : m_span(span, value)
22  , m_layer(layer)
23  , m_offset(offset)
24  , m_threshold(threshold)
25 {
26 }
span(IterB &&b, IterE &&e, Adaptor &&adaptor) -> span< decltype(adaptor(std::forward< IterB >(b))), decltype(adaptor(std::forward< IterE >(e))) >
layer_index_t layer() const
Definition: RayTiling.h:75
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1225

Member Function Documentation

Activity::ranges_t Activity::active_ranges ( ) const

Definition at line 102 of file RayTiling.cxx.

103 {
104  ranges_t ret;
105  range_t current{end(), end()};
106 
107  for (auto it = begin(); it != end(); ++it) {
108  // entering active range
109  if (current.first == end() and *it > m_threshold) {
110  current.first = it;
111  continue;
112  }
113  // exiting active range
114  if (current.first != end() and *it <= 0.0) {
115  current.second = it;
116  ret.push_back(current);
117  current.first = end();
118  }
119  }
120  if (current.first != end()) {
121  current.second = end();
122  ret.push_back(current);
123  }
124  return ret;
125 }
iterator_t begin() const
Definition: RayTiling.cxx:50
std::vector< range_t > ranges_t
Definition: RayTiling.h:57
static Entry * current
std::pair< iterator_t, iterator_t > range_t
Definition: RayTiling.h:56
iterator_t end() const
Definition: RayTiling.cxx:55
std::string Activity::as_string ( ) const

Definition at line 291 of file RayTiling.cxx.

292 {
293  std::stringstream ss;
294  ss << *this << "\n";
295  for (auto strip: make_strips()) {
296  ss << "\t" << strip << "\n";
297  }
298  return ss.str();
299 }
strips_t make_strips() const
Definition: RayTiling.cxx:92
Activity::iterator_t Activity::begin ( ) const

Definition at line 50 of file RayTiling.cxx.

51 {
52  return m_span.begin();
53 }
bool Activity::empty ( void  ) const

Definition at line 60 of file RayTiling.cxx.

61 {
62  return m_span.empty();
63 }
Activity::iterator_t Activity::end ( void  ) const

Definition at line 55 of file RayTiling.cxx.

56 {
57  return m_span.end();
58 }
layer_index_t WireCell::RayGrid::Activity::layer ( ) const
inline

Definition at line 75 of file RayTiling.h.

75 { return m_layer; }
Strip Activity::make_strip ( const range_t subspan) const

Definition at line 86 of file RayTiling.cxx.

87 {
88  return Strip{m_layer, std::make_pair(pitch_index(r.first),
89  pitch_index(r.second))};
90 }
int pitch_index(const iterator_t &it) const
Definition: RayTiling.cxx:65
strips_t Activity::make_strips ( ) const

Definition at line 92 of file RayTiling.cxx.

93 {
94  strips_t ret;
95  for (const auto& ar : active_ranges()) {
96  ret.push_back(make_strip(ar));
97  }
98  return ret;
99 }
ranges_t active_ranges() const
Definition: RayTiling.cxx:102
std::vector< Strip > strips_t
Definition: RayTiling.h:42
Strip make_strip(const range_t &subspan) const
Definition: RayTiling.cxx:86
int WireCell::RayGrid::Activity::offset ( ) const
inline

Definition at line 96 of file RayTiling.h.

96 { return m_offset; }
int Activity::pitch_index ( const iterator_t it) const

Definition at line 65 of file RayTiling.cxx.

66 {
67  return m_offset + it-m_span.begin();
68 }
Activity Activity::subspan ( int  pi_begin,
int  pi_end 
) const

Definition at line 70 of file RayTiling.cxx.

71 {
72  const int rel_beg = abs_beg-m_offset;
73  const int rel_end = abs_end-m_offset;
74 
75  if (rel_beg < 0 or rel_beg >= rel_end or rel_end > (int)m_span.size()) {
76  spdlog::debug("activity::subspan bogus absolute:[{},{}] m_offset={} span.size={}",
77  abs_beg, abs_end, m_offset, m_span.size());
78  return Activity(m_layer);
79  }
80 
81  return Activity(m_layer, {begin()+rel_beg, begin()+rel_end}, abs_beg);
82 }
iterator_t begin() const
Definition: RayTiling.cxx:50
Activity(layer_index_t layer)
Definition: RayTiling.cxx:11
void debug(const char *fmt, const Args &...args)
Definition: spdlog.h:183

Member Data Documentation

layer_index_t WireCell::RayGrid::Activity::m_layer
private

Definition at line 101 of file RayTiling.h.

int WireCell::RayGrid::Activity::m_offset
private

Definition at line 102 of file RayTiling.h.

vector_t WireCell::RayGrid::Activity::m_span
private

Definition at line 100 of file RayTiling.h.

double WireCell::RayGrid::Activity::m_threshold
private

Definition at line 103 of file RayTiling.h.


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