LArSoft
v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
|
Helper class to support range checking. More...
#include "BasePolicies.h"
Public Types | |
using | seed_t = SEED |
using | seed_t = SEED |
Public Member Functions | |
RangeCheckHelper (std::string maxSeedsLabel="maxUniqueEngines", std::string baseSeedLabel="baseSeed", std::string checkRangeLabel="checkRange") | |
Constructor; specify configuration labels. More... | |
void | SetConfigLabels (std::string maxSeedsLabel="maxUniqueEngines", std::string baseSeedLabel="baseSeed", std::string checkRangeLabel="checkRange") |
bool | configure (fhicl::ParameterSet const &pset) |
void | SetCheck (bool doCheck=true) |
Sets whether to perform the check or not. More... | |
void | SetBaseSeed (seed_t base_seed) |
Sets the base seed directly. More... | |
void | SetNSeeds (seed_t nSeeds) |
Sets the number of seeds directly. More... | |
bool | operator() (seed_t seed) const |
Performs the check on the specified seed. More... | |
void | EnsureRange (std::string policy, SeedMasterHelper::EngineId const &id, seed_t seed) const |
Throws an exception if the range check on seed fails. More... | |
bool | isConfigured () const |
Returns whether all the parameters are configured. More... | |
std::vector< std::string > | missingConfig () const |
Returns the items currently not configured. More... | |
template<typename STREAM > | |
void | print (STREAM &out, std::string indent=std::string()) const |
Prints the configuration int the specified stream. More... | |
RangeCheckHelper (std::string maxSeedsLabel="maxUniqueEngines", std::string baseSeedLabel="baseSeed", std::string checkRangeLabel="checkRange") | |
Constructor; specify configuration labels. More... | |
void | SetConfigLabels (std::string maxSeedsLabel="maxUniqueEngines", std::string baseSeedLabel="baseSeed", std::string checkRangeLabel="checkRange") |
bool | configure (fhicl::ParameterSet const &pset) |
void | SetCheck (bool doCheck=true) |
Sets whether to perform the check or not. More... | |
void | SetBaseSeed (seed_t base_seed) |
Sets the base seed directly. More... | |
void | SetNSeeds (seed_t nSeeds) |
Sets the number of seeds directly. More... | |
bool | operator() (seed_t seed) const |
Performs the check on the specified seed. More... | |
void | EnsureRange (std::string policy, SeedMasterHelper::EngineId const &id, seed_t seed) const |
Throws an exception if the range check on seed fails. More... | |
bool | isConfigured () const |
Returns whether all the parameters are configured. More... | |
std::vector< std::string > | missingConfig () const |
Returns the items currently not configured. More... | |
template<typename STREAM > | |
void | print (STREAM &out, std::string indent=std::string()) const |
Prints the configuration int the specified stream. More... | |
Protected Types | |
enum | Params_t { pmMaxSeeds, pmBaseSeed, pmDoCheck, pmNParams, pmMaxSeeds, pmBaseSeed, pmDoCheck, pmNParams } |
enum | Params_t { pmMaxSeeds, pmBaseSeed, pmDoCheck, pmNParams, pmMaxSeeds, pmBaseSeed, pmDoCheck, pmNParams } |
Protected Attributes | |
std::array< std::string, NParams > | paramLabels |
std::bitset< NParams > | hasParameters |
bool | bCheck = true |
should we perform the check? More... | |
seed_t | BaseSeed |
minimum valid seed More... | |
seed_t | MaxSeeds |
number of valid seeds More... | |
Static Protected Attributes | |
static constexpr unsigned int | NParams = (unsigned int) pmNParams |
Helper class to support range checking.
Definition at line 99 of file BasePolicies.h.
using rndm::details::RangeCheckHelper< SEED >::seed_t = SEED |
Definition at line 101 of file BasePolicies.h.
using rndm::details::RangeCheckHelper< SEED >::seed_t = SEED |
Definition at line 146 of file RandomSeedPolicyBase.h.
|
protected |
Enumerator | |
---|---|
pmMaxSeeds | |
pmBaseSeed | |
pmDoCheck | |
pmNParams | |
pmMaxSeeds | |
pmBaseSeed | |
pmDoCheck | |
pmNParams |
Definition at line 158 of file BasePolicies.h.
|
protected |
Enumerator | |
---|---|
pmMaxSeeds | |
pmBaseSeed | |
pmDoCheck | |
pmNParams | |
pmMaxSeeds | |
pmBaseSeed | |
pmDoCheck | |
pmNParams |
Definition at line 203 of file RandomSeedPolicyBase.h.
|
inline |
Constructor; specify configuration labels.
Definition at line 104 of file BasePolicies.h.
|
inline |
Constructor; specify configuration labels.
Definition at line 149 of file RandomSeedPolicyBase.h.
bool rndm::details::RangeCheckHelper< SEED >::configure | ( | fhicl::ParameterSet const & | pset | ) |
Configures from a parameter set
Definition at line 189 of file BasePolicies.h.
References util::empty(), fhicl::ParameterSet::get_if_present(), and seed.
Referenced by rndm::details::CheckedRangePolicy< SEED >::ensureRange(), and rndm::details::CheckedRangePolicy< SEED >::static_configure().
bool rndm::details::RangeCheckHelper< SEED >::configure | ( | fhicl::ParameterSet const & | pset | ) |
Configures from a parameter set
void rndm::details::RangeCheckHelper< SEED >::EnsureRange | ( | std::string | policy, |
SeedMasterHelper::EngineId const & | id, | ||
seed_t | seed | ||
) | const |
Throws an exception if the range check on seed fails.
Definition at line 214 of file BasePolicies.h.
References art::errors::LogicError, and rndm::details::RangeCheckHelper< SEED >::print().
Referenced by rndm::details::CheckedRangePolicy< SEED >::ensureRange().
void rndm::details::RangeCheckHelper< SEED >::EnsureRange | ( | std::string | policy, |
SeedMasterHelper::EngineId const & | id, | ||
seed_t | seed | ||
) | const |
Throws an exception if the range check on seed fails.
bool rndm::details::RangeCheckHelper< SEED >::isConfigured | ( | ) | const |
Returns whether all the parameters are configured.
Definition at line 208 of file BasePolicies.h.
Referenced by rndm::details::CheckedRangePolicy< SEED >::CheckRangeConfiguration(), and rndm::details::CheckedRangePolicy< SEED >::ensureRange().
bool rndm::details::RangeCheckHelper< SEED >::isConfigured | ( | ) | const |
Returns whether all the parameters are configured.
std::vector< std::string > rndm::details::RangeCheckHelper< SEED >::missingConfig | ( | ) | const |
Returns the items currently not configured.
Definition at line 242 of file BasePolicies.h.
Referenced by rndm::details::CheckedRangePolicy< SEED >::CheckRangeConfiguration(), and rndm::details::CheckedRangePolicy< SEED >::ensureRange().
std::vector<std::string> rndm::details::RangeCheckHelper< SEED >::missingConfig | ( | ) | const |
Returns the items currently not configured.
|
inline |
Performs the check on the specified seed.
Definition at line 136 of file BasePolicies.h.
|
inline |
Performs the check on the specified seed.
Definition at line 181 of file RandomSeedPolicyBase.h.
void rndm::details::RangeCheckHelper< SEED >::print | ( | STREAM & | out, |
std::string | indent = std::string() |
||
) | const |
Prints the configuration int the specified stream.
Definition at line 230 of file BasePolicies.h.
Referenced by rndm::details::RangeCheckHelper< SEED >::EnsureRange().
void rndm::details::RangeCheckHelper< SEED >::print | ( | STREAM & | out, |
std::string | indent = std::string() |
||
) | const |
Prints the configuration int the specified stream.
|
inline |
Sets the base seed directly.
Definition at line 128 of file BasePolicies.h.
Referenced by rndm::details::AutoIncrementPolicy< SEED >::createSeed(), rndm::details::LinearMappingPolicy< SEED >::createSeed(), and rndm::details::PredefinedOffsetPolicy< SEED >::createSeed().
|
inline |
Sets the base seed directly.
Definition at line 173 of file RandomSeedPolicyBase.h.
|
inline |
Sets whether to perform the check or not.
Definition at line 124 of file BasePolicies.h.
Referenced by rndm::details::PredefinedSeedPolicy< SEED >::static_configure().
|
inline |
Sets whether to perform the check or not.
Definition at line 169 of file RandomSeedPolicyBase.h.
void rndm::details::RangeCheckHelper< SEED >::SetConfigLabels | ( | std::string | maxSeedsLabel = "maxUniqueEngines" , |
std::string | baseSeedLabel = "baseSeed" , |
||
std::string | checkRangeLabel = "checkRange" |
||
) |
Definition at line 177 of file BasePolicies.h.
Referenced by rndm::details::AutoIncrementPolicy< SEED >::configure(), rndm::details::LinearMappingPolicy< SEED >::configure(), and rndm::details::PredefinedOffsetPolicy< SEED >::configure().
void rndm::details::RangeCheckHelper< SEED >::SetConfigLabels | ( | std::string | maxSeedsLabel = "maxUniqueEngines" , |
std::string | baseSeedLabel = "baseSeed" , |
||
std::string | checkRangeLabel = "checkRange" |
||
) |
|
inline |
Sets the number of seeds directly.
Definition at line 132 of file BasePolicies.h.
Referenced by rndm::details::LinearMappingPolicy< SEED >::createSeed().
|
inline |
Sets the number of seeds directly.
Definition at line 177 of file RandomSeedPolicyBase.h.
|
protected |
minimum valid seed
Definition at line 170 of file BasePolicies.h.
|
protected |
should we perform the check?
Definition at line 169 of file BasePolicies.h.
|
protected |
Definition at line 167 of file BasePolicies.h.
|
protected |
number of valid seeds
Definition at line 171 of file BasePolicies.h.
|
staticprotected |
Definition at line 164 of file BasePolicies.h.
|
protected |
Definition at line 166 of file BasePolicies.h.