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 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /externals/clhep/src/EngineFactory.cc (Version 11.3.0) and /externals/clhep/src/EngineFactory.cc (Version 9.5)


                                                   >>   1 // $Id:$
  1 // -*- C++ -*-                                      2 // -*- C++ -*-
  2 //                                                  3 //
  3 // -------------------------------------------      4 // -----------------------------------------------------------------------
  4 //                             HEP Random           5 //                             HEP Random
  5 //                      --- EngineFactory ---       6 //                      --- EngineFactory ---
  6 //                      class implementation f      7 //                      class implementation file
  7 // -------------------------------------------      8 // -----------------------------------------------------------------------
  8 //                                                  9 //
  9 // ===========================================     10 // =======================================================================
 10 // Mark Fischler  - Created: Dec. 21, 2004         11 // Mark Fischler  - Created: Dec. 21, 2004
 11 // ===========================================     12 // =======================================================================
 12                                                    13 
 13 #include "CLHEP/Random/EngineFactory.h"            14 #include "CLHEP/Random/EngineFactory.h"
 14 #include "CLHEP/Random/DualRand.h"                 15 #include "CLHEP/Random/DualRand.h"
 15 #include "CLHEP/Random/JamesRandom.h"              16 #include "CLHEP/Random/JamesRandom.h"
 16 #include "CLHEP/Random/MixMaxRng.h"            << 
 17 #include "CLHEP/Random/MTwistEngine.h"             17 #include "CLHEP/Random/MTwistEngine.h"
 18 #include "CLHEP/Random/RanecuEngine.h"             18 #include "CLHEP/Random/RanecuEngine.h"
 19 #include "CLHEP/Random/Ranlux64Engine.h"           19 #include "CLHEP/Random/Ranlux64Engine.h"
 20 #include "CLHEP/Random/RanluxppEngine.h"       << 
 21 #include "CLHEP/Random/RanluxEngine.h"             20 #include "CLHEP/Random/RanluxEngine.h"
 22 #include "CLHEP/Random/RanshiEngine.h"             21 #include "CLHEP/Random/RanshiEngine.h"
 23 #include "CLHEP/Random/NonRandomEngine.h"          22 #include "CLHEP/Random/NonRandomEngine.h"
 24 #include "CLHEP/Random/engineIDulong.h"            23 #include "CLHEP/Random/engineIDulong.h"
 25 #include <iostream>                                24 #include <iostream>
 26 #include <string>                                  25 #include <string>
 27 #include <vector>                              << 
 28                                                    26 
 29 namespace CLHEP {                                  27 namespace CLHEP {
 30                                                    28 
 31 template<class E>                                  29 template<class E>
 32 static HepRandomEngine*                            30 static HepRandomEngine* 
 33 makeAnEngine (const std::string & tag,             31 makeAnEngine (const std::string & tag, 
 34               std::istream & is) {                 32               std::istream & is) {
 35   if ( tag != E::beginTag() ) return 0;            33   if ( tag != E::beginTag() ) return 0;
 36   HepRandomEngine* eptr = new E;                   34   HepRandomEngine* eptr = new E;
 37   eptr->getState(is);                              35   eptr->getState(is);
 38   if (!is) return 0;                               36   if (!is) return 0;
 39   return eptr;                                     37   return eptr;        
 40 }                                                  38 }       
 41                                                    39 
 42 template<class E>                                  40 template<class E>
 43 static HepRandomEngine*                            41 static HepRandomEngine* 
 44 makeAnEngine (const std::vector<unsigned long>     42 makeAnEngine (const std::vector<unsigned long> & v) {
 45   if ( (v[0] & 0xffffffffUL) != engineIDulong<     43   if ( (v[0] & 0xffffffffUL) != engineIDulong<E>() ) return 0;
 46   HepRandomEngine* eptr = new E;                   44   HepRandomEngine* eptr = new E;
 47   bool success = eptr->getState(v);                45   bool success = eptr->getState(v);
 48   if (!success) return 0;                          46   if (!success) return 0;
 49   // std::cerr << "makeAnEngine made " << E::e     47   // std::cerr << "makeAnEngine made " << E::engineName() << "\n"; 
 50   return eptr;                                     48   return eptr;        
 51 }                                                  49 }       
 52                                                    50 
 53 HepRandomEngine* EngineFactory::newEngine(std:     51 HepRandomEngine* EngineFactory::newEngine(std::istream& is) {
 54   HepRandomEngine* eptr;                           52   HepRandomEngine* eptr; 
 55   std::string tag;                                 53   std::string tag;
 56   is >> tag;                                       54   is >> tag;
 57   eptr = makeAnEngine <HepJamesRandom>  (tag,      55   eptr = makeAnEngine <HepJamesRandom>  (tag, is); if (eptr) return eptr;
 58   eptr = makeAnEngine <RanecuEngine>    (tag,      56   eptr = makeAnEngine <RanecuEngine>    (tag, is); if (eptr) return eptr;
 59   eptr = makeAnEngine <Ranlux64Engine>  (tag,      57   eptr = makeAnEngine <Ranlux64Engine>  (tag, is); if (eptr) return eptr;
 60   eptr = makeAnEngine <RanluxppEngine>  (tag,  << 
 61   eptr = makeAnEngine <MixMaxRng>       (tag,  << 
 62   eptr = makeAnEngine <MTwistEngine>    (tag,      58   eptr = makeAnEngine <MTwistEngine>    (tag, is); if (eptr) return eptr;
 63   eptr = makeAnEngine <DualRand>        (tag,      59   eptr = makeAnEngine <DualRand>        (tag, is); if (eptr) return eptr;
 64   eptr = makeAnEngine <RanluxEngine>    (tag,      60   eptr = makeAnEngine <RanluxEngine>    (tag, is); if (eptr) return eptr;
 65   eptr = makeAnEngine <RanshiEngine>    (tag,      61   eptr = makeAnEngine <RanshiEngine>    (tag, is); if (eptr) return eptr;
 66   eptr = makeAnEngine <NonRandomEngine> (tag,      62   eptr = makeAnEngine <NonRandomEngine> (tag, is); if (eptr) return eptr;
 67   is.clear(std::ios::badbit | is.rdstate());       63   is.clear(std::ios::badbit | is.rdstate());
 68   std::cerr <<                                     64   std::cerr << 
 69     "Input mispositioned or bad in reading ano     65     "Input mispositioned or bad in reading anonymous engine\n"
 70       << "\nBegin-tag read was: " << tag           66       << "\nBegin-tag read was: " << tag 
 71       << "\nInput stream is probably fouled up     67       << "\nInput stream is probably fouled up\n";
 72   return eptr;                                     68   return eptr;
 73 }                                                  69 }
 74                                                    70 
 75 HepRandomEngine*                                   71 HepRandomEngine* 
 76 EngineFactory::newEngine(std::vector<unsigned      72 EngineFactory::newEngine(std::vector<unsigned long> const & v) {
 77   HepRandomEngine* eptr;                           73   HepRandomEngine* eptr; 
 78   eptr = makeAnEngine <HepJamesRandom>  (v); i     74   eptr = makeAnEngine <HepJamesRandom>  (v); if (eptr) return eptr;
 79   eptr = makeAnEngine <RanecuEngine>    (v); i     75   eptr = makeAnEngine <RanecuEngine>    (v); if (eptr) return eptr;
 80   eptr = makeAnEngine <Ranlux64Engine>  (v); i     76   eptr = makeAnEngine <Ranlux64Engine>  (v); if (eptr) return eptr;
 81   eptr = makeAnEngine <RanluxppEngine>  (v); i << 
 82   eptr = makeAnEngine <MixMaxRng>       (v); i << 
 83   eptr = makeAnEngine <MTwistEngine>    (v); i     77   eptr = makeAnEngine <MTwistEngine>    (v); if (eptr) return eptr;
 84   eptr = makeAnEngine <DualRand>        (v); i     78   eptr = makeAnEngine <DualRand>        (v); if (eptr) return eptr;
 85   eptr = makeAnEngine <RanluxEngine>    (v); i     79   eptr = makeAnEngine <RanluxEngine>    (v); if (eptr) return eptr;
 86   eptr = makeAnEngine <RanshiEngine>    (v); i     80   eptr = makeAnEngine <RanshiEngine>    (v); if (eptr) return eptr;
 87   eptr = makeAnEngine <NonRandomEngine> (v); i     81   eptr = makeAnEngine <NonRandomEngine> (v); if (eptr) return eptr;
 88   std::cerr <<                                     82   std::cerr << 
 89     "Cannot correctly get anonymous engine fro     83     "Cannot correctly get anonymous engine from vector\n"
 90       << "First unsigned long was: " << v[0]       84       << "First unsigned long was: " << v[0] 
 91       << " Vector size was: " << v.size() <<"\     85       << " Vector size was: " << v.size() <<"\n";
 92   return eptr;                                     86   return eptr;
 93 }                                                  87 }
 94                                                    88 
 95 }  // namespace CLHEP                              89 }  // namespace CLHEP
 96                                                    90 
 97                                                    91