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

C0HadEarlyHcalBar3.cxx

Go to the documentation of this file.
00001 // ================================================
00002 // Implementation of C0HadEarlyHcalBar3
00003 // ================================================
00004 
00005 #include "FastShowerUtils/Samplers/C0HadEarlyHcalBar3.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 C0HadEarlyHcalBar3::s_nSigma(3.0);
00024 
00025   C0HadEarlyHcalBar3::C0HadEarlyHcalBar3(IUpdatingGaussian* g, 
00026                                          IProcessedDist* tail,
00027                                          IInTail* it):
00028     ISampler(), ICell0(), DebugBase("C0HadEarlyHcalBar3"), 
00029     m_peak(g), m_tail(tail), m_inTail(it){}
00031   C0HadEarlyHcalBar3::C0HadEarlyHcalBar3(const IConfigurer* c,
00032                                          const std::string& s):
00033     DebugBase(s), m_peak(0), m_tail(0), m_inTail(0){
00034     m_peak           = c->findIUG( text()+"Peak" ) ;
00035     m_tail           = c->makeProcessedFlat( text() );
00036     m_inTail         = c->makeIInTail( text() );
00037     cout<<text()<<" finishing construction"<<endl;
00038   }
00040   ISampler* C0HadEarlyHcalBar3::clone() const {
00041     return new C0HadEarlyHcalBar3(*this);
00042   }
00044   void C0HadEarlyHcalBar3::sample(const PolyArgs& pa, 
00045                                   CoreSamples& cs)const{
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 C0HadEarlyHcalBar3::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 
00060     //calculate ther upper and/or lower limit of the tail
00061     double uLimit = peakMean - s_nSigma*peakSigma;
00062     uLimit = max(uLimit, 0.0);
00063     uLimit = min(uLimit, 1.0);
00064     //
00065     double lLimit = 0.0;
00066 
00067     // Sample
00068     if (!(uLimit>0.0)) uLimit = 1.0;
00069     LinearProcessor lp((uLimit-lLimit), lLimit);
00070     return m_tail->sample(&lp);
00071   }
00073   double C0HadEarlyHcalBar3::evalPeak(const PolyArgs& pa)const{
00074     return m_peak->sample(0.0, s_nSigma, 1.0, 100, pa);
00075   }
00077   double C0HadEarlyHcalBar3::lastValue(const CoreSamples& cs) const {
00078     return cs.give(this);
00079   }
00081   void C0HadEarlyHcalBar3::components(IDebug::Cpts& v) const{
00082     v.push_back(m_peak);
00083     v.push_back(m_tail);
00084     v.push_back(m_inTail);
00085   }
00086   
00087 }//namespace
00088 
00089 
00090 
00091 
00092 
00093 
00094 

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