#include <DistRandomiser1D.h>
Inheritance diagram for FastShower::DistRandomiser1D:
Public Methods | |
DistRandomiser1D (const std::string &) | |
void | readData (const std::string &, std::vector< double > &) const |
double | sample () const |
~DistRandomiser1D () | |
Private Attributes | |
RandGeneral * | m_Dist |
UML: IDistributionClass.unm
Definition at line 22 of file DistRandomiser1D.h.
|
Definition at line 13 of file DistRandomiser1D.cxx. References m_Dist, and readData().
00013 { 00014 00015 // get data form file (histogram) 00016 std::vector<double> v; 00017 readData(f,v); 00018 00019 // needed to initialise RandGeneral 00020 std::vector<double>::size_type n = v.size(); // # of bins 00021 double dist[50]; 00022 assert(n == 50); 00023 // 00024 int i; 00025 std::vector<double>::const_iterator itr = v.begin(); 00026 std::vector<double>::const_iterator end = v.end(); 00027 for (i=0, itr; itr!=end; ++i, ++itr){ 00028 dist[i] = (*itr); 00029 } 00030 m_Dist = new RandGeneral(dist, n, 0); 00031 } |
|
Definition at line 45 of file DistRandomiser1D.cxx. References m_Dist.
00045 { 00046 delete m_Dist; 00047 } |
|
Definition at line 34 of file DistRandomiser1D.cxx. Referenced by DistRandomiser1D().
00034 { 00035 ifstream data(f.c_str()); 00036 istream_iterator<int> dataItr(data); 00037 istream_iterator<int> endOfData; 00038 copy(dataItr,endOfData,back_inserter(v)); 00039 } |
|
Definition at line 41 of file DistRandomiser1D.cxx. References m_Dist. Referenced by FastShower::SmearSoftPhotonBase::value().
00041 { 00042 return 2.0*m_Dist->fire(); 00043 } |
|
Definition at line 30 of file DistRandomiser1D.h. Referenced by DistRandomiser1D(), sample(), and ~DistRandomiser1D(). |