Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

FastShower::DistRandomiser1D Class Reference

E/Hcal energy fractions for hadrons. More...

#include <DistRandomiser1D.h>

Inheritance diagram for FastShower::DistRandomiser1D:

Inheritance graph
[legend]
Collaboration diagram for FastShower::DistRandomiser1D:

Collaboration graph
[legend]
List of all members.

Public Methods

 DistRandomiser1D (const std::string &)
void readData (const std::string &, std::vector< double > &) const
double sample () const
 ~DistRandomiser1D ()

Private Attributes

RandGeneral * m_Dist

Detailed Description

E/Hcal energy fractions for hadrons.

UML: IDistributionClass.unm

Definition at line 22 of file DistRandomiser1D.h.


Constructor & Destructor Documentation

FastShower::DistRandomiser1D::DistRandomiser1D const std::string &   
 

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   }

FastShower::DistRandomiser1D::~DistRandomiser1D  
 

Definition at line 45 of file DistRandomiser1D.cxx.

References m_Dist.

00045                                      {
00046     delete m_Dist;
00047   }

Member Function Documentation

void FastShower::DistRandomiser1D::readData const std::string &   ,
std::vector< double > &   
const
 

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   }

double FastShower::DistRandomiser1D::sample   const
 

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   }

Member Data Documentation

RandGeneral* FastShower::DistRandomiser1D::m_Dist [private]
 

Definition at line 30 of file DistRandomiser1D.h.

Referenced by DistRandomiser1D(), sample(), and ~DistRandomiser1D().


The documentation for this class was generated from the following files:
Generated on Tue Mar 18 11:56:33 2003 for FastShowerUtils by doxygen1.3-rc1