SeedTestUtils.h
Go to the documentation of this file.
1 /**
2  * @file SeedTestUtils.h
3  * @brief Functions used in NuRandomService tests
4  * @author Gianluca Petrillo (petrillo@fnal.gov)
5  * @date March 17, 2016
6  * @see SeedTestUtils.cxx
7  */
8 
9 #ifndef ARTEXTENSIONS_TEST_SEEDSERVICE_SEEDTESTUTILS_H
10 #define ARTEXTENSIONS_TEST_SEEDSERVICE_SEEDTESTUTILS_H 1
11 
12 // C++ includes.
13 #include <exception>
14 #include <string>
15 
16 // Framework includes.
20 
21 // forward declarations
22 namespace CLHEP {
23  class HepRandomEngine;
24  class RandFlat;
25 } // namespace CLHEP
26 
27 
28 namespace testing {
29  namespace NuRandomService {
30 
31  /// Type of seed
33 
34  /// Returns whether the exception looks to be from NuRandomService
36 
37 
38  /// Returns whether the exception looks to be from NuRandomService
39  /// and has specified code
42 
43  /// Extracts "statistics" from a flat random number distribution
44  unsigned short RollStat(CLHEP::RandFlat& rand);
45 
46  /// Creates a "character statistics" using the specified random engine
47  std::string CreateCharacter(CLHEP::HepRandomEngine& engine);
48 
49 
50  /// @{
51  /// Returns the seed of the specified engine
52  seed_t readSeed(CLHEP::HepRandomEngine const& engine);
53  /// @}
54 
55 
56  } // namespace NuRandomService
57 } // namespace testing
58 
59 #endif // ARTEXTENSIONS_TEST_SEEDSERVICE_SEEDTESTUTILS_H
LArSoft test utilities.
std::string string
Definition: nybbler.cc:12
art::detail::EngineCreator::seed_t seed_t
Type of seed.
Definition: SeedTestUtils.h:32
const double e
std::string CreateCharacter(CLHEP::HepRandomEngine &engine)
Creates a "character statistics" using the specified random engine.
CodeOutputInterface * code
seed_t readSeed(CLHEP::HepRandomEngine const &engine)
Returns the seed of the specified engine (CLHEP overload)
bool isSeedServiceException(std::exception const &e)
Returns whether the exception looks to be from NuRandomService.
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
unsigned short RollStat(CLHEP::RandFlat &rand)
Extracts "statistics" from a flat random number distribution.