Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/Geant4/tools/sg/h2plot_cp is written in an unsupported language. File is not indexed.

0001 // Copyright (C) 2010, Guy Barrand. All rights reserved.
0002 // See the file tools.license for terms.
0003 
0004 #ifndef tools_sg_h2plot_cp
0005 #define tools_sg_h2plot_cp
0006 
0007 // Inheritance :
0008 #include "h2plot"
0009 
0010 namespace tools {
0011 namespace sg {
0012 
0013 class h1d2plot_cp : public h1d2plot {
0014 public:
0015   TOOLS_SCLASS(tools::sg::h1d2plot_cp)
0016 public:
0017   virtual void* cast(const std::string& a_class) const {
0018     if(void* p = cmp_cast<h1d2plot_cp>(this,a_class)) {return p;}
0019     return h1d2plot::cast(a_class);
0020   }
0021 public:
0022   virtual plottable* copy() const {return new h1d2plot_cp(*this);}
0023 public:
0024   h1d2plot_cp(const histo::h1d& a_data)
0025   :h1d2plot(m_cp) //give ref of m_cp to h1d2plot.
0026   ,m_cp(a_data)   //do a local copy.
0027   //WARNING : the upper is ok as long as h1d2plot constructor does nothing
0028   //          else than keeping the ref to m_cp. Else it would do
0029   //          something on an empty histo (and not on a copy of the
0030   //          passed a_data).
0031   {
0032 #ifdef TOOLS_MEM
0033     mem::increment(s_class().c_str());
0034 #endif
0035   }
0036   virtual ~h1d2plot_cp(){
0037 #ifdef TOOLS_MEM
0038     mem::decrement(s_class().c_str());
0039 #endif
0040   }
0041 public:
0042   h1d2plot_cp(const h1d2plot_cp& a_from)
0043   :plottable(a_from)
0044   ,bins1D(a_from)
0045   ,h1d2plot(m_cp)
0046   ,m_cp(a_from.m_cp)
0047   {
0048 #ifdef TOOLS_MEM
0049     mem::increment(s_class().c_str());
0050 #endif
0051   }
0052   h1d2plot_cp& operator=(const h1d2plot_cp& a_from){
0053     h1d2plot::operator=(a_from);
0054     m_cp = a_from.m_cp;
0055     return *this;
0056   }
0057 public:
0058   const histo::h1d& data() const {return m_cp;}
0059   histo::h1d& data() {return m_cp;}
0060 protected:
0061   histo::h1d m_cp;
0062 };
0063 
0064 class h2d2plot_cp : public h2d2plot {
0065 public:
0066   TOOLS_SCLASS(tools::sg::h2d2plot_cp)
0067 public:
0068   virtual void* cast(const std::string& a_class) const {
0069     if(void* p = cmp_cast<h2d2plot_cp>(this,a_class)) {return p;}
0070     return h2d2plot::cast(a_class);
0071   }
0072 public:
0073   virtual plottable* copy() const {return new h2d2plot_cp(*this);}
0074 public:
0075   h2d2plot_cp(const histo::h2d& a_data)
0076   :h2d2plot(m_cp)
0077   ,m_cp(a_data)
0078   {
0079 #ifdef TOOLS_MEM
0080     mem::increment(s_class().c_str());
0081 #endif
0082   }
0083   virtual ~h2d2plot_cp(){
0084 #ifdef TOOLS_MEM
0085     mem::decrement(s_class().c_str());
0086 #endif
0087   }
0088 public:
0089   h2d2plot_cp(const h2d2plot_cp& a_from)
0090   :plottable(a_from),bins2D(a_from),h2d2plot(m_cp)
0091   ,m_cp(a_from.m_cp)
0092   {
0093 #ifdef TOOLS_MEM
0094     mem::increment(s_class().c_str());
0095 #endif
0096   }
0097   h2d2plot_cp& operator=(const h2d2plot_cp& a_from){
0098     h2d2plot::operator=(a_from);
0099     m_cp = a_from.m_cp;
0100     return *this;
0101   }
0102 protected:
0103   histo::h2d m_cp;
0104 };
0105 
0106 class p1d2plot_cp : public p1d2plot {
0107 public:
0108   TOOLS_SCLASS(tools::sg::p1d2plot_cp)
0109 public:
0110   virtual void* cast(const std::string& a_class) const {
0111     if(void* p = cmp_cast<p1d2plot_cp>(this,a_class)) {return p;}
0112     return p1d2plot::cast(a_class);
0113   }
0114 public:
0115   virtual plottable* copy() const {return new p1d2plot_cp(*this);}
0116 public:
0117   p1d2plot_cp(const histo::p1d& a_data)
0118   :p1d2plot(m_cp)
0119   ,m_cp(a_data)
0120   {
0121 #ifdef TOOLS_MEM
0122     mem::increment(s_class().c_str());
0123 #endif
0124   }
0125   virtual ~p1d2plot_cp(){
0126 #ifdef TOOLS_MEM
0127     mem::decrement(s_class().c_str());
0128 #endif
0129   }
0130 public:
0131   p1d2plot_cp(const p1d2plot_cp& a_from)
0132   :plottable(a_from),bins1D(a_from),p1d2plot(m_cp)
0133   ,m_cp(a_from.m_cp)
0134   {
0135 #ifdef TOOLS_MEM
0136     mem::increment(s_class().c_str());
0137 #endif
0138   }
0139   p1d2plot_cp& operator=(const p1d2plot_cp& a_from){
0140     p1d2plot::operator=(a_from);
0141     m_cp = a_from.m_cp;
0142     return *this;
0143   }
0144 protected:
0145   histo::p1d m_cp;
0146 };
0147 
0148 }}
0149 
0150 #endif