Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
rndm::details::CheckedRangePolicy< SEED > Class Template Reference

Range-checked policy (abstract) More...

#include <BasePolicies.h>

Inheritance diagram for rndm::details::CheckedRangePolicy< SEED >:
rndm::details::RandomSeedPolicyBase< SEED > rndm::details::RandomSeedPolicyBase< SEED > rndm::details::AutoIncrementPolicy< SEED > rndm::details::AutoIncrementPolicy< SEED > rndm::details::LinearMappingPolicy< SEED > rndm::details::LinearMappingPolicy< SEED > rndm::details::PerInstancePolicy< SEED > rndm::details::PerInstancePolicy< SEED > rndm::details::PredefinedOffsetPolicy< SEED > rndm::details::PredefinedOffsetPolicy< SEED > rndm::details::PredefinedSeedPolicy< SEED > rndm::details::PredefinedSeedPolicy< SEED > rndm::details::PredefinedOffsetPolicy< SEED > rndm::details::PredefinedOffsetPolicy< SEED > rndm::details::PredefinedSeedPolicy< SEED > rndm::details::PredefinedSeedPolicy< SEED >

Public Types

using base_t = RandomSeedPolicyBase< SEED >
 
using this_t = CheckedRangePolicy< SEED >
 
using seed_t = typename base_t::seed_t
 
using base_t = RandomSeedPolicyBase< SEED >
 
using this_t = CheckedRangePolicy< SEED >
 
using seed_t = typename base_t::seed_t
 
- Public Types inherited from rndm::details::RandomSeedPolicyBase< SEED >
using seed_t = SEED
 type of the random seed More...
 
using EventData_t = NuRandomServiceHelper::EventSeedInputData
 type of data used for event seeds More...
 
using seed_t = SEED
 type of the random seed More...
 
using EventData_t = NuRandomServiceHelper::EventSeedInputData
 type of data used for event seeds More...
 

Public Member Functions

 CheckedRangePolicy (std::string policy_name, fhicl::ParameterSet const &pset)
 Constructor; requires the policy name. More...
 
virtual void configure (fhicl::ParameterSet const &pset) override
 Configure this policy. More...
 
virtual seed_t getSeed (SeedMasterHelper::EngineId const &id)
 Returns the next random number. More...
 
virtual void print (std::ostream &out) const override
 Prints information on the configuration of this policy. More...
 
 CheckedRangePolicy (std::string policy_name, fhicl::ParameterSet const &pset)
 Constructor; requires the policy name. More...
 
virtual void configure (fhicl::ParameterSet const &pset) override
 Configure this policy. More...
 
virtual seed_t getSeed (SeedMasterHelper::EngineId const &id) override
 Returns the next random number. More...
 
virtual void print (std::ostream &out) const override
 Prints information on the configuration of this policy. More...
 
- Public Member Functions inherited from rndm::details::RandomSeedPolicyBase< SEED >
 RandomSeedPolicyBase (std::string policy_name)
 Constructor; requires the policy name. More...
 
virtual ~RandomSeedPolicyBase ()
 
virtual seed_t getEventSeed (SeedMasterHelper::EngineId const &id, EventData_t const &eventInfo)
 Returns a random number specific to an event. More...
 
std::string getName () const
 Returns the given name of the policy. More...
 
virtual bool yieldsUniqueSeeds () const override
 Returns whether the returned seed should be unique. More...
 
 RandomSeedPolicyBase (std::string policy_name)
 Constructor; requires the policy name. More...
 
virtual ~RandomSeedPolicyBase ()
 
virtual seed_t getEventSeed (SeedMasterHelper::EngineId const &id, EventData_t const &eventInfo)
 Returns a random number specific to an event. More...
 
std::string getName () const
 Returns the given name of the policy. More...
 
virtual bool yieldsUniqueSeeds () const
 Returns whether the returned seed should be unique. More...
 

Protected Member Functions

 CheckedRangePolicy (std::string policy_name)
 Lets the derived class to start configuration. More...
 
virtual void ensureRange (SeedMasterHelper::EngineId const &id, seed_t seed) const
 Performs the range checks and complains if needed. More...
 
void CheckRangeConfiguration () const
 Check that the configuration is complete. More...
 
void static_configure (fhicl::ParameterSet const &pset)
 Local configuration; does not require the range config to be complete. More...
 
 CheckedRangePolicy (std::string policy_name)
 Lets the derived class to start configuration. More...
 
virtual void ensureRange (SeedMasterHelper::EngineId const &id, seed_t seed) const
 Performs the range checks and complains if needed. More...
 
void CheckRangeConfiguration () const
 Check that the configuration is complete. More...
 
void static_configure (fhicl::ParameterSet const &pset)
 Local configuration; does not require the range config to be complete. More...
 
- Protected Member Functions inherited from rndm::details::RandomSeedPolicyBase< SEED >
virtual seed_t createSeed (SeedMasterHelper::EngineId const &)=0
 Extracts the next random number seed. More...
 
virtual seed_t createEventSeed (SeedMasterHelper::EngineId const &, EventData_t const &)
 Extracts a seed for specified event information; returns InvalidSeed. More...
 
virtual seed_t createSeed (SeedMasterHelper::EngineId const &)=0
 Extracts the next random number seed. More...
 
virtual seed_t createEventSeed (SeedMasterHelper::EngineId const &, EventData_t const &)
 Extracts a seed for specified event information; returns InvalidSeed. More...
 

Protected Attributes

RangeCheckHelper< seed_trange_check
 
- Protected Attributes inherited from rndm::details::RandomSeedPolicyBase< SEED >
std::string name
 name of the policy More...
 

Additional Inherited Members

- Static Public Attributes inherited from rndm::details::RandomSeedPolicyBase< SEED >
static constexpr seed_t InvalidSeed = 0
 An invalid seed. More...
 

Detailed Description

template<typename SEED>
class rndm::details::CheckedRangePolicy< SEED >

Range-checked policy (abstract)

Definition at line 254 of file BasePolicies.h.

Member Typedef Documentation

template<typename SEED >
using rndm::details::CheckedRangePolicy< SEED >::base_t = RandomSeedPolicyBase<SEED>

Definition at line 256 of file BasePolicies.h.

template<typename SEED >
using rndm::details::CheckedRangePolicy< SEED >::base_t = RandomSeedPolicyBase<SEED>

Definition at line 301 of file RandomSeedPolicyBase.h.

template<typename SEED >
using rndm::details::CheckedRangePolicy< SEED >::seed_t = typename base_t::seed_t

Definition at line 258 of file BasePolicies.h.

template<typename SEED >
using rndm::details::CheckedRangePolicy< SEED >::seed_t = typename base_t::seed_t

Definition at line 303 of file RandomSeedPolicyBase.h.

template<typename SEED >
using rndm::details::CheckedRangePolicy< SEED >::this_t = CheckedRangePolicy<SEED>

Definition at line 257 of file BasePolicies.h.

template<typename SEED >
using rndm::details::CheckedRangePolicy< SEED >::this_t = CheckedRangePolicy<SEED>

Definition at line 302 of file RandomSeedPolicyBase.h.

Constructor & Destructor Documentation

template<typename SEED >
rndm::details::CheckedRangePolicy< SEED >::CheckedRangePolicy ( std::string  policy_name,
fhicl::ParameterSet const &  pset 
)
inline

Constructor; requires the policy name.

Definition at line 262 of file BasePolicies.h.

262  :
263  base_t(policy_name)
264  { this_t::configure(pset); }
virtual void configure(fhicl::ParameterSet const &pset) override
Configure this policy.
Definition: BasePolicies.h:277
RandomSeedPolicyBase< SEED > base_t
Definition: BasePolicies.h:256
template<typename SEED >
rndm::details::CheckedRangePolicy< SEED >::CheckedRangePolicy ( std::string  policy_name)
inlineprotected

Lets the derived class to start configuration.

Definition at line 299 of file BasePolicies.h.

299 : base_t(policy_name) {}
RandomSeedPolicyBase< SEED > base_t
Definition: BasePolicies.h:256
template<typename SEED >
rndm::details::CheckedRangePolicy< SEED >::CheckedRangePolicy ( std::string  policy_name,
fhicl::ParameterSet const &  pset 
)
inline

Constructor; requires the policy name.

Definition at line 307 of file RandomSeedPolicyBase.h.

307  :
308  base_t(policy_name)
309  { this_t::configure(pset); }
virtual void configure(fhicl::ParameterSet const &pset) override
Configure this policy.
Definition: BasePolicies.h:277
RandomSeedPolicyBase< SEED > base_t
Definition: BasePolicies.h:256
template<typename SEED >
rndm::details::CheckedRangePolicy< SEED >::CheckedRangePolicy ( std::string  policy_name)
inlineprotected

Lets the derived class to start configuration.

Definition at line 344 of file RandomSeedPolicyBase.h.

344 : base_t(policy_name) {}
RandomSeedPolicyBase< SEED > base_t
Definition: BasePolicies.h:256

Member Function Documentation

template<typename SEED >
void rndm::details::CheckedRangePolicy< SEED >::CheckRangeConfiguration ( ) const
protected

Check that the configuration is complete.

Definition at line 323 of file BasePolicies.h.

323  {
324  if (!range_check.isConfigured()) {
325  std::ostringstream sstr;
326  sstr << "configuration of policy '" << this->getName()
327  << "' incomplete:";
328  for (std::string const& name: range_check.missingConfig())
329  sstr << " " << name;
330  throw art::Exception(art::errors::Configuration) << sstr.str();
331  }
332  } // CheckedRangePolicy<SEED>::CheckRangeConfiguration()
std::string string
Definition: nybbler.cc:12
std::vector< std::string > missingConfig() const
Returns the items currently not configured.
Definition: BasePolicies.h:242
bool isConfigured() const
Returns whether all the parameters are configured.
Definition: BasePolicies.h:208
std::string name
name of the policy
Definition: BasePolicies.h:83
RangeCheckHelper< seed_t > range_check
Definition: BasePolicies.h:296
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::string getName() const
Returns the given name of the policy.
Definition: BasePolicies.h:73
template<typename SEED >
void rndm::details::CheckedRangePolicy< SEED >::CheckRangeConfiguration ( ) const
protected

Check that the configuration is complete.

template<typename SEED >
virtual void rndm::details::CheckedRangePolicy< SEED >::configure ( fhicl::ParameterSet const &  pset)
inlineoverridevirtual

Configure this policy.

Parameters
psetthe parameter set for the configuration

Parameters:

  • baseSeed (unsigned integer): the first seed to be delivered
  • checkRange (boolean, default: true): whether to verify that each seed is within the expected range
  • maxUniqueEngines (unsigned integer, mandatory if /checkRange/ is true) the maximum number on seeds we expect to create

Reimplemented from rndm::details::RandomSeedPolicyBase< SEED >.

Reimplemented in rndm::details::PredefinedOffsetPolicy< SEED >, rndm::details::PredefinedSeedPolicy< SEED >, rndm::details::PerInstancePolicy< SEED >, rndm::details::LinearMappingPolicy< SEED >, rndm::details::PerInstancePolicy< SEED >, rndm::details::AutoIncrementPolicy< SEED >, rndm::details::PredefinedOffsetPolicy< SEED >, rndm::details::PredefinedSeedPolicy< SEED >, rndm::details::LinearMappingPolicy< SEED >, and rndm::details::AutoIncrementPolicy< SEED >.

Definition at line 277 of file BasePolicies.h.

278  { base_t::configure(pset); static_configure(pset); }
virtual void configure(fhicl::ParameterSet const &)
Configure this policy.
Definition: BasePolicies.h:61
void static_configure(fhicl::ParameterSet const &pset)
Local configuration; does not require the range config to be complete.
Definition: BasePolicies.h:317
template<typename SEED >
virtual void rndm::details::CheckedRangePolicy< SEED >::configure ( fhicl::ParameterSet const &  pset)
inlineoverridevirtual

Configure this policy.

Parameters
psetthe parameter set for the configuration

Parameters:

  • baseSeed (unsigned integer): the first seed to be delivered
  • checkRange (boolean, default: true): whether to verify that each seed is within the expected range
  • maxUniqueEngines (unsigned integer, mandatory if /checkRange/ is true) the maximum number on seeds we expect to create

Reimplemented from rndm::details::RandomSeedPolicyBase< SEED >.

Reimplemented in rndm::details::PredefinedOffsetPolicy< SEED >, rndm::details::PredefinedSeedPolicy< SEED >, rndm::details::PerInstancePolicy< SEED >, rndm::details::LinearMappingPolicy< SEED >, rndm::details::PerInstancePolicy< SEED >, rndm::details::AutoIncrementPolicy< SEED >, rndm::details::PredefinedOffsetPolicy< SEED >, rndm::details::PredefinedSeedPolicy< SEED >, rndm::details::LinearMappingPolicy< SEED >, and rndm::details::AutoIncrementPolicy< SEED >.

Definition at line 322 of file RandomSeedPolicyBase.h.

323  { base_t::configure(pset); static_configure(pset); }
virtual void configure(fhicl::ParameterSet const &)
Configure this policy.
Definition: BasePolicies.h:61
void static_configure(fhicl::ParameterSet const &pset)
Local configuration; does not require the range config to be complete.
Definition: BasePolicies.h:317
template<typename SEED >
virtual void rndm::details::CheckedRangePolicy< SEED >::ensureRange ( SeedMasterHelper::EngineId const &  id,
seed_t  seed 
) const
inlineprotectedvirtual

Performs the range checks and complains if needed.

Definition at line 303 of file BasePolicies.h.

304  { range_check.EnsureRange(this->getName(), id, seed); }
RangeCheckHelper< seed_t > range_check
Definition: BasePolicies.h:296
void EnsureRange(std::string policy, SeedMasterHelper::EngineId const &id, seed_t seed) const
Throws an exception if the range check on seed fails.
Definition: BasePolicies.h:214
std::string getName() const
Returns the given name of the policy.
Definition: BasePolicies.h:73
template<typename SEED >
virtual void rndm::details::CheckedRangePolicy< SEED >::ensureRange ( SeedMasterHelper::EngineId const &  id,
seed_t  seed 
) const
inlineprotectedvirtual

Performs the range checks and complains if needed.

Definition at line 348 of file RandomSeedPolicyBase.h.

349  { range_check.EnsureRange(this->getName(), id, seed); }
RangeCheckHelper< seed_t > range_check
Definition: BasePolicies.h:296
void EnsureRange(std::string policy, SeedMasterHelper::EngineId const &id, seed_t seed) const
Throws an exception if the range check on seed fails.
Definition: BasePolicies.h:214
std::string getName() const
Returns the given name of the policy.
Definition: BasePolicies.h:73
template<typename SEED >
virtual seed_t rndm::details::CheckedRangePolicy< SEED >::getSeed ( SeedMasterHelper::EngineId const &  id)
inlinevirtual

Returns the next random number.

Reimplemented from rndm::details::RandomSeedPolicyBase< SEED >.

Definition at line 281 of file BasePolicies.h.

282  {
283  seed_t seed = this->createSeed(id);
284  ensureRange(id, seed);
285  return seed;
286  } // getSeed()
unsigned long seed_t
virtual seed_t createSeed(SeedMasterHelper::EngineId const &)=0
Extracts the next random number seed.
virtual void ensureRange(SeedMasterHelper::EngineId const &id, seed_t seed) const
Performs the range checks and complains if needed.
Definition: BasePolicies.h:303
template<typename SEED >
virtual seed_t rndm::details::CheckedRangePolicy< SEED >::getSeed ( SeedMasterHelper::EngineId const &  id)
inlineoverridevirtual

Returns the next random number.

Reimplemented from rndm::details::RandomSeedPolicyBase< SEED >.

Definition at line 326 of file RandomSeedPolicyBase.h.

327  {
328  seed_t seed = this->createSeed(id);
329  ensureRange(id, seed);
330  return seed;
331  } // getSeed()
unsigned long seed_t
virtual seed_t createSeed(SeedMasterHelper::EngineId const &)=0
Extracts the next random number seed.
virtual void ensureRange(SeedMasterHelper::EngineId const &id, seed_t seed) const
Performs the range checks and complains if needed.
Definition: BasePolicies.h:303
template<typename SEED >
virtual void rndm::details::CheckedRangePolicy< SEED >::print ( std::ostream &  out) const
inlineoverridevirtual

Prints information on the configuration of this policy.

Reimplemented from rndm::details::RandomSeedPolicyBase< SEED >.

Reimplemented in rndm::details::PredefinedOffsetPolicy< SEED >, rndm::details::PredefinedSeedPolicy< SEED >, rndm::details::LinearMappingPolicy< SEED >, rndm::details::AutoIncrementPolicy< SEED >, rndm::details::PredefinedOffsetPolicy< SEED >, rndm::details::PredefinedSeedPolicy< SEED >, rndm::details::LinearMappingPolicy< SEED >, and rndm::details::AutoIncrementPolicy< SEED >.

Definition at line 289 of file BasePolicies.h.

290  {
291  base_t::print(out);
292  range_check.print(out << "\n", " ");
293  } // print()
virtual void print(std::ostream &out) const
Prints information on the configuration of this policy.
Definition: BasePolicies.h:76
RangeCheckHelper< seed_t > range_check
Definition: BasePolicies.h:296
void print(STREAM &out, std::string indent=std::string()) const
Prints the configuration int the specified stream.
Definition: BasePolicies.h:230
template<typename SEED >
virtual void rndm::details::CheckedRangePolicy< SEED >::print ( std::ostream &  out) const
inlineoverridevirtual

Prints information on the configuration of this policy.

Reimplemented from rndm::details::RandomSeedPolicyBase< SEED >.

Reimplemented in rndm::details::PredefinedOffsetPolicy< SEED >, rndm::details::PredefinedSeedPolicy< SEED >, rndm::details::LinearMappingPolicy< SEED >, rndm::details::AutoIncrementPolicy< SEED >, rndm::details::PredefinedOffsetPolicy< SEED >, rndm::details::PredefinedSeedPolicy< SEED >, rndm::details::LinearMappingPolicy< SEED >, and rndm::details::AutoIncrementPolicy< SEED >.

Definition at line 334 of file RandomSeedPolicyBase.h.

335  {
336  base_t::print(out);
337  range_check.print(out << "\n", " ");
338  } // print()
virtual void print(std::ostream &out) const
Prints information on the configuration of this policy.
Definition: BasePolicies.h:76
RangeCheckHelper< seed_t > range_check
Definition: BasePolicies.h:296
void print(STREAM &out, std::string indent=std::string()) const
Prints the configuration int the specified stream.
Definition: BasePolicies.h:230
template<typename SEED >
void rndm::details::CheckedRangePolicy< SEED >::static_configure ( fhicl::ParameterSet const &  pset)
protected

Local configuration; does not require the range config to be complete.

Definition at line 317 of file BasePolicies.h.

318  {
319  range_check.configure(pset);
320  } // CheckedRangePolicy<SEED>::static_configure()
bool configure(fhicl::ParameterSet const &pset)
Definition: BasePolicies.h:189
RangeCheckHelper< seed_t > range_check
Definition: BasePolicies.h:296
template<typename SEED >
void rndm::details::CheckedRangePolicy< SEED >::static_configure ( fhicl::ParameterSet const &  pset)
protected

Local configuration; does not require the range config to be complete.

Member Data Documentation

template<typename SEED >
RangeCheckHelper< seed_t > rndm::details::CheckedRangePolicy< SEED >::range_check
protected

Definition at line 296 of file BasePolicies.h.


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