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

S0HadLateHcalEc1.cxx

Go to the documentation of this file.
00001 // ================================================
00002 // Implementation of S0HadLateHcalEc1
00003 // ================================================
00004 
00005 #include "FastShowerUtils/Samplers/S0HadLateHcalEc1.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 #include <cmath>
00016 #include <iostream>
00017 
00018 namespace FastShower{
00019 
00020   using std::pair;
00021 
00022   const double S0HadLateHcalEc1::s_nSigma1(3.0);
00023   const double S0HadLateHcalEc1::s_nSigma2(4.0);
00024 
00026   S0HadLateHcalEc1::S0HadLateHcalEc1(IUpdatingGaussian* g, 
00027                                      IProcessedDist* tail,
00028                                      IInTail* it):
00029     ISampler(), ISlice0(), DebugBase("S0HadLateHcalEc1"), 
00030     m_peak(g), m_tail(tail), m_inTail(it){}
00032   S0HadLateHcalEc1::S0HadLateHcalEc1(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* S0HadLateHcalEc1::clone() const {return new S0HadLateHcalEc1(*this);}
00043   void S0HadLateHcalEc1::sample(const PolyArgs& pa, CoreSamples& cs)const{
00044 
00045     if( m_inTail->operator()(pa) ){
00046       cs.fill(this, evalTail(pa) );
00047     }else{
00048       cs.fill(this, evalPeak(pa) );
00049     }
00050   }
00052   double S0HadLateHcalEc1::evalTail(const PolyArgs& pa) const {
00053     
00054     pair<double, double>  peakParams = m_peak->parameters(pa);
00055     double peakMean  = peakParams.first;
00056     double peakSigma = peakParams.second;
00057     
00058     //calculate ther upper and lower limits of the tail
00059     double uLimit = peakMean - s_nSigma1*peakSigma;
00060     //
00061     double lLimit = peakMean - s_nSigma2*peakSigma;
00062     if(lLimit<0.){lLimit=0.;}
00063     //
00064     //IMPROVEME - the logic of setting limits to be made clearer
00065     if(uLimit<0.){ uLimit=peakMean;}
00066 
00067     // Sample from a Traingle dist.
00068     LinearProcessor lp((uLimit-lLimit), lLimit);
00069     return m_tail->sample(&lp);
00070   }
00072   double S0HadLateHcalEc1::evalPeak(const PolyArgs& pa)const{
00073     return m_peak->sample(0.0, s_nSigma1, 1.0, s_nSigma1, pa);
00074   }
00076   double S0HadLateHcalEc1::lastValue(const CoreSamples& cs) const {
00077     return cs.give(this);
00078   }
00080   void S0HadLateHcalEc1::components(IDebug::Cpts& v) const{
00081     v.push_back(m_peak);
00082     v.push_back(m_tail);
00083     v.push_back(m_inTail);
00084   }
00085   
00086 }//namespace
00087 
00088 
00089 
00090 
00091 
00092 
00093 

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