Tomographer
v5.2
Tomographer C++ Framework Documentation
|
Constant data structure for MH random walk tasks with a value histogram stats collector. More...
#include <tomographer/mhrw_valuehist_tools.h>
Public Types | |
typedef MHRWTasks::CDataBase< MHWalkerParams_, IterCountIntType_, RngSeedType_ > | Base |
The MHRWTasks::CDataBase base class. | |
typedef Base::MHWalkerParams | MHWalkerParams |
The MHWalkerParams required for our MHWalker (for instance a MHWalkerParamsStepSize) | |
typedef Base::RngSeedType | RngSeedType |
Type of the seed for the pseudo-random number generator. | |
typedef Base::IterCountIntType | IterCountIntType |
The integer type which serves to count the number of iterations (see MHRWParams) | |
typedef HistCountIntType_ | HistCountIntType |
The integer counting type in our underlying raw histogram type. | |
typedef ValueCalculator_ | ValueCalculator |
The class which calculates the value we are collecting a histogram of (ValueCalculator Interface compliant) | |
typedef CountRealType_ | CountRealType |
The real type which serves to average histogram counts (typically double ) | |
typedef tomo_internal::valuehist_types< CDataBase, UseBinningAnalysis >::ValueStatsCollectorResultType | ValueStatsCollectorResultType |
The result type of our stats collector. More... | |
typedef tomo_internal::valuehist_types< CDataBase, UseBinningAnalysis >::MHRWStatsResultsBaseType | MHRWStatsResultsBaseType |
Stores result of the stats collector. May serve as base class for your own MHRWStatsResults class. More... | |
typedef tomo_internal::valuehist_types< CDataBase, UseBinningAnalysis >::HistogramType | HistogramType |
The histogram type reported by the task. More... | |
typedef tomo_internal::valuehist_types< CDataBase, UseBinningAnalysis >::HistogramParams | HistogramParams |
The appropriate parameters type for the histogram reported by the task. | |
typedef MHRWParams< MHWalkerParams, IterCountIntType > | MHRWParamsType |
Type for the parameters of the random walk. | |
typedef tomo_internal::valuehist_types< CDataBase, UseBinningAnalysis >::AggregatedHistogramType | AggregatedHistogramType |
Public Types inherited from Tomographer::MHRWTasks::CDataBase< MHWalkerParams_, IterCountIntType_, RngSeedType_ > | |
typedef IterCountIntType_ | IterCountIntType |
Type used to count the number of iterations. | |
typedef MHWalkerParams_ | MHWalkerParams |
Type used to specify the step size. | |
typedef RngSeedType_ | RngSeedType |
Type used to specify the seed of the random number generator. More... | |
typedef MHRWParams< MHWalkerParams, IterCountIntType > | MHRWParamsType |
Type to store the parameters of the Metropolis-Hastings random walk (number of runs, sweep size, etc.) More... | |
Public Member Functions | |
template<ENABLED_IF( !UseBinningAnalysis) > | |
CDataBase (const ValueCalculator &valcalc_, HistogramParams histogram_params_, MHRWParamsType p, RngSeedType base_seed=0) | |
Constructor (use only without binning analysis) | |
template<ENABLED_IF( UseBinningAnalysis) > | |
CDataBase (const ValueCalculator &valcalc_, HistogramParams histogram_params_, int binning_num_levels_, MHRWParamsType p, RngSeedType base_seed=0) | |
Constructor (use only with binning analysis) | |
template<typename LoggerType , ENABLED_IF( !UseBinningAnalysis) > | |
ValueHistogramMHRWStatsCollector< ValueCalculator, LoggerType, HistogramType > | createValueStatsCollector (LoggerType &logger) const |
Create the stats collector (without binning analysis) More... | |
template<typename LoggerType , ENABLED_IF( UseBinningAnalysis) > | |
ValueHistogramWithBinningMHRWStatsCollector< typename tomo_internal::valuehist_types< CDataBase, true >::BinningMHRWStatsCollectorParams, LoggerType > | createValueStatsCollector (LoggerType &logger) const |
Create the stats collector (with binning analysis) More... | |
template<typename TaskResultType > | |
AggregatedHistogramType | aggregateResultHistograms (const std::vector< TaskResultType *> &task_result_list) |
Convenience function for aggregating histograms resulting from value-histogram tasks. More... | |
Public Member Functions inherited from Tomographer::MHRWTasks::CDataBase< MHWalkerParams_, IterCountIntType_, RngSeedType_ > | |
template<typename MHRWParamsType > | |
CDataBase (MHRWParamsType &&p, RngSeedType base_seed_) | |
Constructor. More... | |
template<typename TaskNoCountIntType > | |
RngSeedType | getTaskInput (TaskNoCountIntType k) const |
Returns a random seed to seed the random number generator with for run number k. More... | |
void | printBasicCDataMHRWInfo (std::ostream &str) const |
Get some human-readable info about the random walk as a string. More... | |
std::string | getBasicCDataMHRWInfo () const |
Get some human-readable info about the random walk as a string, see printBasicCDataMHRWInfo() | |
Public Attributes | |
const ValueCalculator | valcalc |
The value calculator instance. | |
const HistogramParams | histogram_params |
The parameters of the histogram that we are collecting. | |
const Tools::StoreIfEnabled< int, UseBinningAnalysis > | binningNumLevels |
The number of levels in the binning analysis (only if we are using a binning analysis) | |
Public Attributes inherited from Tomographer::MHRWTasks::CDataBase< MHWalkerParams_, IterCountIntType_, RngSeedType_ > | |
const MHRWParamsType | mhrw_params |
Parameters of the random walk. More... | |
const RngSeedType | base_seed |
A base random seed from which each run seed will be derived. More... | |
Static Public Attributes | |
static constexpr bool | UseBinningAnalysis = UseBinningAnalysis_ |
Whether or not we are to use a binning analysis for calculating the error bars. | |
Constant data structure for MH random walk tasks with a value histogram stats collector.
You should define your TaskCData class to inherit this class, and be compliant with the MHRandomWalkTaskCData Interface. This class already inherits MHRWTasks::CDataBase, so you only have to inherit this class and provide a createMHWalker() method (see MHRandomWalkTaskCData Interface). (Note that your class will automatically be compliant with the TaskCData Interface in this way.)
Look at the file test/minimal_tomorun.cxx
for an example of you to define your cdata class.
We provide some useful typedefs, as well as a createValueStatsCollector() which should be used by subclasses in the setupRandomWalkAndRun() method of their MHRandomWalkTaskCData Interface implementation.
ValueCalculator | the value calculator type you wish to use; defining which value you are interested in collecting a histogram of during the random walk; |
UseBinningAnalysis | whether or not to use a binning analysis to obtain reliable error bars during the random walk. |
MHWalkerParams | The MHWalkerParams required for our MHWalker (for instance a MHWalkerParamsStepSize) |
RngSeedType | The type used to store the seed of the pseudo random number generator. See MHRWTasks::CDataBase. |
IterCountIntType | the integer type to use for counting iterations. |
CountRealType | the real type to use when calculating the scaled histogram with error bars. |
HistCountIntType | the integer type to record the histogram counts in the underlying raw histogram. |
Note: if your subclass also takes a template parameter to allow or not the use of a binning analysis, then you'll have to define two conditionally enabled constructors to cover both cases. For instance (see also the code in tomorun/tomorun_dispatch.h
for another example):
Definition at line 235 of file mhrw_valuehist_tools.h.
typedef tomo_internal::valuehist_types<CDataBase,UseBinningAnalysis>::HistogramType Tomographer::MHRWTasks::ValueHistogramTools::CDataBase< ValueCalculator_, UseBinningAnalysis_, MHWalkerParams_, RngSeedType_, IterCountIntType_, CountRealType_, HistCountIntType_ >::HistogramType |
The histogram type reported by the task.
Depending on whether we are using a binning analysis, this histogram type will have error bars.
It is either:
Definition at line 304 of file mhrw_valuehist_tools.h.
typedef tomo_internal::valuehist_types<CDataBase,UseBinningAnalysis>::MHRWStatsResultsBaseType Tomographer::MHRWTasks::ValueHistogramTools::CDataBase< ValueCalculator_, UseBinningAnalysis_, MHWalkerParams_, RngSeedType_, IterCountIntType_, CountRealType_, HistCountIntType_ >::MHRWStatsResultsBaseType |
Stores result of the stats collector. May serve as base class for your own MHRWStatsResults class.
Depending on UseBinningAnalysis, this is either MHRWStatsResultsBaseSimple, or directly the corresponding ValueHistogramWithBinningMHRWStatsCollectorResult type.
Remember, this class takes a single argument in the constructor which is a rvalue-reference to the result of the value stats collector.
Definition at line 288 of file mhrw_valuehist_tools.h.
typedef tomo_internal::valuehist_types<CDataBase,UseBinningAnalysis>::ValueStatsCollectorResultType Tomographer::MHRWTasks::ValueHistogramTools::CDataBase< ValueCalculator_, UseBinningAnalysis_, MHWalkerParams_, RngSeedType_, IterCountIntType_, CountRealType_, HistCountIntType_ >::ValueStatsCollectorResultType |
The result type of our stats collector.
This is either:
Definition at line 275 of file mhrw_valuehist_tools.h.
|
inline |
Convenience function for aggregating histograms resulting from value-histogram tasks.
The TaskResultType is expected to be a subclass of MHRWStatsResultsBaseSimple. This will automatically be the case if you're using our CDataBase type, and if you have defined your custom MHRWStatsResults type (see MHRandomWalkTaskCData Interface) using CDataBase::MHRWStatsResultsBaseType as base class.
Definition at line 399 of file mhrw_valuehist_tools.h.
|
inline |
Create the stats collector (without binning analysis)
This method is provided so that user-provided CData random walk description classes can easily create the necessary value histogram stats collector for collecting a histogram of values during a MHRandomWalkTask. This function should typically be called from within the user's setupRandomWalkAndRun() function.
Definition at line 351 of file mhrw_valuehist_tools.h.
|
inline |
Create the stats collector (with binning analysis)
This method is provided so that user-provided CData random walk description classes can easily create the necessary value histogram stats collector for collecting a histogram of values during a MHRandomWalkTask. This function should typically be called from within the user's setupRandomWalkAndRun() function.
Definition at line 372 of file mhrw_valuehist_tools.h.