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

#include <Misconfigure.h>

Inheritance diagram for WireCell::Gen::Misconfigure:
WireCell::IFrameFilter WireCell::IConfigurable WireCell::IFunctionNode< IFrame, IFrame > WireCell::IComponent< IConfigurable > WireCell::IFunctionNodeBase WireCell::Interface WireCell::INode WireCell::IComponent< INode > WireCell::Interface

Public Member Functions

 Misconfigure ()
 
virtual ~Misconfigure ()
 
virtual bool operator() (const input_pointer &in, output_pointer &out)
 The calling signature: More...
 
virtual WireCell::Configuration default_configuration () const
 Optional, override to return a hard-coded default configuration. More...
 
virtual void configure (const WireCell::Configuration &cfg)
 Accept a configuration. More...
 
- Public Member Functions inherited from WireCell::IFrameFilter
virtual ~IFrameFilter ()
 
virtual std::string signature ()
 Set the signature for all subclasses. More...
 
- Public Member Functions inherited from WireCell::IFunctionNode< IFrame, IFrame >
virtual ~IFunctionNode ()
 
virtual bool operator() (const boost::any &anyin, boost::any &anyout)
 The calling signature: More...
 
virtual std::vector< std::stringinput_types ()
 
virtual std::vector< std::stringoutput_types ()
 
- Public Member Functions inherited from WireCell::IFunctionNodeBase
virtual ~IFunctionNodeBase ()
 
virtual NodeCategory category ()
 Return the behavior category type. More...
 
virtual int concurrency ()
 By default assume all subclasses are stateless. 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 Attributes

Waveform::realseq_t m_from
 
Waveform::realseq_t m_to
 
bool m_truncate
 

Additional Inherited Members

- Public Types inherited from WireCell::IFrameFilter
typedef std::shared_ptr< IFrameFilterpointer
 
- Public Types inherited from WireCell::IFunctionNode< IFrame, IFrame >
typedef IFrame input_type
 
typedef IFrame output_type
 
typedef std::shared_ptr< const IFrameinput_pointer
 
typedef std::shared_ptr< const IFrameoutput_pointer
 
typedef IFunctionNode< IFrame, IFramesignature_type
 
- Public Types inherited from WireCell::IFunctionNodeBase
typedef std::shared_ptr< IFunctionNodeBasepointer
 
- 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

Definition at line 33 of file Misconfigure.h.

Constructor & Destructor Documentation

Gen::Misconfigure::Misconfigure ( )

Definition at line 13 of file Misconfigure.cxx.

14 {
15 }
Gen::Misconfigure::~Misconfigure ( )
virtual

Definition at line 17 of file Misconfigure.cxx.

18 {
19 }

Member Function Documentation

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

Accept a configuration.

Implements WireCell::IConfigurable.

Definition at line 53 of file Misconfigure.cxx.

54 {
55  int n = cfg["nsamples"].asInt();
56  double tick = cfg["tick"].asDouble();
57  Binning bins(n, 0, n*tick);
58 
59  m_from = Response::ColdElec(cfg["from"]["gain"].asDouble(),
60  cfg["from"]["shaping"].asDouble()).generate(bins);
61  m_to = Response::ColdElec(cfg["to"]["gain"].asDouble(),
62  cfg["to"]["shaping"].asDouble()).generate(bins);
63 
64  m_truncate = cfg["truncate"].asBool();
65 }
cfg
Definition: dbjson.py:29
const double tick
Waveform::realseq_t m_to
Definition: Misconfigure.h:46
std::size_t n
Definition: format.h:3399
Waveform::realseq_t m_from
Definition: Misconfigure.h:46
WireCell::Configuration Gen::Misconfigure::default_configuration ( ) const
virtual

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

The number of samples of the response functions.

The period of sampling the response functions

If to truncate the misconfigured waveforms. The convolution used to apply the misconfiguring will extend the a trace's waveform by nsamples-1. Truncating will clip that much off so the waveform will remains the same length but some information may be lost. If not truncated, this longer waveform likely needs to be handled in some way by the user.

Reimplemented from WireCell::IConfigurable.

Definition at line 22 of file Misconfigure.cxx.

23 {
25 
26  // nominally correctly configured amplifiers in MB. They should
27  // match what ever was used to create the input waveforms.
28  cfg["from"]["gain"] = 14.0*units::mV/units::fC;
29  cfg["from"]["shaping"] = 2.2*units::us;
30 
31  // Nominally misconfigured amplifiers in MB. They should match
32  // whatever you wished the input waveforms would have been created
33  // with.
34  cfg["to"]["gain"] = 4.7*units::mV/units::fC;
35  cfg["to"]["shaping"] = 1.1*units::us;
36 
37  /// The number of samples of the response functions.
38  cfg["nsamples"] = 50;
39  /// The period of sampling the response functions
40  cfg["tick"] = 0.5*units::us;
41 
42  /// If to truncate the misconfigured waveforms. The convolution
43  /// used to apply the misconfiguring will extend the a trace's
44  /// waveform by nsamples-1. Truncating will clip that much off so
45  /// the waveform will remains the same length but some information
46  /// may be lost. If not truncated, this longer waveform likely
47  /// needs to be handled in some way by the user.
48  cfg["truncate"] = true;
49 
50  return cfg;
51 }
static const double mV
Definition: Units.h:180
cfg
Definition: dbjson.py:29
static const double fC
Definition: Units.h:113
Json::Value Configuration
Definition: Configuration.h:50
static const double us
Definition: Units.h:105
bool Gen::Misconfigure::operator() ( const input_pointer in,
output_pointer out 
)
virtual

The calling signature:

Implements WireCell::IFunctionNode< IFrame, IFrame >.

Definition at line 67 of file Misconfigure.cxx.

68 {
69  out = nullptr;
70  if (!in) {
71  return true; // eos, but we don't care here.
72  }
73 
74  auto traces = in->traces();
75  if (!traces) {
76  std::cerr << "Gen::Misconfigure: warning no traces in frame for me\n";
77  return true;
78  }
79 
80  size_t ntraces = traces->size();
81  ITrace::vector out_traces(ntraces);
82  for (size_t ind=0; ind<ntraces; ++ind) {
83  auto trace = traces->at(ind);
84 
85  auto wave = Waveform::replace_convolve(trace->charge(),
87  out_traces[ind] = std::make_shared<SimpleTrace>(trace->channel(), trace->tbin(), wave);
88  }
89 
90  out = std::make_shared<SimpleFrame>(in->ident(), in->time(), out_traces, in->tick());
91  return true;
92 }
std::vector< pointer > vector
Definition: IData.h:21
realseq_t replace_convolve(Waveform::realseq_t wave, Waveform::realseq_t newres, Waveform::realseq_t oldres, bool truncate=true)
Definition: Waveform.cxx:187
Waveform::realseq_t m_to
Definition: Misconfigure.h:46
Waveform::realseq_t m_from
Definition: Misconfigure.h:46

Member Data Documentation

Waveform::realseq_t WireCell::Gen::Misconfigure::m_from
private

Definition at line 46 of file Misconfigure.h.

Waveform::realseq_t WireCell::Gen::Misconfigure::m_to
private

Definition at line 46 of file Misconfigure.h.

bool WireCell::Gen::Misconfigure::m_truncate
private

Definition at line 47 of file Misconfigure.h.


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