File indexing completed on 2026-04-09 07:49:29
0001 #pragma once
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #include "CLHEP/Random/RandomEngine.h"
0014 #include "Randomize.hh"
0015 #include "s_seq.h"
0016
0017 struct S4Random : public CLHEP::HepRandomEngine
0018 {
0019 static constexpr const char* NAME = "S4Random" ;
0020
0021
0022 void flatArray(const int size, double* vect){ assert(0); }
0023 void setSeed(long seed, int){ assert(0); }
0024 void setSeeds(const long * seeds, int){ assert(0); }
0025 void saveStatus( const char filename[]) const{ assert(0); }
0026 void restoreStatus( const char filename[]){ assert(0); }
0027 void showStatus() const { assert(0); }
0028 std::string name() const { return NAME ; }
0029
0030 S4Random();
0031
0032 std::string desc() const ;
0033 double flat();
0034 std::string demo(int n) ;
0035 void setSequenceIndex(int index_);
0036
0037 private:
0038 void enable();
0039 void disable();
0040
0041 s_seq* m_seq ;
0042 CLHEP::HepRandomEngine* m_default ;
0043
0044 };
0045
0046 inline S4Random::S4Random()
0047 :
0048 m_seq(new s_seq),
0049 m_default(CLHEP::HepRandom::getTheEngine())
0050 {
0051 }
0052
0053 inline std::string S4Random::desc() const { return m_seq->desc() ; }
0054 inline double S4Random::flat(){ return m_seq->flat() ; }
0055 inline std::string S4Random::demo(int n) { return m_seq->demo(n) ; }
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070 inline void S4Random::setSequenceIndex(int index_)
0071 {
0072 m_seq->setSequenceIndex(index_);
0073
0074 if(index_ < 0 )
0075 {
0076 disable() ;
0077 }
0078 else
0079 {
0080 enable() ;
0081 }
0082 }
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093 inline void S4Random::enable(){ CLHEP::HepRandom::setTheEngine(this); }
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103 inline void S4Random::disable(){ CLHEP::HepRandom::setTheEngine(m_default); }
0104
0105
0106