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

S0HadEarlyHcalBar3.cxx

Go to the documentation of this file.
00001 // ================================================
00002 // Implementation of S0HadEarlyHcalBar3
00003 // ================================================
00004 
00005 #include "FastShowerUtils/Samplers/S0HadEarlyHcalBar3.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 S0HadEarlyHcalBar3::s_nSigma1(3.0);
00023   const double S0HadEarlyHcalBar3::s_nSigma2(9.0);
00024 
00026   S0HadEarlyHcalBar3::S0HadEarlyHcalBar3(IUpdatingGaussian* g, 
00027                                          IProcessedDist* tail,
00028                                          IInTail* it):
00029     ISampler(), ISlice0(), DebugBase("S0HadEarlyHcalBar3"), 
00030     m_peak(g), m_tail(tail), m_inTail(it){}
00032   S0HadEarlyHcalBar3::S0HadEarlyHcalBar3(const IConfigurer* c,
00033                                          const std::string& s):
00034     DebugBase(s), m_peak(0), m_tail(0), m_inTail(0){
00035     m_peak           = c->findIUG( text()+"Peak" ) ;
00036     m_tail           = c->makeProcessedFlat( text() );
00037     m_inTail         = c->makeIInTail( text() );
00038     cout<<text()<<" finishing construction"<<endl;
00039   }
00041   ISampler* S0HadEarlyHcalBar3::clone() const {
00042     return new S0HadEarlyHcalBar3(*this);
00043   }
00045   void S0HadEarlyHcalBar3::sample(const PolyArgs& pa, 
00046                                   CoreSamples& cs)const{
00047 
00048     if( m_inTail->operator()(pa) ){
00049       cs.fill(this, evalTail(pa) );
00050     }else{
00051       cs.fill(this, evalPeak(pa) );
00052     }
00053   }
00055   double S0HadEarlyHcalBar3::evalTail(const PolyArgs& pa) const {
00056     
00057     pair<double, double>  peakParams = m_peak->parameters(pa);
00058     double peakMean  = peakParams.first;
00059     double peakSigma = peakParams.second;
00060 
00061     double energy = pa.pp()->energy();
00062     
00063     //calculate ther upper and lower limits of the tail
00064     double uLimit = peakMean - s_nSigma1*peakSigma;
00065     uLimit = max(uLimit, 0.0);
00066     uLimit = min(uLimit, 1.0);
00067     //
00068     double lLimit = (energy<30.0)? 0.0 : peakMean - s_nSigma2*peakSigma;
00069     lLimit = max(lLimit, 0.0);
00070     if (lLimit>uLimit) lLimit=0.0;
00071 
00072     // Sample
00073     if (!(uLimit>0.0)) uLimit = 1.0;
00074     LinearProcessor lp((uLimit-lLimit), lLimit);
00075     return m_tail->sample(&lp);
00076   }
00078   double S0HadEarlyHcalBar3::evalPeak(const PolyArgs& pa)const{
00079     return m_peak->sample(0.0, 100, 1.0, 100, pa);
00080   }
00082   double S0HadEarlyHcalBar3::lastValue(const CoreSamples& cs) const {
00083     return cs.give(this);
00084   }
00086   void S0HadEarlyHcalBar3::components(IDebug::Cpts& v) const{
00087     v.push_back(m_peak);
00088     v.push_back(m_tail);
00089     v.push_back(m_inTail);
00090   }
00091   
00092 }//namespace
00093 
00094 
00095 
00096 
00097 
00098 
00099 

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