Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:03:31

0001 // -*- C++ -*-
0002 // 
0003 // -----------------------------------------------------------------------
0004 //                             HEP Random
0005 //                      --- HepRandomVector ---
0006 //                 inlined functions implementation file
0007 // -----------------------------------------------------------------------
0008 // =======================================================================
0009 // Mark Fischler - Created: 19th October 1998
0010 // =======================================================================
0011 
0012 namespace CLHEP {
0013 
0014 inline void HepRandomVector::setSeed(long seed, int lux) {
0015   theEngine->setSeed(seed,lux);
0016 }
0017 
0018 inline void HepRandomVector::setSeeds(const long* seeds, int aux) {
0019   theEngine->setSeeds(seeds,aux);
0020 }
0021 
0022 inline long HepRandomVector::getSeed() const {
0023   return theEngine->getSeed();
0024 }
0025 
0026 inline const long* HepRandomVector::getSeeds() const {
0027   return theEngine->getSeeds();
0028 }
0029 
0030 inline void HepRandomVector::saveStatus( const char filename[] ) const {
0031   theEngine->saveStatus( filename );
0032 }
0033 
0034 inline void HepRandomVector::restoreStatus( const char filename[] ) {
0035   theEngine->restoreStatus( filename );
0036 }
0037 
0038 inline void HepRandomVector::showStatus() const {
0039   theEngine->showStatus();
0040 }
0041 
0042 // In analogy to the HepRandom class, we inline the following, even though now
0043 // they contain a loop to fill a vector and are thus more complicated.
0044 
0045 inline HepVector HepRandomVector::flat() {
0046   HepVector v;
0047   int i;
0048   for ( i = 0; i < v.num_row(); i++ ) {
0049     v[i] = theEngine->flat();
0050   }
0051   // Instead of this loop, the engine's flatArray routine could be
0052   // used if there were a guarantee that the memory for the HepVector
0053   // is merely its members in order.  But there is no such guarantee.
0054   return v;
0055 }
0056 
0057 inline void HepRandomVector::flatArray(const int size, HepVector* vect) {
0058   int n;
0059   int i;
0060   for ( n = 0; n < size; n++ ) {
0061     for ( i = 0; i < vect[n].num_row(); i++ ) {
0062       vect[n][i] = theEngine->flat();
0063       // Here, the engine's flatArray routine is not good
0064       // to use because each element of vect is std:vector
0065     }
0066   }
0067 }
0068 
0069 inline HepVector HepRandomVector::flat(HepRandomEngine* theNewEngine)
0070 {
0071   HepVector v;
0072   int i;
0073   for ( i = 0; i < v.num_row(); i++ ) {
0074     v[i] = theNewEngine->flat();
0075   }
0076   return v;
0077 }
0078 
0079 inline void HepRandomVector::flatArray(HepRandomEngine* theNewEngine, 
0080                           const int size, HepVector* vect)
0081 {
0082   int n;
0083   int i;
0084   for ( n = 0; n < size; n++ ) {
0085     for ( i = 0; i < vect[n].num_row(); i++ ) {
0086       vect[n][i] = theNewEngine->flat();
0087     }
0088   }
0089 }
0090 
0091 }  // namespace CLHEP