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

SamplerRouter.cxx

Go to the documentation of this file.
00001 // ================================================
00002 // Implementation of SamplerRouter
00003 // ================================================
00004 
00005 #include "FastShowerUtils/SamplerRouter.h"
00006 #include "FastShowerUtils/ParticleParameters.h"
00007 #include <assert.h>
00008 #include <iostream>
00009 
00010 namespace FastShower{
00011   SamplerRouter::SamplerRouter(const 
00012                                std::vector<std::pair<double, ISampler*> >& v,
00013                                double x, std::string label):
00014     DebugBase(label), m_floor(x){
00015     m_samplers.insert(v.begin(), v.end());
00016     cout<<"Sampler router finishing construction"<<endl;
00017   }
00018   //
00019   SamplerRouter::SamplerRouter(const SamplerRouter& c):ISampler(), DebugBase(){
00020     SamplerTable::const_iterator iter = c.m_samplers.begin();
00021     SamplerTable::const_iterator end  = c.m_samplers.end();
00022     
00023     for(; iter!=end; ++iter){
00024       m_samplers[(*iter).first]=(*iter).second->clone();
00025     }
00026     m_floor = c.m_floor;
00027     cout<<"CopyConstructed SamplersRouter, size "<<m_samplers.size()<<endl;
00028   }
00029   //
00030   void SamplerRouter::sample(const PolyArgs& pa, CoreSamples& cs) const{
00031 
00032     ParticleParameters pp = *pa.pp();
00033     double indQ = indexQ(pp, cs);
00035     assert ( indQ >= m_floor); 
00036     assert ( m_samplers.upper_bound(indQ) != m_samplers.end());
00037 
00038     ISampler* sampler = m_samplers.upper_bound(indQ)->second;
00039     sampler->sample(pa, cs);
00040   }
00041   //
00042   double SamplerRouter::lastValue(const CoreSamples& cs) const {return 0;}
00043   //   
00044   void SamplerRouter::components(std::vector<const IDebug*>& v) const{
00045     v.clear();
00046     std::map<double, ISampler*>::const_iterator iter = m_samplers.begin();
00047     std::map<double, ISampler*>::const_iterator end = m_samplers.end();
00048     for(;iter!=end;++iter){ v.push_back( (*iter).second ); }
00049    }
00050  }//namespace
00051 
00052 
00053 
00054 
00055 
00056 

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