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

UpdatingGaussian.cxx

Go to the documentation of this file.
00001 #include "FastShowerUtils/UpdatingGaussian.h"
00002 #include "FastShowerUtils/IConfigurer.h"
00003 #include "FastShowerUtils/ProcessedNormal.h"
00004 namespace FastShower{
00005   UpdatingGaussian::UpdatingGaussian(IFn* mean, 
00006                                      IFn* sigma, 
00007                                      IProcessedDist* norm):
00008     m_mean(mean),m_sigma(sigma), m_normal(norm){}
00009   //
00010   UpdatingGaussian::UpdatingGaussian(const std::string& sampler, 
00011                                      const IConfigurer& c){
00012     m_mean   = c.findFn(sampler+"PeakMean");
00013     m_sigma  = c.findFn(sampler+"PeakSigma");
00014     m_normal = c.makeProcessedNormal(sampler);
00015   }
00016   double UpdatingGaussian::sample(double physicalLow,
00017                                   double nSigmaLow,
00018                                   double physicalUp,
00019                                   double nSigmaUp,
00020                                   const PolyArgs& pa
00021                                   ) const{
00022     
00023     double mean  = m_mean->value(pa);
00024     double sigma = m_sigma->value(pa);
00025     
00026     double lowLim = mean-(nSigmaLow*sigma);
00027     if(lowLim<physicalLow){ lowLim=physicalLow;}
00028     
00029     double upLim = mean+(nSigmaUp*sigma);
00030     if(upLim>physicalUp){ upLim=physicalUp;}
00031     
00032     LinearProcessor lp(sigma, mean);
00033     cout<<"UG limits: "<<lowLim<<" "<<upLim<<endl;
00034     return m_normal->sample(lowLim, upLim, &lp);
00035   }
00036   //
00037   std::pair<double, double> 
00038   UpdatingGaussian::parameters( const PolyArgs& pa ) const{
00039     std::pair<double, double> params(m_mean->value(pa), m_sigma->value(pa));
00040     return params;
00041   }
00042   //
00043   void
00044   UpdatingGaussian::components(std::vector<const IDebug*>& v) const{
00045     v.clear();
00046     v.push_back(m_mean);
00047     v.push_back(m_sigma);
00048     v.push_back(m_normal);    
00049     }
00050   IUpdatingGaussian* UpdatingGaussian::clone() const{
00051     IUpdatingGaussian* nug= new UpdatingGaussian(*this);
00052     return nug;
00053   }
00054 }//namespace
00055 
00056 
00057 
00058 
00059 

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