#include <SmearSoftPhotonBase.h>
Inheritance diagram for FastShower::SmearSoftPhotonBase:
Public Types | |
typedef std::map< double, std::string >::const_iterator | MCItr_Type1 |
typedef std::map< double, DistRandomiser1D * >::const_iterator | MCItr_Type2 |
Public Methods | |
SmearSoftPhotonBase (const ISingleShowererSelectorConfig *, const std::string &) | |
virtual | ~SmearSoftPhotonBase () |
virtual double | value (const ParticleParameters &) const |
void | nudge (const double, const double, double &) const |
virtual double | mean (const double) const=0 |
virtual IFnOfParticleParameters * | clone () const=0 |
Private Attributes | |
std::map< double, std::string > | m_histograms |
std::map< double, DistRandomiser1D * > | m_energyDists |
|
Definition at line 38 of file SmearSoftPhotonBase.h. Referenced by SmearSoftPhotonBase(). |
|
Definition at line 39 of file SmearSoftPhotonBase.h. Referenced by value(). |
|
Definition at line 11 of file SmearSoftPhotonBase.cxx. References FastShower::ISingleShowererSelectorConfig::histograms(), m_energyDists, m_histograms, and MCItr_Type1.
00012 : 00013 IFnOfParticleParameters(), DebugBase(s){ 00014 00015 // get histograms' file-names and energies 00016 cout<<"SmearSoftPhotonBase: getting histograms ..."<<endl; 00017 m_histograms = c->histograms(); 00018 00019 // loop through files, and setup 1d-dist-randomiser 00020 cout<<"SmearSoftPhotonBase: setting up distributions ..."<<endl; 00021 MCItr_Type1 itr = m_histograms.begin(); 00022 MCItr_Type1 end = m_histograms.end(); 00023 m_energyDists[0.0] = 0; // null pointers for end-points 00024 for (;itr!=end; ++itr){ 00025 cout<<"SmearSoftPhotonBase: hist = \"" 00026 <<(*itr).second<<"\", energy = "<<(*itr).first<<"GeV"<<endl; 00027 // pass histogram-file-name to 1d-dist-randomiser 00028 DistRandomiser1D* randomiser = new DistRandomiser1D((*itr).second); 00029 // set the corresponding energy (energy point) 00030 m_energyDists[(*itr).first] = randomiser; 00031 } 00032 m_energyDists[FLT_MAX] = 0; // null pointers for end-points 00033 cout<<"SmearSoftPhotonBase: distributions done"<<endl; 00034 } |
|
Definition at line 85 of file SmearSoftPhotonBase.cxx. References m_energyDists, and m_histograms.
00085 { 00086 m_histograms.clear(); 00087 std::map<double,DistRandomiser1D*>::iterator itr2 = m_energyDists.begin(); 00088 std::map<double,DistRandomiser1D*>::iterator end2 = m_energyDists.end(); 00089 for(; itr2!= end2; ++itr2){ 00090 delete (*itr2).second; 00091 } 00092 m_energyDists.clear(); 00093 } |
|
Implements FastShower::IFnOfParticleParameters. Definition at line 36 of file SmearSoftPhotonBase.cxx. References m_energyDists, MCItr_Type2, nudge(), FastShower::ParticleParameters::rawEnergy(), and FastShower::DistRandomiser1D::sample().
00036 { 00037 double energy = pp.rawEnergy(); 00038 00039 energy = max((float)energy,FLT_EPSILON); 00040 00041 MCItr_Type2 floor = m_energyDists.begin(); 00042 MCItr_Type2 roof = m_energyDists.end(); 00043 /* 00044 * usual case: energy differs from key values in the map => lower==upper 00045 * rare case: energy overlaps with a key entry in the map => lower==upper-1 00046 * energies below/above the floor/roof => valid iterators 00047 * energies overlapping with an energyPoint (i.e. a key) are special! 00048 */ 00049 00050 // the following logic works only if the map has at least 3 entries, 00051 // i.e. at least 1 valid entry 00052 std::pair<MCItr_Type2,MCItr_Type2> luItrs = m_energyDists.equal_range(energy); 00053 MCItr_Type2 lowerBound = luItrs.first; 00054 MCItr_Type2 upperBound = luItrs.second; 00055 00056 // force the lower/upperBound iterators to point at 2 consecutive entries 00057 if (lowerBound==upperBound) {--lowerBound;} // takes care of the usual case 00058 // find the closest boundary 00059 MCItr_Type2 mapEntryPoint = ((energy - (*lowerBound).first)< 00060 ((*upperBound).first - energy))? 00061 lowerBound : upperBound; 00062 00063 // move up to the 1st valid point if energy is between 0 and the 1st valid point 00064 if (mapEntryPoint == floor) {++mapEntryPoint;} 00065 00066 // check for strange condition that energy is closer to FLT_MAX 00067 // than to the last valid point 00068 MCItr_Type2 ceiling = --roof; 00069 assert(mapEntryPoint != ceiling); 00070 00071 DistRandomiser1D* randomiser = (*mapEntryPoint).second; 00072 double energyPoint = (*mapEntryPoint).first; 00073 double eFrac = randomiser->sample(); 00074 nudge(energyPoint,energy,eFrac); 00075 return eFrac; 00076 } |
|
Definition at line 79 of file SmearSoftPhotonBase.cxx. References mean(). Referenced by value().
|
|
Implemented in FastShower::SmearSoftPhotonBar, and FastShower::SmearSoftPhotonEc. Referenced by nudge(). |
|
Implements FastShower::IFnOfParticleParameters. Implemented in FastShower::SmearSoftPhotonBar, and FastShower::SmearSoftPhotonEc. |
|
Definition at line 42 of file SmearSoftPhotonBase.h. Referenced by SmearSoftPhotonBase(), and ~SmearSoftPhotonBase(). |
|
Definition at line 43 of file SmearSoftPhotonBase.h. Referenced by SmearSoftPhotonBase(), value(), and ~SmearSoftPhotonBase(). |