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

ConfigurerBase.cxx

Go to the documentation of this file.
00001 #include "FastShowerUtils/ConfigurerBase.h"
00002 
00003 // rest by alphabetical order:
00004 #include "FastShowerUtils/CoreDepositor.h"
00005 #include "FastShowerUtils/DepositorPtr.h"
00006 #include "FastShowerUtils/FnOfParticleParametersPtr.h"
00007 #include "FastShowerUtils/FnOfParticleParameters2Ptr.h"
00008 #include "FastShowerUtils/IDepositor.h"
00009 #include "FastShowerUtils/IFn.h"
00010 #include "FastShowerUtils/IFnOfParticleParameters.h"
00011 #include "FastShowerUtils/IFnOfParticleParameters2.h"
00012 #include "FastShowerUtils/IFnPtr.h"
00013 #include "FastShowerUtils/IInTailPtr.h"
00014 #include "FastShowerUtils/NormaliserPtr.h"
00015 #include "FastShowerUtils/ShowererPtr.h"
00016 #include "FastShowerUtils/IShowerer.h"
00017 #include "FastShowerUtils/Showerer.h"
00018 #include "FastShowerUtils/PtrAdapter.h"
00019 #include "FastShowerUtils/NullPtrAdapter.h"
00020 #include "FastShowerUtils/IPtrAdapter.h"
00021 #include "FastShowerUtils/IProcessedDistPtr.h"
00022 #include "FastShowerUtils/ISampler.h"
00023 #include "FastShowerUtils/InTail.h"
00024 #include "FastShowerUtils/INormaliser.h"
00025 #include "FastShowerUtils/ProcessedNormal.h"
00026 #include "FastShowerUtils/ProcessedFlat.h"
00027 #include "FastShowerUtils/PtrConverter.h"
00028 #include "FastShowerUtils/SamplerPtr.h"
00029 #include "FastShowerUtils/UpdatingGaussian.h"
00030 #include "FastShowerUtils/UpdatingGaussian0LP.h"
00031 #include "FastShowerUtils/UpdatingGaussian01P.h"
00032 #include "FastShowerUtils/UpdatingGaussian02P.h"
00033 #include "FastShowerUtils/UpGnPtr.h"
00034 #include "FastShowerUtils/DummyFnOfParticleParameters.h"
00035 //
00036 #include <string>
00037 #include <algorithm>
00038 
00039 namespace FastShower{
00040   ConfigurerBase::ConfigurerBase(Moni ):
00041   
00042   m_fnPtrAdapter        (new PtrAdapter<IFn,               IFnPtr>),
00043   m_fnOfPPPtrAdapter    (new PtrAdapter<IFnOfParticleParameters, 
00044                                         FnOfParticleParametersPtr>),
00045   m_fnOfPP2PtrAdapter   (new PtrAdapter<IFnOfParticleParameters2, 
00046                                         FnOfParticleParameters2Ptr>),
00047   m_UpGnPtrAdapter      (new PtrAdapter<IUpdatingGaussian, UpGnPtr>),
00048   m_depositorPtrAdapter (new PtrAdapter<IDepositor,        DepositorPtr>),
00049   m_samplerPtrAdapter   (new PtrAdapter<ISampler,          SamplerPtr>),
00050   m_procDistPtrAdapter  (new PtrAdapter<IProcessedDist,    IProcessedDistPtr>),
00051   m_iinTailPtrAdapter   (new PtrAdapter<IInTail,           IInTailPtr>),
00052   m_normaliserPtrAdapter(new PtrAdapter<INormaliser,       NormaliserPtr>),
00053   m_showererPtrAdapter  (new PtrAdapter<IShowerer,         ShowererPtr>){
00054     cout<<"ConfigureBase constructer, Moni mode"<<endl;
00055   }
00056  
00057   //*******************************************************
00058   ConfigurerBase::ConfigurerBase(NoMoni ):
00059   
00060   m_fnPtrAdapter         (new NullPtrAdapter<IFn>),
00061   m_fnOfPPPtrAdapter     (new NullPtrAdapter<IFnOfParticleParameters>),
00062   m_fnOfPP2PtrAdapter    (new NullPtrAdapter<IFnOfParticleParameters2>),
00063   m_UpGnPtrAdapter       (new NullPtrAdapter<IUpdatingGaussian>),
00064   m_depositorPtrAdapter  (new NullPtrAdapter<IDepositor>),
00065   m_samplerPtrAdapter    (new NullPtrAdapter<ISampler>),
00066   m_procDistPtrAdapter   (new NullPtrAdapter<IProcessedDist>),
00067   m_iinTailPtrAdapter    (new NullPtrAdapter<IInTail>),
00068   m_normaliserPtrAdapter (new NullPtrAdapter<INormaliser>),
00069   m_showererPtrAdapter   (new NullPtrAdapter<IShowerer>){
00070     cout<<"ConfigureBase constructer, NoMoni mode"<<endl;
00071   }
00072   //*******************************************************
00073   IFn*  ConfigurerBase::findFn(const std::string& s ) const{
00074     if( m_ifn.find(s) != m_ifn.end() ){
00075       IDebug* idg= m_ifn.find(s)->second;
00076       idg->name();
00077       return m_ifn.find(s)->second;
00078     }else{
00079       cout<<"Function not found: "<<s<<endl;
00080       assert(true==false);
00081       return 0;
00082     }
00083   }
00084   //*******************************************************
00085   IFnOfParticleParameters* 
00086   ConfigurerBase::findFnPP(const std::string& s ) const{
00087     if( m_ifnPP.find(s) != m_ifnPP.end() ){
00088       IDebug* idg= m_ifnPP.find(s)->second;
00089       idg->name();
00090       return m_ifnPP.find(s)->second;
00091     }else{
00092       cout<<"Function not found: "<<s<<endl;
00093       assert(true==false);
00094       return 0;
00095     }
00096   }
00097   //*******************************************************
00098   IFnOfParticleParameters2* 
00099   ConfigurerBase::findFnPP2(const std::string& s ) const{
00100     if( m_ifnPP2.find(s) != m_ifnPP2.end() ){
00101       IDebug* idg= m_ifnPP2.find(s)->second;
00102       idg->name();
00103       return m_ifnPP2.find(s)->second;
00104     }else{
00105       cout<<"Function not found: "<<s<<endl;
00106       assert(true==false);
00107       return 0;
00108     }
00109   }
00110   //*******************************************************
00111   IUpdatingGaussian* 
00112   ConfigurerBase::findIUG(const std::string& s ) const{
00113     if( m_iug.find(s) != m_iug.end() ){
00114       IDebug* idg= m_iug.find(s)->second;
00115       idg->name();
00116       return m_iug.find(s)->second;
00117     }else{
00118       cout<<"IUpdatingGaussian not found: "<<s<<endl;
00119       assert(true==false);
00120       return 0;
00121     }
00122   }
00123   //*******************************************************
00124   ISampler* ConfigurerBase::findSampler(const std::string& s ) const{
00125     if( m_isamplers.find(s) != m_isamplers.end() ){
00126       IDebug* idg= m_isamplers.find(s)->second;
00127       idg->name();
00128       return m_isamplers.find(s)->second;
00129     }else{
00130       cout<<"ISampler not found: "<<s<<endl;
00131       assert(true==false);
00132       return 0;
00133     }
00134   }
00135   //*******************************************************
00136   INormaliser* ConfigurerBase::findNormaliser(const std::string& s ) const{
00137     if( m_inormalisers.find(s) != m_inormalisers.end() ){
00138       IDebug* idg= m_inormalisers.find(s)->second;
00139       idg->name();
00140       return m_inormalisers.find(s)->second;
00141     }else{
00142       cout<<"INormaliser not found: "<<s<<endl;
00143       assert(true==false);
00144       return 0;
00145     }
00146   }
00147   //*******************************************************
00148   void ConfigurerBase::eDepositors(std::vector<IDepositor*>& v) const {
00149     std::copy(m_eDepositors.begin(), m_eDepositors.end(), back_inserter(v));
00150   }  
00151   //*******************************************************
00152   void ConfigurerBase::hDepositors(std::vector<IDepositor*>& v) const {
00153     std::copy(m_hDepositors.begin(), m_hDepositors.end(), back_inserter(v));
00154   }  
00155   //*******************************************************
00158   EnergyLimiter* ConfigurerBase::energyLimiter() const {
00159     cout<<"ConfigureBase: constructing energy limiter"<<endl;
00160     return new EnergyLimiter(10., 100., "Default EnergyLimiter");
00161   }
00162   //*******************************************************
00163   void ConfigurerBase::addFn(const std::string& label, IFn* entry){
00164     m_ifn[label] = m_fnPtrAdapter->adapt(entry, label);
00165   }
00166   //*******************************************************
00167   void ConfigurerBase::addFnPP(const std::string& label, 
00168                                IFnOfParticleParameters* entry){
00169     m_ifnPP[label] = m_fnOfPPPtrAdapter->adapt(entry, label);
00170   }
00171   //*******************************************************
00172   void ConfigurerBase::addFnPP2(const std::string& label, 
00173                                 IFnOfParticleParameters2* entry){
00174     m_ifnPP2[label] = m_fnOfPP2PtrAdapter->adapt(entry, label);
00175   }
00176   //*******************************************************
00177   void ConfigurerBase::addIUG(const std::string& label, 
00178                               IUpdatingGaussian* entry){
00179     m_iug[label] = m_UpGnPtrAdapter->adapt(entry, label);
00180   }
00181   //*******************************************************
00182   void ConfigurerBase::addSampler(const std::string& label, ISampler* entry){
00183     m_isamplers[label] = m_samplerPtrAdapter->adapt(entry, label);
00184   }
00185   //*******************************************************
00186   void ConfigurerBase::addEdepositor(const std::string& label, 
00187                                      IDepositor* entry){
00188     m_eDepositors.push_back(m_depositorPtrAdapter->adapt(entry, label));
00189   }
00190   //*******************************************************
00191   void ConfigurerBase::addHdepositor(const std::string& label, 
00192                                      IDepositor* entry){
00193     m_hDepositors.push_back(m_depositorPtrAdapter->adapt(entry, label));
00194   }
00195   //*******************************************************
00196   void ConfigurerBase::addNormaliser(const std::string& label, 
00197                                      INormaliser* entry){
00198     m_inormalisers[label] = m_normaliserPtrAdapter->adapt(entry, label);
00199   }
00200   //*******************************************************
00201   IUpdatingGaussian* 
00202   ConfigurerBase::makeGaussian(const std::string& label) const {
00203     IUpdatingGaussian* iug = 
00204       new  UpdatingGaussian(findFn(label+"PeakMean"), 
00205                             findFn(label+"PeakSigma"),
00206                             makeProcessedNormal(label)
00207                             );
00208     return m_UpGnPtrAdapter->adapt(iug, label+"UpdatingGaussian");
00209     
00210   }
00211   //*******************************************************
00212   IUpdatingGaussian* 
00213   ConfigurerBase::makeUpdatingGaussian0LP(const std::string& label) const {
00214     IUpdatingGaussian* iug = new  UpdatingGaussian0LP(label, *this); 
00215     //      new  UpdatingGaussian0LP(findFn(label+"PeakMean"), 
00216     //                         findFn(label+"PeakSigma"),
00217     //                         makeProcessedNormal(label)
00218     //                         );
00219     return m_UpGnPtrAdapter->adapt(iug, label+"UpdatingGaussian0LP");
00220   }
00221   //*******************************************************
00222   IUpdatingGaussian* 
00223   ConfigurerBase::makeUpdatingGaussian01P(const std::string& label) const {
00224     IUpdatingGaussian* iug = new  UpdatingGaussian01P(label, *this); 
00225     return m_UpGnPtrAdapter->adapt(iug, label+"UpdatingGaussian01P");
00226   }
00227   //*******************************************************
00228   IUpdatingGaussian* 
00229   ConfigurerBase::makeUpdatingGaussian02P(const std::string& label) const {
00230     IUpdatingGaussian* iug = new  UpdatingGaussian02P(label, *this); 
00231     return m_UpGnPtrAdapter->adapt(iug, label+"UpdatingGaussian02P");
00232   }
00233   //*******************************************************
00234   IProcessedDist*
00235   ConfigurerBase::makeProcessedNormal(const std::string& label) const {
00236     IProcessedDist* ipd = new  ProcessedNormal;
00237     return m_procDistPtrAdapter->adapt(ipd,  label+"ProcessedNormal");
00238   }
00239   //*******************************************************    
00240   IProcessedDist* 
00241   ConfigurerBase::makeProcessedFlat(const std::string& label) const {
00242     IProcessedDist* ipd = new  ProcessedFlat;
00243     return m_procDistPtrAdapter->adapt(ipd, label+"ProcessedFlat");
00244   }
00245   //*******************************************************    
00246   IInTail* 
00247   ConfigurerBase::makeIInTail(const std::string& label) const {
00248     
00249     IInTail* iit = new InTail(*this, label);
00250     return  m_iinTailPtrAdapter->adapt(iit, label+"IIntail");
00251   }
00252   //*******************************************************    
00253   //HaloDepositor::HaloArray* ConfigurerBase::makeHaloOrder() const {
00254   //  cout<<"ConfigurerBase: makeHaloOrder starts"<<endl;
00255   //  HaloDepositor::HaloArray* ha = new HaloDepositor::HaloArray();
00256   //
00257   //  for(std::size_t ind = 0; ind!=HaloDepositor::s_nHaloCells; ++ind){
00258   //    ha->push_back(ind);
00259   //  }
00260   //
00261   //  //    std::reverse( ha->begin(), ha->end() );// for testing only
00262   //  
00263   //  cout<<"ConfigurerBase: makeHaloOrder ends"<<endl;
00264   //  return ha;
00265   //}
00266   //*******************************************************    
00267   //HaloDepositor::HaloFns* ConfigurerBase::makeHaloFns() const {
00268   //  cout<<"ConfigurerBase: makeHaloFns starts"<<endl;
00269   // 
00270   //  HaloDepositor::HaloFns* hf = new HaloDepositor::HaloFns();
00271   //
00272   //  for(std::size_t ind = 0; ind!=HaloDepositor::s_nHaloCells; ++ind){
00273   //    hf->push_back(new ConstFnOfParticleParameters(0.01*ind ));
00274   //    //      hf->push_back(new ConstFnOfParticleParameters(0.95+0.001*ind ));
00275   //  }
00276   //  cout<<"ConfigurerBase: makeHaloFns ends"<<endl;
00277   //  return hf;
00278   //}
00280   IShowerer* ConfigurerBase::makeShowerer(const std::string& s) const {
00281     IShowerer* showerer = new Showerer(this, s);
00282     return m_showererPtrAdapter->adapt(showerer, s);
00283   }    
00284 }//namespace
00285 
00286 
00287 
00288 
00289 
00290 
00291 
00292 
00293 

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