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

FastShower::HadEcalHcalSharesBase Class Reference

#include <HadEcalHcalSharesBase.h>

Inheritance diagram for FastShower::HadEcalHcalSharesBase:

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

Collaboration graph
[legend]
List of all members.

Public Types

typedef std::map< double,
std::string >::const_iterator 
MCItr_Type1
typedef std::map< double,
DistRandomiser2D * >::const_iterator 
MCItr_Type2

Public Methods

 HadEcalHcalSharesBase (const ITripleShowererSelectorConfig *, const std::string &)
virtual ~HadEcalHcalSharesBase ()
virtual std::pair< double,
double > 
value (const ParticleParameters &) const
void nudge (const double, const double, std::pair< double, double > &) const
virtual double mean (const double) const=0
virtual double sigma (const double) const=0
virtual IFnOfParticleParameters2clone () const=0

Private Attributes

std::map< double, std::string > m_histograms
std::map< double, DistRandomiser2D * > m_energyDists

Member Typedef Documentation

typedef std::map<double, std::string>::const_iterator FastShower::HadEcalHcalSharesBase::MCItr_Type1
 

Definition at line 58 of file HadEcalHcalSharesBase.h.

Referenced by HadEcalHcalSharesBase().

typedef std::map<double, DistRandomiser2D*>::const_iterator FastShower::HadEcalHcalSharesBase::MCItr_Type2
 

Definition at line 59 of file HadEcalHcalSharesBase.h.

Referenced by value().


Constructor & Destructor Documentation

FastShower::HadEcalHcalSharesBase::HadEcalHcalSharesBase const ITripleShowererSelectorConfig  ,
const std::string &   
 

Definition at line 15 of file HadEcalHcalSharesBase.cxx.

References FastShower::ITripleShowererSelectorConfig::histograms(), m_energyDists, m_histograms, and MCItr_Type1.

00016                                                                   :
00017     IFnOfParticleParameters2(), DebugBase(s){
00018 
00019     // get histograms' file-names and energies
00020     cout<<"HadEcalHcalSharesBase: getting histograms ..."<<endl;
00021     m_histograms = c->histograms();
00022 
00023     // loop through files, and setup 2d-dist-randomiser
00024     cout<<"HadEcalHcalSharesBase: setting up distributions ..."<<endl;
00025     MCItr_Type1 itr = m_histograms.begin();
00026     MCItr_Type1 end = m_histograms.end();
00027     m_energyDists[0.0] = 0;  // null pointers for end-points
00028     for (;itr!=end; ++itr){
00029       cout<<"HadEcalHcalSharesBase:  hist = \""
00030           <<(*itr).second<<"\",  energy = "<<(*itr).first<<"GeV"<<endl;
00031       // pass histogram-file-name to 2d-dist-randomiser
00032       DistRandomiser2D* randomiser = new DistRandomiser2D((*itr).second);
00033       // set the corresponding energy (energy point)
00034       m_energyDists[(*itr).first] = randomiser;
00035     }
00036     m_energyDists[FLT_MAX] = 0;  // null pointers for end-points
00037     cout<<"HadEcalHcalSharesBase: distributions done"<<endl;
00038   }
  //

FastShower::HadEcalHcalSharesBase::~HadEcalHcalSharesBase   [virtual]
 

Definition at line 108 of file HadEcalHcalSharesBase.cxx.

References m_energyDists.

00108                                                {
00109     std::map<double, DistRandomiser2D*>::iterator itr = m_energyDists.begin();
00110     std::map<double, DistRandomiser2D*>::iterator end = m_energyDists.end();
00111     for(; itr!= end; ++itr){
00112       delete (*itr).second;
00113     }
00114     m_energyDists.clear();
00115   }

Member Function Documentation

std::pair< double, double > FastShower::HadEcalHcalSharesBase::value const ParticleParameters   const [virtual]
 

Implements FastShower::IFnOfParticleParameters2.

Definition at line 41 of file HadEcalHcalSharesBase.cxx.

References m_energyDists, MCItr_Type2, nudge(), FastShower::ParticleParameters::rawEnergy(), and FastShower::DistRandomiser2D::sample().

00041                                                                  {
00042     double energy = pp.rawEnergy();
00043     
00044     energy = max((float)energy, FLT_EPSILON);
00045 
00046     MCItr_Type2 floor = m_energyDists.begin();
00047     MCItr_Type2 roof  = m_energyDists.end();
00048 
00049     /* 
00050      * usual case: energy differs from key values in the map => lower==upper
00051      * rare case: energy overlaps with a key entry in the map => lower==upper-1
00052      * energies below/above the floor/roof  =>  valid iterators
00053      * energies overlapping with an energyPoint (i.e. a key) are special!
00054      */
00055 
00056     // the following logic works only if the map has at least 3 entries, 
00057     // i.e. at least 1 valid entry
00058     std::pair<MCItr_Type2,MCItr_Type2> luItrs = m_energyDists.equal_range(energy);
00059     MCItr_Type2 lowerBound = luItrs.first;
00060     MCItr_Type2 upperBound = luItrs.second;
00061 
00062     // force the lower/upperBound iterators to point at 2 consecutive entries
00063     if (lowerBound==upperBound) {--lowerBound;}  // takes care of the usual case
00064     // find the closest boundary
00065     MCItr_Type2 mapEntryPoint = ((energy - (*lowerBound).first)<
00066                          ((*upperBound).first - energy))? 
00067       lowerBound : upperBound;
00068 
00069     // move up to the 1st valid point if energy is between 0 and the 1st valid point
00070     if (mapEntryPoint == floor) {++mapEntryPoint;}
00071 
00072     // check for strange condition that energy is closer to FLT_MAX 
00073     // than to the last valid point
00074     MCItr_Type2 ceiling = --roof;
00075     assert(mapEntryPoint != ceiling);
00076 
00077     DistRandomiser2D* randomiser = (*mapEntryPoint).second;
00078     double energyPoint = (*mapEntryPoint).first;
00079     std::pair<double,double> ehFracs = randomiser->sample();
00080 
00081     nudge(energyPoint,energy,ehFracs);
00082 
00083     return ehFracs;
00084   }

void FastShower::HadEcalHcalSharesBase::nudge const    double,
const    double,
std::pair< double, double > &   
const
 

Definition at line 86 of file HadEcalHcalSharesBase.cxx.

References mean(), and sigma().

Referenced by value().

00088                                                                            {
00089 
00090     double energyPointFracSum = ehFracs.first + ehFracs.second;
00091     double energyFracSum = energyPointFracSum;
00092     
00093     if (energy<=0.15) {
00094     // no interpolation at very small Energies
00095     } else if (energy<=1.0) {
00096     // interpolate mean but not sigma
00097       energyFracSum = energyPointFracSum - mean(energyPoint) + mean(energy);
00098     } else {
00099     // interpolate both mean and sigma
00100       double sigmaScale = sigma(energy)/sigma(energyPoint);
00101       energyFracSum = (energyPointFracSum - mean(energyPoint))*sigmaScale 
00102                      + mean(energy);
00103     }
00104     ehFracs.first *= (energyFracSum/energyPointFracSum);
00105     ehFracs.second *= (energyFracSum/energyPointFracSum);
00106   }

virtual double FastShower::HadEcalHcalSharesBase::mean const    double const [pure virtual]
 

Implemented in FastShower::HadEcalHcalSharesBar, and FastShower::HadEcalHcalSharesEc.

Referenced by nudge().

virtual double FastShower::HadEcalHcalSharesBase::sigma const    double const [pure virtual]
 

Implemented in FastShower::HadEcalHcalSharesBar, and FastShower::HadEcalHcalSharesEc.

Referenced by nudge().

virtual IFnOfParticleParameters2* FastShower::HadEcalHcalSharesBase::clone   const [pure virtual]
 

Implements FastShower::IFnOfParticleParameters2.

Implemented in FastShower::HadEcalHcalSharesBar, and FastShower::HadEcalHcalSharesEc.


Member Data Documentation

std::map<double, std::string> FastShower::HadEcalHcalSharesBase::m_histograms [private]
 

Definition at line 62 of file HadEcalHcalSharesBase.h.

Referenced by HadEcalHcalSharesBase().

std::map<double, DistRandomiser2D*> FastShower::HadEcalHcalSharesBase::m_energyDists [private]
 

Definition at line 63 of file HadEcalHcalSharesBase.h.

Referenced by HadEcalHcalSharesBase(), value(), and ~HadEcalHcalSharesBase().


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