Classes | Public Types | Public Member Functions | Private Attributes | List of all members
WireCell::Gen::StaticChannelStatus Class Reference

#include <StaticChannelStatus.h>

Inheritance diagram for WireCell::Gen::StaticChannelStatus:
WireCell::IChannelStatus WireCell::IConfigurable WireCell::IComponent< IChannelStatus > WireCell::IComponent< IConfigurable > WireCell::Interface WireCell::Interface

Classes

struct  ChannelStatus
 

Public Types

typedef std::unordered_map< int, ChannelStatuschannel_status_map_t
 
- Public Types inherited from WireCell::IComponent< IChannelStatus >
typedef std::shared_ptr< IChannelStatuspointer
 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...
 

Public Member Functions

 StaticChannelStatus (double nominal_gain=14.0 *units::mV/units::fC, double nominal_shaping=2.0 *units::us, channel_status_map_t deviants=channel_status_map_t())
 
virtual ~StaticChannelStatus ()
 
virtual double preamp_gain (int chid) const
 
virtual double preamp_shaping (int chid) const
 
virtual void configure (const WireCell::Configuration &config)
 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::IChannelStatus
virtual ~IChannelStatus ()
 
- Public Member Functions inherited from WireCell::IComponent< IChannelStatus >
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

double m_nominal_gain
 
double m_nominal_shaping
 
channel_status_map_t m_deviants
 

Detailed Description

Definition at line 18 of file StaticChannelStatus.h.

Member Typedef Documentation

Definition at line 26 of file StaticChannelStatus.h.

Constructor & Destructor Documentation

Gen::StaticChannelStatus::StaticChannelStatus ( double  nominal_gain = 14.0*units::mV/units::fC,
double  nominal_shaping = 2.0*units::us,
channel_status_map_t  deviants = channel_status_map_t() 
)

Definition at line 11 of file StaticChannelStatus.cxx.

Gen::StaticChannelStatus::~StaticChannelStatus ( )
virtual

Definition at line 20 of file StaticChannelStatus.cxx.

21 {
22 }

Member Function Documentation

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

Accept a configuration.

Implements WireCell::IConfigurable.

Definition at line 42 of file StaticChannelStatus.cxx.

43 {
44  // let user override any defaults
45  m_nominal_gain = get(cfg, "nominal_gain", m_nominal_gain);
46  m_nominal_shaping = get(cfg, "nominal_shaping", m_nominal_shaping);
47 
48  auto jdev = cfg["deviants"];
49  if (jdev.isNull()) {
50  return;
51  }
52  for (auto jone : jdev) {
53  const int chid = jone["chid"].asInt(); // must supply
54  const double gain = get(jone, "gain", m_nominal_gain);
55  const double shaping = get(jone, "shaping", m_nominal_shaping);
56  m_deviants[chid] = ChannelStatus(gain, shaping);
57  }
58 }
cfg
Definition: dbjson.py:29
WireCell::Configuration Gen::StaticChannelStatus::default_configuration ( ) const
virtual

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

Reimplemented from WireCell::IConfigurable.

Definition at line 25 of file StaticChannelStatus.cxx.

26 {
27  Configuration cfg; // load hard-coded defaults
28  cfg["nominal_gain"] = m_nominal_gain;
29  cfg["nominal_shaping"] = m_nominal_shaping;
30  cfg["deviants"] = Json::arrayValue;
31  for (auto it : m_deviants) {
32  Json::Value jdev(Json::objectValue);
33  jdev["chid"] = it.first;
34  jdev["gain"] = it.second.gain;
35  jdev["shaping"] = it.second.shaping;
36  cfg["deviants"].append(jdev);
37  }
38  return cfg;
39 }
cfg
Definition: dbjson.py:29
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
Definition: document.h:2106
Json::Value Configuration
Definition: Configuration.h:50
double Gen::StaticChannelStatus::preamp_gain ( int  chid) const
virtual

Return the current gain for the preamplifier in units of [voltage]/[charge].

Implements WireCell::IChannelStatus.

Definition at line 62 of file StaticChannelStatus.cxx.

63 {
64  auto it = m_deviants.find(chid);
65  if (it == m_deviants.end()) {
66  return m_nominal_gain;
67  }
68  return it->second.gain;
69 }
double Gen::StaticChannelStatus::preamp_shaping ( int  chid) const
virtual

Return the current shaping time of the preamplifier for the given channel in units of [time].

Implements WireCell::IChannelStatus.

Definition at line 70 of file StaticChannelStatus.cxx.

71 {
72  auto it = m_deviants.find(chid);
73  if (it == m_deviants.end()) {
74  return m_nominal_shaping;
75  }
76  return it->second.shaping;
77 }

Member Data Documentation

channel_status_map_t WireCell::Gen::StaticChannelStatus::m_deviants
private

Definition at line 43 of file StaticChannelStatus.h.

double WireCell::Gen::StaticChannelStatus::m_nominal_gain
private

Definition at line 42 of file StaticChannelStatus.h.

double WireCell::Gen::StaticChannelStatus::m_nominal_shaping
private

Definition at line 42 of file StaticChannelStatus.h.


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