00001 #ifndef FASTSHOWER_FNOFPARTICLEPARAMETERSPTR_H 00002 #define FASTSHOWER_FNOFPARTICLEPARAMETERSPTR_H 00003 00004 #ifndef FASTSHOWER_DEBUGBASE_H 00005 #include "FastShowerUtils/DebugBase.h" 00006 #endif 00007 00008 #ifndef FASTSHOWER_SP_H 00009 #include "FastShowerUtils/SP.h" 00010 #endif 00011 00012 #ifndef FASTSHOWER_IFNOFPARTICLEPARAMETRS_H 00013 #include "FastShowerUtils/IFnOfParticleParameters.h" 00014 #endif 00015 00016 #ifndef STD_STRING_H 00017 #define STD_STRING_H 00018 #include <string> 00019 #endif 00020 00021 #include <iostream> 00022 #include <string> 00023 00024 namespace FastShower{ 00029 class FnOfParticleParametersPtr: 00030 public IFnOfParticleParameters, private DebugBase{ 00031 public: 00032 // 00033 FnOfParticleParametersPtr(IFnOfParticleParameters*, std::string s=""); 00034 FnOfParticleParametersPtr(const FnOfParticleParametersPtr &); 00035 FnOfParticleParametersPtr& operator=(const FnOfParticleParametersPtr&); 00036 ~FnOfParticleParametersPtr(){}; 00037 //IFnOfParticleParameters interface 00038 virtual double value(const ParticleParameters& pp) const; 00039 virtual IFnOfParticleParameters* clone() const; 00040 // 00041 private: 00042 SP<IFnOfParticleParameters> m_pointee; 00043 }; 00044 // 00045 inline 00046 FnOfParticleParametersPtr::FnOfParticleParametersPtr 00047 (IFnOfParticleParameters* pp, std::string s): 00048 DebugBase(s),m_pointee(pp){} 00049 // 00050 inline 00051 FnOfParticleParametersPtr::FnOfParticleParametersPtr 00052 (const FnOfParticleParametersPtr& f): 00053 IFnOfParticleParameters(), DebugBase(f), m_pointee(f.m_pointee){ 00054 } 00055 // 00056 inline 00057 FnOfParticleParametersPtr& FnOfParticleParametersPtr::operator= 00058 (const FnOfParticleParametersPtr& rhs){ 00059 00060 if (this == &rhs ) return *this; 00061 00062 DebugBase::operator=(rhs); 00063 m_pointee = rhs.m_pointee; 00064 00065 return *this; 00066 } 00067 // 00068 inline 00069 double 00070 FnOfParticleParametersPtr::value(const ParticleParameters& pp)const{ 00071 double x = m_pointee->value(pp); 00072 this->bumpStats(x, &pp); 00073 // cout.precision(3); 00074 // cout<<text()<<" "<<x<<endl; 00075 return x; 00076 } 00077 // 00078 inline 00079 IFnOfParticleParameters* FnOfParticleParametersPtr::clone() const { 00080 IFnOfParticleParameters* nptr = new FnOfParticleParametersPtr(*this); 00081 return nptr; 00082 } 00083 // 00084 } 00085 #endif