CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RandomEngineAndDistribution.cc
Go to the documentation of this file.
2 
7 
8 #include "CLHEP/Random/RandomEngine.h"
9 
12  if ( ! rng.isAvailable() ) {
13  throw cms::Exception("Configuration") <<
14  "RandomNumberGenerator service is not available.\n"
15  "You must add the service in the configuration file\n"
16  "or remove the module that requires it.";
17  }
18  engine_ = &rng->getEngine(streamID);
19 
20  // Get the TRandom3 egine, to benefit from Root functional random generation
21  if ( engine_->name() == "TRandom3" )
22  rootEngine_ = ( (edm::TRandomAdaptor*) engine_ )->getRootEngine();
23 }
24 
27  if ( ! rng.isAvailable() ) {
28  throw cms::Exception("Configuration") <<
29  "RandomNumberGenerator service is not available.\n"
30  "You must add the service in the configuration file\n"
31  "or remove the module that requires it.";
32  }
33  engine_ = &rng->getEngine(luminosityBlockIndex);
34 
35  // Get the TRandom3 egine, to benefit from Root functional random generation
36  if ( engine_->name() == "TRandom3" )
37  rootEngine_ = ( (edm::TRandomAdaptor*) engine_ )->getRootEngine();
38 }
39 
42  if ( ! rng.isAvailable() ) {
43  throw cms::Exception("Configuration") <<
44  "RandomNumberGenerator service is not available.\n"
45  "You must add the service in the configuration file\n"
46  "or remove the module that requires it.";
47  }
48  engine_ = &rng->getEngine();
49 
50  // Get the TRandom3 egine, to benefit from Root functional random generation
51  if ( engine_->name() == "TRandom3" )
52  rootEngine_ = ( (edm::TRandomAdaptor*) engine_ )->getRootEngine();
53 }
54 
56 }
bool isAvailable() const
Definition: Service.h:46
virtual CLHEP::HepRandomEngine & getEngine() const =0
Use this to get the random number engine, this is the only function most users should call...