ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
Atlas_RNG Class Reference

#include <Sherpa_i.h>

Inheritance diagram for Atlas_RNG:
Collaboration diagram for Atlas_RNG:

Public Member Functions

 Atlas_RNG (CLHEP::HepRandomEngine *)
 
 ~Atlas_RNG ()
 
double Get ()
 
bool CanRestoreStatus () const
 
void SaveStatus ()
 
void RestoreStatus ()
 

Private Attributes

CLHEP::HepRandomEngine * p_engine
 
std::string m_filename
 

Detailed Description

Definition at line 77 of file Sherpa_i.h.

Constructor & Destructor Documentation

◆ Atlas_RNG()

Atlas_RNG::Atlas_RNG ( CLHEP::HepRandomEngine *  engine)

Definition at line 379 of file Sherpa_i.cxx.

379  :
380  External_RNG(), p_engine(engine), m_filename("Config.conf")
381 {
382  const int nMax = 26;
383  char alphabet[nMax] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g',
384  'h', 'i', 'j', 'k', 'l', 'm', 'n',
385  'o', 'p', 'q', 'r', 's', 't', 'u',
386  'v', 'w', 'x', 'y', 'z' };
387 
388  struct stat info;
389  if ( !stat("/dev/shm", &info)) {
390  m_filename = "/dev/shm/Config.conf.";
391  for (size_t i = 0; i < 6; ++i)
392  m_filename += alphabet[rand() % nMax];
393  }
394  std::cout << "RNG state being saved to: " << m_filename << std::endl;
395 }

◆ ~Atlas_RNG()

Atlas_RNG::~Atlas_RNG ( )

Definition at line 397 of file Sherpa_i.cxx.

397 { std::remove(m_filename.c_str()); }

Member Function Documentation

◆ CanRestoreStatus()

bool Atlas_RNG::CanRestoreStatus ( ) const
inline

Definition at line 85 of file Sherpa_i.h.

85 { return true; }

◆ Get()

double Atlas_RNG::Get ( )

Definition at line 399 of file Sherpa_i.cxx.

399  {
400 
401  return CLHEP::RandFlat::shoot(p_engine);
402 
403 }

◆ RestoreStatus()

void Atlas_RNG::RestoreStatus ( )

Definition at line 407 of file Sherpa_i.cxx.

407 { p_engine->restoreStatus(m_filename.c_str()); }

◆ SaveStatus()

void Atlas_RNG::SaveStatus ( )

Definition at line 405 of file Sherpa_i.cxx.

405 { p_engine->saveStatus(m_filename.c_str()); }

Member Data Documentation

◆ m_filename

std::string Atlas_RNG::m_filename
private

Definition at line 79 of file Sherpa_i.h.

◆ p_engine

CLHEP::HepRandomEngine* Atlas_RNG::p_engine
private

Definition at line 78 of file Sherpa_i.h.


The documentation for this class was generated from the following files:
grepfile.info
info
Definition: grepfile.py:38
Atlas_RNG::m_filename
std::string m_filename
Definition: Sherpa_i.h:79
PixelModuleFeMask_create_db.remove
string remove
Definition: PixelModuleFeMask_create_db.py:83
LArG4FSStartPointFilter.rand
rand
Definition: LArG4FSStartPointFilter.py:80
lumiFormat.i
int i
Definition: lumiFormat.py:85
Atlas_RNG::p_engine
CLHEP::HepRandomEngine * p_engine
Definition: Sherpa_i.h:78
beamspotman.stat
stat
Definition: beamspotman.py:266