IFrame.h
Go to the documentation of this file.
1 #ifndef WIRECELLIFACE_IFRAME
2 #define WIRECELLIFACE_IFRAME
3 
4 #include "WireCellIface/ITrace.h"
8 
9 #include <string>
10 #include <vector>
11 
12 namespace WireCell {
13 
14  /** Interface to a sequence of traces.
15  *
16  */
17  class IFrame : public IData<IFrame> {
18 
19  public:
20  virtual ~IFrame() ;
21 
22  // Tag gives some semantic meaning to that which it is
23  // associated. The frame as a whole may have a number of tags
24  // as can a subset of traces. Although they are free-form
25  // they are best kept limited in number, single words of lower
26  // case letters. Like all data they are immutable after
27  // creation.
28  typedef std::string tag_t;
29 
30  // A frame and a subset of traces may have more than one tag.
31  // Such tags are grouped into a tag list. The order of the
32  // tag list may or may not have meaning.
33  typedef std::vector<tag_t> tag_list_t;
34 
35  // A list of indices into the traces vector.
36  typedef std::vector<size_t> trace_list_t;
37 
38  // A numerical summary value defined over a number of traces.
39  typedef std::vector<double> trace_summary_t;
40 
41 
42  // The list of tags applied to this frame as a whole.
43  virtual const tag_list_t& frame_tags() const = 0;
44 
45  // The union of all tags applied to all traces of this frame.
46  virtual const tag_list_t& trace_tags() const = 0;
47 
48  // Return traces (as a list of their indices) with the given
49  // tag applied.
50  virtual const trace_list_t& tagged_traces(const tag_t& tag) const = 0;
51 
52  // Return a trace summary defined over the tagged subset of
53  // traces. The values of the summary correspond to the
54  // tagged trace list as returned by `tagged_traces(tag)`.
55  virtual const trace_summary_t& trace_summary(const tag_t& tag) const = 0;
56 
57 
58 
59  /// Return a vector of all traces ignoring any potential tag.
60  virtual ITrace::shared_vector traces() const = 0;
61 
62  /// Return all masks associated with this frame
63  // fixme: this should be its own interface
64  virtual Waveform::ChannelMaskMap masks() const {
65  return Waveform::ChannelMaskMap(); // default is empty
66  }
67 
68  /// Return an identifying number of this frame.
69  virtual int ident() const = 0;
70 
71  /// Return the reference time of the frame
72  /// w.r.t. some global time. Note, each trace has a "tbin"
73  /// counting number of ticks w.r.t. to this time where the
74  /// trace starts. In general, tbin is not zero.
75  virtual double time() const = 0;
76 
77  /// Return the digitization sample period.
78  virtual double tick() const = 0;
79 
80  };
81 
82 }
83 
84 
85 #endif
std::string string
Definition: nybbler.cc:12
virtual int ident() const =0
Return an identifying number of this frame.
virtual const tag_list_t & trace_tags() const =0
virtual double time() const =0
std::map< std::string, ChannelMasks > ChannelMaskMap
Collect channel masks by some label.
Definition: Waveform.h:59
virtual ITrace::shared_vector traces() const =0
Return a vector of all traces ignoring any potential tag.
std::vector< double > trace_summary_t
Definition: IFrame.h:39
virtual double tick() const =0
Return the digitization sample period.
std::vector< tag_t > tag_list_t
Definition: IFrame.h:33
Definition: Main.h:22
std::string tag_t
Definition: IFrame.h:28
virtual Waveform::ChannelMaskMap masks() const
Return all masks associated with this frame.
Definition: IFrame.h:64
virtual const tag_list_t & frame_tags() const =0
virtual const trace_list_t & tagged_traces(const tag_t &tag) const =0
virtual const trace_summary_t & trace_summary(const tag_t &tag) const =0
std::vector< size_t > trace_list_t
Definition: IFrame.h:36
std::shared_ptr< const vector > shared_vector
Definition: IData.h:22