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

C0HadLateHcalEc1.cxx

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

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