Public Member Functions | Private Member Functions | Private Attributes | List of all members
art::detail::DataSetSampler Class Reference

#include "/cvmfs/nova.opensciencegrid.org/externals/art/v2_13_00/source/art/Framework/Modules/detail/DataSetSampler.h"

Public Member Functions

 DataSetSampler (std::vector< std::string > const &datasetNames, std::vector< double > const &weights) noexcept(false)
 
auto const & sample ()
 
auto const & datasets () const noexcept
 
auto weight (std::string const &dataset) const
 
auto probability (std::string const &dataset) const
 

Private Member Functions

std::size_t index_for (std::string const &dataset) const
 

Private Attributes

std::vector< std::stringdatasetNames_
 
std::vector< double > weights_
 
std::default_random_engine engine_ {}
 
std::discrete_distribution< unsigned > dist_
 

Detailed Description

Definition at line 22 of file DataSetSampler.h.

Constructor & Destructor Documentation

art::detail::DataSetSampler::DataSetSampler ( std::vector< std::string > const &  datasetNames,
std::vector< double > const &  weights 
)
explicitnoexcept

Member Function Documentation

auto const& art::detail::DataSetSampler::datasets ( ) const
inlinenoexcept

Definition at line 37 of file DataSetSampler.h.

38  {
39  return datasetNames_;
40  }
std::vector< std::string > datasetNames_
std::size_t art::detail::DataSetSampler::index_for ( std::string const &  dataset) const
private
auto art::detail::DataSetSampler::probability ( std::string const &  dataset) const
inline

Definition at line 49 of file DataSetSampler.h.

References make_training::dataset, and string.

50  {
51  return dist_.probabilities()[index_for(dataset)];
52  }
std::size_t index_for(std::string const &dataset) const
std::discrete_distribution< unsigned > dist_
auto const& art::detail::DataSetSampler::sample ( )
inline

Definition at line 29 of file DataSetSampler.h.

References ana::assert(), and allTimeWatchdog::index.

30  {
31  auto const index = dist_(engine_);
32  assert(index < datasetNames_.size());
33  return datasetNames_[index];
34  }
std::default_random_engine engine_
std::discrete_distribution< unsigned > dist_
assert(nhit_max >=nhit_nbins)
std::vector< std::string > datasetNames_
auto art::detail::DataSetSampler::weight ( std::string const &  dataset) const
inline

Definition at line 43 of file DataSetSampler.h.

44  {
45  return weights_[index_for(dataset)];
46  }
std::size_t index_for(std::string const &dataset) const
std::vector< double > weights_

Member Data Documentation

std::vector<std::string> art::detail::DataSetSampler::datasetNames_
private

Definition at line 57 of file DataSetSampler.h.

std::discrete_distribution<unsigned> art::detail::DataSetSampler::dist_
private

Definition at line 60 of file DataSetSampler.h.

std::default_random_engine art::detail::DataSetSampler::engine_ {}
private

Definition at line 59 of file DataSetSampler.h.

std::vector<double> art::detail::DataSetSampler::weights_
private

Definition at line 58 of file DataSetSampler.h.


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