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

C0HadEarlyEcalEc1.cxx

Go to the documentation of this file.
00001 // ================================================
00002 // Implementation of C0HadEarlyEcalEc1
00003 // ================================================
00004 
00005 #include "FastShowerUtils/Samplers/C0HadEarlyEcalEc1.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 C0HadEarlyEcalEc1::s_nSigma1(3.0);
00024   const double C0HadEarlyEcalEc1::s_nSigma2(7.0);
00025   const double C0HadEarlyEcalEc1::s_nSigma3(9.0);
00027   C0HadEarlyEcalEc1::C0HadEarlyEcalEc1(IUpdatingGaussian* g, 
00028                                          IProcessedDist* t,
00029                                          IInTail* it):
00030     ISampler(), ICell0(), DebugBase("C0HadEarlyEcalEc1"), 
00031     m_peak(g), m_tail(t), m_inTail(it){}
00033   C0HadEarlyEcalEc1::C0HadEarlyEcalEc1(const IConfigurer* configurer,
00034                                        const std::string& s):
00035     DebugBase(s), m_peak(0), m_tail(0), m_inTail(0){
00036     m_peak           = configurer->findIUG( text()+"Peak" ) ;
00037     m_tail           = configurer->makeProcessedFlat( text() );
00038     m_inTail         = configurer->makeIInTail( text() );
00039     cout<<text()<<" finishing construction"<<endl;
00040   }
00041   //
00042   ISampler* C0HadEarlyEcalEc1::clone() const {
00043     return new C0HadEarlyEcalEc1(*this);
00044   }
00045   //
00046 
00047   void C0HadEarlyEcalEc1::sample(const PolyArgs& pa, 
00048                                   CoreSamples& cs) const {
00049     //
00050     double energy = pa.pp()->energy();
00051     double aDelPhi = pa.pp()->energy();
00052     //
00053     if ( energy<30.0  &&  aDelPhi<0.035 ){
00054       cs.fill(this, evalPeak(pa));
00055     }else{
00056       if( m_inTail->operator()(pa) ){
00057         cs.fill(this, evalTail(pa));
00058       }else{
00059         cs.fill(this, evalPeak(pa));
00060       }
00061     }
00062   }
00064   double C0HadEarlyEcalEc1::evalTail(const PolyArgs& pa) const {
00065 
00066     pair<double, double>  peakParams = m_peak->parameters(pa);
00067     double peakMean  = peakParams.first;
00068     double peakSigma = peakParams.second;
00069     //calculate ther upper and lower limits of the tails
00070     //
00071     // tail
00072     double energy = pa.pp()->energy();
00073     double uLimit = peakMean - s_nSigma1*peakSigma;
00074     uLimit = min(uLimit,1.0);
00075     uLimit = max(uLimit,0.0);
00076     //
00077     double lLimit;
00078     if (energy<30.0) {
00079       lLimit = 0.0;
00080     }else if (energy<70.0) {
00081       lLimit = peakMean - s_nSigma2*peakSigma;
00082     }else {
00083       lLimit = peakMean - s_nSigma3*peakSigma;
00084     }
00085     lLimit = max(lLimit,0.0);
00086     if(lLimit>uLimit){lLimit=0.0;}
00087     //
00088     if (!(uLimit-lLimit)>0.0) {
00089       lLimit = 0.0;
00090       uLimit = 1.0;
00091     }
00092     LinearProcessor lp( (uLimit-lLimit),lLimit );
00093     return m_tail->sample(&lp);
00094   }
00096   double C0HadEarlyEcalEc1::evalPeak(const PolyArgs& pa)const{
00097     return m_peak->sample(0.0, 100, 1.0, 100, pa);
00098   }
00100   double C0HadEarlyEcalEc1::lastValue(const CoreSamples& cs) const {
00101     return cs.give(this);
00102   }
00104   void C0HadEarlyEcalEc1::components(IDebug::Cpts& v) const{
00105     v.push_back(m_peak);
00106     v.push_back(m_tail);
00107     v.push_back(m_inTail);
00108   }
00109  
00110 }//namespace
00111 
00112 
00113 
00114 
00115 
00116 
00117 

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