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

Implementation of the "preDefinedOffset" policy. More...

#include <BasePolicies.h>

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

Public Types

using base_t = PerInstancePolicy< SEED >
 
using this_t = PredefinedOffsetPolicy< SEED >
 
using seed_t = typename base_t::seed_t
 
using base_t = PerInstancePolicy< SEED >
 
using this_t = PredefinedOffsetPolicy< SEED >
 
using seed_t = typename base_t::seed_t
 
- Public Types inherited from rndm::details::PerInstancePolicy< SEED >
using base_t = CheckedRangePolicy< SEED >
 
using this_t = PerInstancePolicy< SEED >
 
using seed_t = typename base_t::seed_t
 
using base_t = CheckedRangePolicy< SEED >
 
using this_t = PerInstancePolicy< SEED >
 
using seed_t = typename base_t::seed_t
 
- Public Types inherited from rndm::details::CheckedRangePolicy< SEED >
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

 PredefinedOffsetPolicy (fhicl::ParameterSet const &pset)
 
virtual void configure (fhicl::ParameterSet const &pset) override
 Configure this policy. More...
 
virtual void print (std::ostream &out) const override
 Prints the configuration of this policy. More...
 
 PredefinedOffsetPolicy (fhicl::ParameterSet const &pset)
 
virtual void configure (fhicl::ParameterSet const &pset) override
 Configure this policy. More...
 
virtual void print (std::ostream &out) const override
 Prints the configuration of this policy. More...
 
- Public Member Functions inherited from rndm::details::PerInstancePolicy< SEED >
 PerInstancePolicy (std::string name, fhicl::ParameterSet const &pset)
 
 PerInstancePolicy (std::string name, fhicl::ParameterSet const &pset)
 
- Public Member Functions inherited from rndm::details::CheckedRangePolicy< SEED >
 CheckedRangePolicy (std::string policy_name, fhicl::ParameterSet const &pset)
 Constructor; requires the policy name. More...
 
virtual seed_t getSeed (SeedMasterHelper::EngineId const &id)
 Returns the next random number. More...
 
 CheckedRangePolicy (std::string policy_name, fhicl::ParameterSet const &pset)
 Constructor; requires the policy name. More...
 
virtual seed_t getSeed (SeedMasterHelper::EngineId const &id) override
 Returns the next random number. 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

virtual seed_t createSeed (SeedMasterHelper::EngineId const &id) override
 Returns the seed stored in the parameter set. More...
 
void static_configure (fhicl::ParameterSet const &)
 
virtual seed_t createSeed (SeedMasterHelper::EngineId const &id) override
 Returns the seed stored in the parameter set. More...
 
void static_configure (fhicl::ParameterSet const &)
 
- Protected Member Functions inherited from rndm::details::PerInstancePolicy< SEED >
 PerInstancePolicy (std::string name)
 Internal constructor: does not configure. For use in derived classes. More...
 
seed_t getInstanceSeed (SeedMasterHelper::EngineId const &id) const
 Retrieves the parameter (seed) for the specified engine ID. More...
 
void static_configure (fhicl::ParameterSet const &pset)
 
 PerInstancePolicy (std::string name)
 Internal constructor: does not configure. For use in derived classes. More...
 
seed_t getInstanceSeed (SeedMasterHelper::EngineId const &id) const
 Retrieves the parameter (seed) for the specified engine ID. More...
 
void static_configure (fhicl::ParameterSet const &pset)
 
- Protected Member Functions inherited from rndm::details::CheckedRangePolicy< SEED >
 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 createEventSeed (SeedMasterHelper::EngineId const &, EventData_t const &)
 Extracts a seed for specified event information; returns InvalidSeed. More...
 
virtual seed_t createEventSeed (SeedMasterHelper::EngineId const &, EventData_t const &)
 Extracts a seed for specified event information; returns InvalidSeed. More...
 

Protected Attributes

seed_t base_seed
 
- Protected Attributes inherited from rndm::details::PerInstancePolicy< SEED >
fhicl::ParameterSet parameters
 configuration parameters More...
 
- Protected Attributes inherited from rndm::details::CheckedRangePolicy< SEED >
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...
 
- Static Protected Member Functions inherited from rndm::details::PerInstancePolicy< SEED >
template<typename T >
static T getInstanceParameter (fhicl::ParameterSet const &pset, SeedMasterHelper::EngineId const &id)
 Retrieves the parameter (seed) for the specified engine ID. More...
 
template<typename T >
static T getInstanceParameter (fhicl::ParameterSet const &pset, SeedMasterHelper::EngineId const &id)
 Retrieves the parameter (seed) for the specified engine ID. More...
 

Detailed Description

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

Implementation of the "preDefinedOffset" policy.


See also
CheckedRangePolicy

This is heavily based on CheckedRangePolicy.

Definition at line 693 of file BasePolicies.h.

Member Typedef Documentation

template<typename SEED >
using rndm::details::PredefinedOffsetPolicy< SEED >::base_t = PerInstancePolicy<SEED>

Definition at line 276 of file StandardPolicies.h.

template<typename SEED >
using rndm::details::PredefinedOffsetPolicy< SEED >::base_t = PerInstancePolicy<SEED>

Definition at line 695 of file BasePolicies.h.

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

Definition at line 278 of file StandardPolicies.h.

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

Definition at line 697 of file BasePolicies.h.

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

Definition at line 277 of file StandardPolicies.h.

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

Definition at line 696 of file BasePolicies.h.

Constructor & Destructor Documentation

template<typename SEED >
rndm::details::PredefinedOffsetPolicy< SEED >::PredefinedOffsetPolicy ( fhicl::ParameterSet const &  pset)
inline

Configures from a parameter set

See also
configure()

Definition at line 701 of file BasePolicies.h.

701  :
702  base_t("preDefinedOffset")
703  { this_t::configure(pset); }
virtual void configure(fhicl::ParameterSet const &pset) override
Configure this policy.
Definition: BasePolicies.h:730
PerInstancePolicy< SEED > base_t
Definition: BasePolicies.h:695
template<typename SEED >
rndm::details::PredefinedOffsetPolicy< SEED >::PredefinedOffsetPolicy ( fhicl::ParameterSet const &  pset)
inline

Configures from a parameter set

See also
configure()

Definition at line 282 of file StandardPolicies.h.

282  :
283  base_t("preDefinedOffset")
284  { this_t::configure(pset); }
virtual void configure(fhicl::ParameterSet const &pset) override
Configure this policy.
Definition: BasePolicies.h:730
PerInstancePolicy< SEED > base_t
Definition: BasePolicies.h:695

Member Function Documentation

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

Configure this policy.

Parameters
psetthe parameter set for the configuration

Parameters:

  • baseSeed (unsigned integer): the base seed
  • 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
  • in addition, one entry per engine (see below)

The FHiCL grammar to specify the offsets takes two forms. If no instance name is given, the offset is given by:

moduleLabel : offset

When a module has multiple instances, the offsets are given by:

moduleLabel : {
   instanceName1 : offset1
   instanceName2 : offset2
}

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

Definition at line 311 of file StandardPolicies.h.

312  {
314  ("maxUniqueEngines", "", "checkRange");
315  base_t::configure(pset);
316  static_configure(pset);
317  }
RangeCheckHelper< seed_t > range_check
Definition: BasePolicies.h:296
virtual void configure(fhicl::ParameterSet const &pset) override
Configure this policy.
Definition: BasePolicies.h:527
void SetConfigLabels(std::string maxSeedsLabel="maxUniqueEngines", std::string baseSeedLabel="baseSeed", std::string checkRangeLabel="checkRange")
Definition: BasePolicies.h:177
void static_configure(fhicl::ParameterSet const &)
Definition: BasePolicies.h:755
template<typename SEED >
virtual void rndm::details::PredefinedOffsetPolicy< SEED >::configure ( fhicl::ParameterSet const &  pset)
inlineoverridevirtual

Configure this policy.

Parameters
psetthe parameter set for the configuration

Parameters:

  • baseSeed (unsigned integer): the base seed
  • 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
  • in addition, one entry per engine (see below)

The FHiCL grammar to specify the offsets takes two forms. If no instance name is given, the offset is given by:

moduleLabel : offset

When a module has multiple instances, the offsets are given by:

moduleLabel : {
   instanceName1 : offset1
   instanceName2 : offset2
}

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

Definition at line 730 of file BasePolicies.h.

731  {
733  ("maxUniqueEngines", "", "checkRange");
734  base_t::configure(pset);
735  static_configure(pset);
736  }
RangeCheckHelper< seed_t > range_check
Definition: BasePolicies.h:296
virtual void configure(fhicl::ParameterSet const &pset) override
Configure this policy.
Definition: BasePolicies.h:527
void SetConfigLabels(std::string maxSeedsLabel="maxUniqueEngines", std::string baseSeedLabel="baseSeed", std::string checkRangeLabel="checkRange")
Definition: BasePolicies.h:177
void static_configure(fhicl::ParameterSet const &)
Definition: BasePolicies.h:755
template<typename SEED >
virtual seed_t rndm::details::PredefinedOffsetPolicy< SEED >::createSeed ( SeedMasterHelper::EngineId const &  id)
inlineoverrideprotectedvirtual

Returns the seed stored in the parameter set.

Implements rndm::details::RandomSeedPolicyBase< SEED >.

Definition at line 326 of file StandardPolicies.h.

327  { return base_seed + base_t::getInstanceSeed(id); }
seed_t getInstanceSeed(SeedMasterHelper::EngineId const &id) const
Retrieves the parameter (seed) for the specified engine ID.
Definition: BasePolicies.h:537
template<typename SEED >
virtual seed_t rndm::details::PredefinedOffsetPolicy< SEED >::createSeed ( SeedMasterHelper::EngineId const &  id)
inlineoverrideprotectedvirtual

Returns the seed stored in the parameter set.

Implements rndm::details::RandomSeedPolicyBase< SEED >.

Definition at line 745 of file BasePolicies.h.

746  { return base_seed + base_t::getInstanceSeed(id); }
seed_t getInstanceSeed(SeedMasterHelper::EngineId const &id) const
Retrieves the parameter (seed) for the specified engine ID.
Definition: BasePolicies.h:537
template<typename SEED >
virtual void rndm::details::PredefinedOffsetPolicy< SEED >::print ( std::ostream &  out) const
overridevirtual

Prints the configuration of this policy.

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

template<typename SEED >
void rndm::details::PredefinedOffsetPolicy< SEED >::print ( std::ostream &  out) const
overridevirtual

Prints the configuration of this policy.

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

Definition at line 764 of file BasePolicies.h.

764  {
765  base_t::print(out);
766  out << "\n base seed: " << base_seed;
767  } // PredefinedOffsetPolicy<SEED>::print()
virtual void print(std::ostream &out) const override
Prints information on the configuration of this policy.
Definition: BasePolicies.h:289
template<typename SEED >
void rndm::details::PredefinedOffsetPolicy< SEED >::static_configure ( fhicl::ParameterSet const &  )
protected
template<typename SEED >
void rndm::details::PredefinedOffsetPolicy< SEED >::static_configure ( fhicl::ParameterSet const &  pset)
protected

Definition at line 755 of file BasePolicies.h.

756  {
757  base_seed = pset.get<seed_t>("baseSeed");
760  } // PredefinedOffsetPolicy<SEED>::configure()
unsigned long seed_t
RangeCheckHelper< seed_t > range_check
Definition: BasePolicies.h:296
void SetBaseSeed(seed_t base_seed)
Sets the base seed directly.
Definition: BasePolicies.h:128
void CheckRangeConfiguration() const
Check that the configuration is complete.
Definition: BasePolicies.h:323

Member Data Documentation

template<typename SEED >
seed_t rndm::details::PredefinedOffsetPolicy< SEED >::base_seed
protected

Definition at line 742 of file BasePolicies.h.


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