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

C0HadEarlyEcalBar1.cxx

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

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