Public Member Functions | Protected Types | Protected Member Functions | Private Attributes | List of all members
WireCell::Img::SumSliceBase Class Reference

#include <SumSlice.h>

Inheritance diagram for WireCell::Img::SumSliceBase:
WireCell::IConfigurable WireCell::IComponent< IConfigurable > WireCell::Interface WireCell::Img::SumSlicer WireCell::Img::SumSlices

Public Member Functions

 SumSliceBase ()
 
virtual ~SumSliceBase ()
 
virtual void configure (const WireCell::Configuration &cfg)
 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::IConfigurable
virtual ~IConfigurable ()
 
- Public Member Functions inherited from WireCell::IComponent< IConfigurable >
virtual ~IComponent ()
 
- Public Member Functions inherited from WireCell::Interface
virtual ~Interface ()
 

Protected Types

typedef std::map< size_t, Data::Slice * > slice_map_t
 

Protected Member Functions

void slice (const IFrame::pointer &in, slice_map_t &sm)
 

Private Attributes

IAnodePlane::pointer m_anode
 
int m_tick_span
 
std::string m_tag
 

Additional Inherited Members

- 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...
 
- Public Types inherited from WireCell::Interface
typedef std::shared_ptr< Interfacepointer
 

Detailed Description

Definition at line 44 of file SumSlice.h.

Member Typedef Documentation

typedef std::map<size_t, Data::Slice*> WireCell::Img::SumSliceBase::slice_map_t
protected

Definition at line 55 of file SumSlice.h.

Constructor & Destructor Documentation

Img::SumSliceBase::SumSliceBase ( )

Definition at line 18 of file SumSlice.cxx.

18 : m_tick_span(4) , m_tag("") { }
Img::SumSliceBase::~SumSliceBase ( )
virtual

Definition at line 19 of file SumSlice.cxx.

19 { }

Member Function Documentation

void Img::SumSliceBase::configure ( const WireCell::Configuration config)
virtual

Accept a configuration.

Implements WireCell::IConfigurable.

Definition at line 40 of file SumSlice.cxx.

41 {
42  m_anode = Factory::find_tn<IAnodePlane>(cfg["anode"].asString()); // throws
43  m_tick_span = get(cfg, "tick_span", m_tick_span);
44  m_tag = get<std::string>(cfg, "tag", m_tag);
45 }
cfg
Definition: dbjson.py:29
IAnodePlane::pointer m_anode
Definition: SumSlice.h:60
WireCell::Configuration Img::SumSliceBase::default_configuration ( ) const
virtual

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

Reimplemented from WireCell::IConfigurable.

Definition at line 23 of file SumSlice.cxx.

24 {
26 
27  // Name of an IAnodePlane from which we can resolve channel ident to IChannel
28  cfg["anode"] = "";
29 
30  // Number of ticks over which each output slice should sum
31  cfg["tick_span"] = m_tick_span;
32 
33  // If given, use tagged traces. Otherwise use all traces.
34  cfg["tag"] = m_tag;
35 
36  return cfg;
37 }
cfg
Definition: dbjson.py:29
Json::Value Configuration
Definition: Configuration.h:50
void Img::SumSliceBase::slice ( const IFrame::pointer in,
slice_map_t sm 
)
protected

Definition at line 48 of file SumSlice.cxx.

49 {
50  const double tick = in->tick();
51  const double span = tick * m_tick_span;
52 
53  for (auto trace : FrameTools::tagged_traces(in, m_tag)) {
54  const int tbin = trace->tbin();
55  const int chid = trace->channel();
56  IChannel::pointer ich = m_anode->channel(chid);
57  const auto& charge = trace->charge();
58  const size_t nq = charge.size();
59  for (size_t qind=0; qind != nq; ++qind) {
60  const auto q = charge[qind];
61  if (q == 0.0) {
62  continue;
63  }
64  size_t slicebin = (tbin+qind)/m_tick_span;
65  auto s = svcmap[slicebin];
66  if (!s) {
67  const double start = slicebin * span; // thus relative to slice frame's time.
68  svcmap[slicebin] = s = new Img::Data::Slice(in, slicebin, start, span);
69  }
70  s->sum(ich, q);
71  }
72  }
73 }
ITrace::vector tagged_traces(IFrame::pointer frame, IFrame::tag_t tag)
Definition: FrameTools.cxx:111
span(IterB &&b, IterE &&e, Adaptor &&adaptor) -> span< decltype(adaptor(std::forward< IterB >(b))), decltype(adaptor(std::forward< IterE >(e))) >
std::shared_ptr< const IChannel > pointer
Definition: IData.h:19
SlicingAlgorithm::Slice Slice
const double tick
IAnodePlane::pointer m_anode
Definition: SumSlice.h:60
static QCString * s
Definition: config.cpp:1042

Member Data Documentation

IAnodePlane::pointer WireCell::Img::SumSliceBase::m_anode
private

Definition at line 60 of file SumSlice.h.

std::string WireCell::Img::SumSliceBase::m_tag
private

Definition at line 62 of file SumSlice.h.

int WireCell::Img::SumSliceBase::m_tick_span
private

Definition at line 61 of file SumSlice.h.


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