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

S0HadLateHcalBar1.cxx

Go to the documentation of this file.
00001 // ================================================
00002 // Implementation of S0HadLateHcalBar1
00003 // ================================================
00004 
00005 #include "FastShowerUtils/Samplers/S0HadLateHcalBar1.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 S0HadLateHcalBar1::s_nSigma1(3.0);
00023   const double S0HadLateHcalBar1::s_nSigma2(4.0);
00024 
00026   S0HadLateHcalBar1::S0HadLateHcalBar1(IUpdatingGaussian* g, 
00027                                        IProcessedDist* tail,
00028                                        IInTail* it):
00029     ISampler(), ISlice0(), DebugBase("S0HadLateHcalBar1"), 
00030     m_peak(g), m_tail(tail), m_inTail(it){}
00032   S0HadLateHcalBar1::S0HadLateHcalBar1(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* S0HadLateHcalBar1::clone() const {return new S0HadLateHcalBar1(*this);}
00043   void S0HadLateHcalBar1::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 S0HadLateHcalBar1::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     lLimit = max(lLimit,0.0);
00063     lLimit = min(lLimit,1.0);
00064     //
00065     //IMPROVEME - the logic of setting limits to be made clearer
00066     if(uLimit<0.){ uLimit=peakMean;}
00067     uLimit = min(uLimit,1.0);
00068 
00069     // Sample from a Linear dist.
00070     LinearProcessor lp((uLimit-lLimit), lLimit);
00071     return m_tail->sample(&lp);
00072   }
00074   double S0HadLateHcalBar1::evalPeak(const PolyArgs& pa)const{
00075     return m_peak->sample(0.0, 100, 1.0, s_nSigma1, pa);
00076   }
00078   double S0HadLateHcalBar1::lastValue(const CoreSamples& cs) const {
00079     return cs.give(this);
00080   }
00082   void S0HadLateHcalBar1::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:50:04 2003 for FastShowerUtils by doxygen1.3-rc1