![]() |
![]() |
#include <IOMC/RandomEngine/src/TRandomAdaptor.h>
Public Member Functions | |
std::string | beginTag () |
double | flat () |
void | flatArray (const int size, double *vect) |
bool | get (const std::vector< unsigned long > &v) |
virtual std::istream & | get (std::istream &is) |
TRandom3 * | getRootEngine () |
bool | getState (const std::vector< unsigned long > &v) |
virtual std::istream & | getState (std::istream &is) |
std::string | name () const |
operator float () | |
operator unsigned int () | |
TRandomAdaptor & | operator= (const TRandomAdaptor &p) |
std::vector< unsigned long > | put () const |
virtual std::ostream & | put (std::ostream &os) const |
void | restoreStatus (const char filename[]="TRandom.conf") |
void | saveStatus (const char filename[]="TRandom.conf") const |
void | setSeed (long seed, int) |
void | setSeeds (const long *seeds, int) |
void | showStatus () const |
TRandomAdaptor (const TRandomAdaptor &p) | |
TRandomAdaptor (std::istream &is) | |
TRandomAdaptor (int rowIndex, int colIndex) | |
TRandomAdaptor (long seed) | |
TRandomAdaptor () | |
virtual | ~TRandomAdaptor () |
Static Public Member Functions | |
static std::string | engineName () |
Private Member Functions | |
void | Grumble (std::string errortext) const |
Private Attributes | |
TRandom3 * | trand_ |
Definition at line 15 of file TRandomAdaptor.h.
edm::TRandomAdaptor::TRandomAdaptor | ( | ) | [inline] |
edm::TRandomAdaptor::TRandomAdaptor | ( | long | seed | ) | [inline] |
Definition at line 22 of file TRandomAdaptor.h.
00022 : trand_(new TRandom3(rowIndex*colIndex-1)) {}
edm::TRandomAdaptor::TRandomAdaptor | ( | std::istream & | is | ) |
Definition at line 24 of file TRandomAdaptor.cc.
References Grumble().
00026 { 00027 Grumble(std::string("Cannot instantiate a TRandom engine from an istream"));
virtual edm::TRandomAdaptor::~TRandomAdaptor | ( | ) | [inline, virtual] |
edm::TRandomAdaptor::TRandomAdaptor | ( | const TRandomAdaptor & | p | ) | [inline] |
std::string edm::TRandomAdaptor::beginTag | ( | ) | [inline] |
Definition at line 66 of file TRandomAdaptor.h.
References trand_.
00066 { return std::string(trand_->GetName())+std::string("-begin"); }
static std::string edm::TRandomAdaptor::engineName | ( | ) | [inline, static] |
double edm::TRandomAdaptor::flat | ( | ) | [inline] |
bool edm::TRandomAdaptor::get | ( | const std::vector< unsigned long > & | v | ) |
Definition at line 59 of file TRandomAdaptor.cc.
References i, int, and trand_.
00060 { 00061 if(v.empty()) return false; 00062 if(v[0] != CLHEP::engineIDulong<TRandomAdaptor>()) return false; 00063 int32_t numItems = v.size()-1; 00064 int32_t itemSize = sizeof(unsigned long); 00065 RootBuffer buffer(TBuffer::kRead,numItems*itemSize+1024); 00066 char* bufferPtr = buffer.Buffer(); 00067 for(int i=0; i<(int)numItems; ++i) { 00068 *(unsigned long*)(bufferPtr+i*itemSize) = v[i+1]; 00069 } 00070 trand_->Streamer(buffer); 00071 return true;
std::istream & edm::TRandomAdaptor::get | ( | std::istream & | is | ) | [virtual] |
Definition at line 49 of file TRandomAdaptor.cc.
References getState(), and Grumble().
00050 { 00051 Grumble(std::string("get(std::istream) not available for TRandom engines")); 00052 return getState(is);
TRandom3* edm::TRandomAdaptor::getRootEngine | ( | ) | [inline] |
bool edm::TRandomAdaptor::getState | ( | const std::vector< unsigned long > & | v | ) | [inline] |
std::istream & edm::TRandomAdaptor::getState | ( | std::istream & | is | ) | [virtual] |
Definition at line 54 of file TRandomAdaptor.cc.
References Grumble().
Referenced by get().
00055 { 00056 Grumble(std::string("getState(std::istream) not available for TRandom engines")); 00057 return is;
void edm::TRandomAdaptor::Grumble | ( | std::string | errortext | ) | const [private] |
Definition at line 73 of file TRandomAdaptor.cc.
References except, and edm::errors::UnimplementedFeature.
Referenced by get(), getState(), put(), and TRandomAdaptor().
00074 { 00075 00076 // Throw an edm::Exception for unimplemented functions 00077 std::ostringstream sstr; 00078 sstr << "Unimplemented Feature: " << errortext << '\n'; 00079 edm::Exception except(edm::errors::UnimplementedFeature, sstr.str()); 00080 throw except;
std::string edm::TRandomAdaptor::name | ( | void | ) | const [inline] |
Definition at line 70 of file TRandomAdaptor.h.
References trand_.
00070 { return std::string("T")+std::string(trand_->GetName()); }
edm::TRandomAdaptor::operator float | ( | ) | [inline] |
Definition at line 59 of file TRandomAdaptor.h.
References trand_.
00059 { return (float)(trand_->Rndm()); }
edm::TRandomAdaptor::operator unsigned int | ( | ) | [inline] |
Definition at line 62 of file TRandomAdaptor.h.
References trand_.
00062 { return (unsigned int)((trand_->Rndm())*exponent_bit_32); }
TRandomAdaptor& edm::TRandomAdaptor::operator= | ( | const TRandomAdaptor & | p | ) | [inline] |
std::vector< unsigned long > edm::TRandomAdaptor::put | ( | ) | const |
Definition at line 34 of file TRandomAdaptor.cc.
References i, int, trand_, and v.
00035 { 00036 int32_t itemSize = sizeof(unsigned long); 00037 std::vector<unsigned long> v; 00038 v.push_back (CLHEP::engineIDulong<TRandomAdaptor>()); 00039 RootBuffer buffer(TBuffer::kWrite,1024*itemSize); 00040 trand_->Streamer(buffer); 00041 buffer.SetReadMode(); 00042 char* bufferPtr = buffer.Buffer(); 00043 int32_t numItems = (buffer.Length()+itemSize-1)/itemSize; 00044 for( int i=0; i<(int)numItems; ++i) { 00045 v.push_back(*(unsigned long*)(bufferPtr+i*itemSize)); 00046 } 00047 return v;
std::ostream & edm::TRandomAdaptor::put | ( | std::ostream & | os | ) | const [virtual] |
Definition at line 29 of file TRandomAdaptor.cc.
References Grumble().
00030 { 00031 Grumble(std::string("put(std::ostream) not available for TRandom engines")); 00032 return os;
void edm::TRandomAdaptor::restoreStatus | ( | const char | filename[] = "TRandom.conf" |
) | [inline] |
Definition at line 53 of file TRandomAdaptor.h.
References EgammaValidation_cff::filename, and trand_.
void edm::TRandomAdaptor::saveStatus | ( | const char | filename[] = "TRandom.conf" |
) | const [inline] |
Definition at line 50 of file TRandomAdaptor.h.
References EgammaValidation_cff::filename, and trand_.
Definition at line 47 of file TRandomAdaptor.h.
References trand_.
00047 { trand_->SetSeed(seeds[0]); }
void edm::TRandomAdaptor::showStatus | ( | ) | const [inline] |
TRandom3* edm::TRandomAdaptor::trand_ [private] |
Definition at line 84 of file TRandomAdaptor.h.
Referenced by beginTag(), flat(), flatArray(), get(), getRootEngine(), name(), operator float(), operator unsigned int(), operator=(), put(), restoreStatus(), saveStatus(), setSeed(), setSeeds(), showStatus(), TRandomAdaptor(), and ~TRandomAdaptor().