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

C0HadEarlyHcalEc3.cxx

Go to the documentation of this file.
00001 // ================================================
00002 // Implementation of C0HadEarlyHcalEc3
00003 // ================================================
00004 
00005 #include "FastShowerUtils/Samplers/C0HadEarlyHcalEc3.h"
00006 
00007 #include "FastShowerUtils/PolyArgs.h"
00008 #include "FastShowerUtils/IFn.h"
00009 #include "FastShowerUtils/CoreSamples.h"
00010 #include "FastShowerUtils/IProcessedDist.h"
00011 #include "FastShowerUtils/IConfigurer.h"
00012 #include "FastShowerUtils/LinearProcessor.h"
00013 #include "FastShowerUtils/ProcessedNormal.h"
00014 #include "FastShowerUtils/IInTail.h"
00015 
00016 #include <cmath>
00017 #include <iostream>
00018 
00019 namespace FastShower{
00020 
00021   using std::pair;
00022 
00023   const double C0HadEarlyHcalEc3::s_nSigma(3.0);
00024 
00025   C0HadEarlyHcalEc3::C0HadEarlyHcalEc3(IUpdatingGaussian* g, 
00026                                        IProcessedDist* tail,
00027                                        IInTail* it):
00028     ISampler(), ICell0(), DebugBase("C0HadEarlyHcalEc3"), 
00029     m_peak(g), m_tail(tail), m_inTail(it){}
00031   C0HadEarlyHcalEc3::C0HadEarlyHcalEc3(const IConfigurer* configurer,
00032                                        const std::string& s):
00033     DebugBase(s), m_peak(0), m_tail(0), m_inTail(0){
00034     m_peak           = configurer->findIUG( text()+"Peak" );
00035     m_tail           = configurer->makeProcessedFlat( text() );
00036     m_inTail         = configurer->makeIInTail( text() );
00037     cout<<text()<<" finishing construction"<<endl;
00038   }
00040   ISampler* C0HadEarlyHcalEc3::clone() const {return new C0HadEarlyHcalEc3(*this);}
00042   void C0HadEarlyHcalEc3::sample(const PolyArgs& pa, CoreSamples& cs)const{
00043 
00044     if( m_inTail->operator()(pa) ){
00045       cs.fill(this, evalTail(pa) );
00046     }else{
00047       cs.fill(this, evalPeak(pa) );
00048     }
00049   }
00051   double C0HadEarlyHcalEc3::evalTail(const PolyArgs& pa) const {
00052     
00053     pair<double, double>  peakParams = m_peak->parameters(pa);
00054     double peakMean  = peakParams.first;
00055     double peakSigma = peakParams.second;
00056 
00057     //calculate ther upper and/or lower limit of the tail
00058     double uLimit = peakMean - s_nSigma*peakSigma;
00059     uLimit = max(uLimit, 0.1);
00060     uLimit = min(uLimit, 1.0);
00061     //
00062     double lLimit = 0.0;
00063 
00064     // Sample
00065     if (!(uLimit>0.0)) uLimit = 1.0;
00066 
00067     LinearProcessor lp((uLimit-lLimit), lLimit);
00068     return m_tail->sample(&lp);
00069   }
00071   double C0HadEarlyHcalEc3::evalPeak(const PolyArgs& pa)const{
00072     return m_peak->sample(0.0, s_nSigma, 1.0, 100, pa);
00073   }
00075   double C0HadEarlyHcalEc3::lastValue(const CoreSamples& cs) const {
00076     return cs.give(this);
00077   }
00079   void C0HadEarlyHcalEc3::components(IDebug::Cpts& v) const{
00080     v.push_back(m_peak);
00081     v.push_back(m_tail);
00082     v.push_back(m_inTail);
00083   }
00084   
00085 }//namespace
00086 
00087 
00088 
00089 
00090 
00091 
00092 

Generated on Tue Mar 18 11:49:55 2003 for FastShowerUtils by doxygen1.3-rc1