Bayeux
3.4.1
Core Foundation library for SuperNEMO
|
A simple linear ADC (Analog/Digital Converter) More...
#include <bayeux/mctools/digitization/sampled_signal.h>
Public Types | |
enum | more_store_mask_type { STORE_SAMPLING_FREQUENCY = datatools::bit_mask::bit03, STORE_SAMPLES = datatools::bit_mask::bit04 } |
Masks to automatically tag the attributes to be stored. More... | |
enum | sampling_status_index { SS_INVALID = 0, SS_UNDERFLOW = 1, SS_OVERFLOW = 2 } |
Indexes of sampling status bits. More... | |
enum | slicing_bits { SLICING_HIT_ID = datatools::bit_mask::bit00, SLICING_GEOM_ID = datatools::bit_mask::bit01, SLICING_AUXILIARIES = datatools::bit_mask::bit02, SLICING_UPDATE = datatools::bit_mask::bit03, SLICING_ALL } |
Special flags for signal slicing. More... | |
enum | print_ascii_bits { PRINT_ASCII_NOHEADER = datatools::bit_mask::bit00, PRINT_ASCII_TIME_IN_NS = datatools::bit_mask::bit01, PRINT_ASCII_NODATABLOCKSEP = datatools::bit_mask::bit02 } |
Special flags for ASCII dump. More... | |
Public Types inherited from geomtools::base_hit | |
enum | store_mask_type { STORE_NOTHING = 0, STORE_HIT_ID = datatools::bit_mask::bit00, STORE_GEOM_ID = datatools::bit_mask::bit01, STORE_AUXILIARIES = datatools::bit_mask::bit02, STORE_RESERVED30 = datatools::bit_mask::bit30, STORE_RESERVED31 = datatools::bit_mask::bit31 } |
Masks to automatically tag the attributes to be stored. More... | |
Public Types inherited from datatools::i_tree_dumpable | |
enum | ostream_type { OSTREAM_COUT = 1, OSTREAM_CERR = 2, OSTREAM_CLOG = 3 } |
Enumeration for standard output streams. More... | |
Public Member Functions | |
sampled_signal () | |
Default constructor. More... | |
sampled_signal (const double sampling_frequency_, const std::size_t nsamples_, const int32_t value_=INVALID_SAMPLE) | |
Constructor. More... | |
virtual | ~sampled_signal () |
Destructor. More... | |
virtual bool | is_valid () const |
Check validity. More... | |
bool | has_sampling_frequency () const |
Check if sampling frequency is set. More... | |
void | set_sampling_frequency (const double) |
Set the sampling frequency. More... | |
double | get_sampling_frequency () const |
Return the sampling frequency. More... | |
void | reset_sampling_frequency () |
Reset sampling frequency and associated period. More... | |
void | set_sampling_period (const double) |
Set the sampling period. More... | |
double | get_sampling_period () const |
Return the sampling period. More... | |
std::size_t | get_number_of_sampling_time_intervals () const |
Return the number of sampling time intervals. More... | |
double | get_sampling_duration () const |
Return the sampling duration. More... | |
double | get_min_sampling_time () const |
Return the minimum sampling time. More... | |
double | get_max_sampling_time () const |
Return the maximum sampling time. More... | |
void | set_number_of_samples (const std::size_t nsamples_, const int32_t value_=INVALID_SAMPLE) |
Set the number of samples. More... | |
void | reset_number_of_samples () |
Reset the number of samples. More... | |
std::size_t | get_number_of_samples () const |
Return the number of samples. More... | |
bool | is_sampling_initialized () const |
Check if the array of samples is initialized. More... | |
bool | has_invalid_samples () const |
Check if the array of samples has at least one invalid sample. More... | |
bool | has_underflow_samples () const |
Check if the array of samples has at least one underflow sample. More... | |
bool | has_overflow_samples () const |
Check if the array of samples has at least one overflow sample. More... | |
bool | has_only_valid_samples () const |
Check if the array of samples has only valid samples. More... | |
bool | has_min_sample () const |
Check if the minimum sample value is set. More... | |
int32_t | get_min_sample () const |
Return the minimum sample value. More... | |
bool | has_max_sample () const |
Check if the maximum sample value is set. More... | |
int32_t | get_max_sample () const |
Return the maximum sample value. More... | |
void | reset () |
Reset. More... | |
void | set_samples (const std::vector< int32_t > &, const bool update_=true) |
Set the array of samples. More... | |
const std::vector< int32_t > & | get_samples () const |
Return a const reference to the array of samples. More... | |
void | set_sample (const uint32_t index_, const int32_t sample_, const bool update_=false) |
Set the sample value at given time index. More... | |
uint32_t | get_sample (const uint32_t index_) const |
Return the sample value at given time index. More... | |
bool | is_normal (const uint32_t index_) const |
Check if a sample at given time index has a normal value. More... | |
bool | is_invalid (const uint32_t index_) const |
Check if a sample at given time index has an invalid value. More... | |
bool | is_underflow (const uint32_t index_) const |
Check if a sample at given time index has an underflow value. More... | |
bool | is_overflow (const uint32_t index_) const |
Check if a sample at given time index has an overflow value. More... | |
double | get_time (const uint32_t index_) const |
Return the time associated to a given sample. More... | |
uint32_t | get_index (const double time_) const |
Return the sample index associated to a given time. More... | |
void | unset_sample (const uint32_t index_, const bool update_=false) |
Force the sample value at given time index to be invalid. More... | |
void | set_underflow_sample (const uint32_t index_, const bool update_=false) |
Force the sample value at given time index to be underflow. More... | |
void | set_overflow_sample (const uint32_t index_, const bool update_=false) |
Force the sample value at given time index to be overflow. More... | |
virtual void | tree_dump (std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const |
Smart print. More... | |
void | update () |
Update internal data. More... | |
void | slice_from_to (sampled_signal &target_, const std::size_t first_, const std::size_t last_, const uint32_t flags_=0) const |
Extract slice of the signal. More... | |
void | print_ascii (std::ostream &out_, const uint32_t flags_=0) const |
Simple ASCII terminal dump. More... | |
Public Member Functions inherited from geomtools::base_hit | |
bool | has_hit_id () const |
int32_t | get_hit_id () const |
void | set_hit_id (int32_t) |
Set the hit ID integer value. More... | |
void | invalidate_hit_id () |
bool | has_geom_id () const |
Check if the geometry ID is valid. More... | |
const geomtools::geom_id & | get_geom_id () const |
Get a reference on the non-mutable geometry ID. More... | |
geomtools::geom_id & | grab_geom_id () |
Get a reference on the mutable geometry ID. More... | |
void | set_geom_id (const geomtools::geom_id &) |
Set the geometry ID. More... | |
void | invalidate_geom_id () |
Reset the geometry ID. More... | |
bool | has_auxiliaries () const |
Check if there are stored auxiliary properties. More... | |
const datatools::properties & | get_auxiliaries () const |
Get a non-mutable reference on the auxiliaries container. More... | |
datatools::properties & | grab_auxiliaries () |
Get a mutable reference on the auxiliaries container. More... | |
void | set_auxiliaries (const datatools::properties &) |
Set the auxiliaries container. More... | |
void | invalidate_auxiliaries () |
Reset the mutable auxiliaries container. More... | |
base_hit () | |
Default constructor. More... | |
virtual | ~base_hit () |
Destructor. More... | |
virtual void | invalidate () |
Reset the internals of the hit, making it invalid. More... | |
void | reset () |
Reset the internals of the hit, making it invalid. More... | |
virtual void | clear () |
Reset the internals of the hit, making it invalid. More... | |
base_hit & | measure (i_measurement &) |
Apply a measurement on the current hit. More... | |
void | print_tree (std::ostream &out_=std::clog, const boost::property_tree::ptree &options_=datatools::i_tree_dumpable::empty_options()) const override |
void | dump () const |
Smart print (default behaviour) More... | |
Public Member Functions inherited from datatools::i_serializable | |
i_serializable () | |
Default constructor. More... | |
virtual | ~i_serializable () |
Destructor. More... | |
virtual const std::string & | get_serial_tag () const =0 |
Return the serialization string identifier of the class. More... | |
Public Member Functions inherited from datatools::i_tree_dumpable | |
i_tree_dumpable () | |
Constructor. More... | |
virtual | ~i_tree_dumpable () |
Destructor. More... | |
void | print_tree_json (std::ostream &out_=std::clog, const std::string &json_options_="") const |
Printing with jsonized options. More... | |
void | print_tree_json (std::ostream &out_=std::clog, const char *json_options_=nullptr) const |
Printing with jsonized options. More... | |
void | tree_dump_id (const int out_type_=OSTREAM_CLOG, const std::string &title_="", const std::string &indent_="", const bool inherit_=false) const |
void | tree_print_id (const int out_type_=OSTREAM_CLOG, const std::string &title_="") const |
void | smart_print_id (const int out_type_=OSTREAM_CLOG, const std::string &title_="", const std::string &indent_="") const |
Public Member Functions inherited from datatools::i_clear | |
virtual | ~i_clear () |
Destructor. More... | |
Static Public Member Functions | |
static bool | sample_is_normal (const int32_t) |
Check if a sample value is normal (nor invalid, underflow or overflow) More... | |
static bool | sample_is_invalid (const int32_t) |
Check if a sample value is invalid. More... | |
static bool | sample_is_underflow (const int32_t) |
Check if a sample value is underflow. More... | |
static bool | sample_is_overflow (const int32_t) |
Check if a sample value is overflow. More... | |
Static Public Member Functions inherited from datatools::i_tree_dumpable | |
static const boost::property_tree::ptree & | empty_options () |
static boost::property_tree::ptree | make_base_print_options (const std::string &title_, const std::string &indent_="", const bool inherit_=false) |
static std::ostream & | last_skip_tag (std::ostream &out_) |
static std::ostream & | skip_tag (std::ostream &out_) |
static std::ostream & | last_tag (std::ostream &out_) |
static std::ostream & | tag (std::ostream &out_) |
Static Public Attributes | |
static const int32_t | INVALID_SAMPLE = std::numeric_limits<int32_t>::min() |
static const int32_t | UNDERFLOW_SAMPLE = std::numeric_limits<int32_t>::min() + 1 |
static const int32_t | OVERFLOW_SAMPLE = std::numeric_limits<int32_t>::max() |
Static Public Attributes inherited from geomtools::base_hit | |
static const int32_t | INVALID_HIT_ID = -1 |
Protected Member Functions | |
void | _set_defaults () |
Set default attributes values. More... | |
void | _set_default_working_data () |
Set default attributes values. More... | |
void | _recompute_working_data () |
Recompute working data. More... | |
Protected Member Functions inherited from geomtools::base_hit | |
void | _store_set (uint32_t bit_mask_) |
Set the bits from a mask. More... | |
void | _store_unset (uint32_t bit_mask_) |
Unset the bits from a mask. More... | |
bool | _store_check (uint32_t bit_mask_) const |
Check the bits from a mask. More... | |
Additional Inherited Members | |
Protected Attributes inherited from geomtools::base_hit | |
uint32_t | _store |
A simple linear ADC (Analog/Digital Converter)
mctools::digitization::sampled_signal::sampled_signal | ( | ) |
Default constructor.
mctools::digitization::sampled_signal::sampled_signal | ( | const double | sampling_frequency_, |
const std::size_t | nsamples_, | ||
const int32_t | value_ = INVALID_SAMPLE |
||
) |
Constructor.
|
virtual |
Destructor.
|
protected |
Recompute working data.
|
protected |
Set default attributes values.
|
protected |
Set default attributes values.
uint32_t mctools::digitization::sampled_signal::get_index | ( | const double | time_ | ) | const |
Return the sample index associated to a given time.
int32_t mctools::digitization::sampled_signal::get_max_sample | ( | ) | const |
Return the maximum sample value.
double mctools::digitization::sampled_signal::get_max_sampling_time | ( | ) | const |
Return the maximum sampling time.
int32_t mctools::digitization::sampled_signal::get_min_sample | ( | ) | const |
Return the minimum sample value.
double mctools::digitization::sampled_signal::get_min_sampling_time | ( | ) | const |
Return the minimum sampling time.
std::size_t mctools::digitization::sampled_signal::get_number_of_samples | ( | ) | const |
Return the number of samples.
std::size_t mctools::digitization::sampled_signal::get_number_of_sampling_time_intervals | ( | ) | const |
Return the number of sampling time intervals.
uint32_t mctools::digitization::sampled_signal::get_sample | ( | const uint32_t | index_ | ) | const |
Return the sample value at given time index.
const std::vector<int32_t>& mctools::digitization::sampled_signal::get_samples | ( | ) | const |
Return a const reference to the array of samples.
double mctools::digitization::sampled_signal::get_sampling_duration | ( | ) | const |
Return the sampling duration.
double mctools::digitization::sampled_signal::get_sampling_frequency | ( | ) | const |
Return the sampling frequency.
double mctools::digitization::sampled_signal::get_sampling_period | ( | ) | const |
Return the sampling period.
double mctools::digitization::sampled_signal::get_time | ( | const uint32_t | index_ | ) | const |
Return the time associated to a given sample.
bool mctools::digitization::sampled_signal::has_invalid_samples | ( | ) | const |
Check if the array of samples has at least one invalid sample.
bool mctools::digitization::sampled_signal::has_max_sample | ( | ) | const |
Check if the maximum sample value is set.
bool mctools::digitization::sampled_signal::has_min_sample | ( | ) | const |
Check if the minimum sample value is set.
bool mctools::digitization::sampled_signal::has_only_valid_samples | ( | ) | const |
Check if the array of samples has only valid samples.
bool mctools::digitization::sampled_signal::has_overflow_samples | ( | ) | const |
Check if the array of samples has at least one overflow sample.
bool mctools::digitization::sampled_signal::has_sampling_frequency | ( | ) | const |
Check if sampling frequency is set.
bool mctools::digitization::sampled_signal::has_underflow_samples | ( | ) | const |
Check if the array of samples has at least one underflow sample.
bool mctools::digitization::sampled_signal::is_invalid | ( | const uint32_t | index_ | ) | const |
Check if a sample at given time index has an invalid value.
bool mctools::digitization::sampled_signal::is_normal | ( | const uint32_t | index_ | ) | const |
Check if a sample at given time index has a normal value.
bool mctools::digitization::sampled_signal::is_overflow | ( | const uint32_t | index_ | ) | const |
Check if a sample at given time index has an overflow value.
bool mctools::digitization::sampled_signal::is_sampling_initialized | ( | ) | const |
Check if the array of samples is initialized.
bool mctools::digitization::sampled_signal::is_underflow | ( | const uint32_t | index_ | ) | const |
Check if a sample at given time index has an underflow value.
|
virtual |
Check validity.
Reimplemented from geomtools::base_hit.
void mctools::digitization::sampled_signal::print_ascii | ( | std::ostream & | out_, |
const uint32_t | flags_ = 0 |
||
) | const |
Simple ASCII terminal dump.
void mctools::digitization::sampled_signal::reset | ( | ) |
Reset.
void mctools::digitization::sampled_signal::reset_number_of_samples | ( | ) |
Reset the number of samples.
void mctools::digitization::sampled_signal::reset_sampling_frequency | ( | ) |
Reset sampling frequency and associated period.
|
static |
Check if a sample value is invalid.
|
static |
Check if a sample value is normal (nor invalid, underflow or overflow)
|
static |
Check if a sample value is overflow.
|
static |
Check if a sample value is underflow.
void mctools::digitization::sampled_signal::set_number_of_samples | ( | const std::size_t | nsamples_, |
const int32_t | value_ = INVALID_SAMPLE |
||
) |
Set the number of samples.
void mctools::digitization::sampled_signal::set_overflow_sample | ( | const uint32_t | index_, |
const bool | update_ = false |
||
) |
Force the sample value at given time index to be overflow.
void mctools::digitization::sampled_signal::set_sample | ( | const uint32_t | index_, |
const int32_t | sample_, | ||
const bool | update_ = false |
||
) |
Set the sample value at given time index.
void mctools::digitization::sampled_signal::set_samples | ( | const std::vector< int32_t > & | , |
const bool | update_ = true |
||
) |
Set the array of samples.
void mctools::digitization::sampled_signal::set_sampling_frequency | ( | const double | ) |
Set the sampling frequency.
void mctools::digitization::sampled_signal::set_sampling_period | ( | const double | ) |
Set the sampling period.
void mctools::digitization::sampled_signal::set_underflow_sample | ( | const uint32_t | index_, |
const bool | update_ = false |
||
) |
Force the sample value at given time index to be underflow.
void mctools::digitization::sampled_signal::slice_from_to | ( | sampled_signal & | target_, |
const std::size_t | first_, | ||
const std::size_t | last_, | ||
const uint32_t | flags_ = 0 |
||
) | const |
Extract slice of the signal.
|
virtual |
Smart print.
Reimplemented from geomtools::base_hit.
void mctools::digitization::sampled_signal::unset_sample | ( | const uint32_t | index_, |
const bool | update_ = false |
||
) |
Force the sample value at given time index to be invalid.
void mctools::digitization::sampled_signal::update | ( | ) |
Update internal data.
|
static |
|
static |
|
static |