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   }
0033   virtual ~h1d2plot_cp(){
0034   }
0035 public:
0036   h1d2plot_cp(const h1d2plot_cp& a_from)
0037   :plottable(a_from)
0038   ,bins1D(a_from)
0039   ,h1d2plot(m_cp)
0040   ,m_cp(a_from.m_cp)
0041   {
0042   }
0043   h1d2plot_cp& operator=(const h1d2plot_cp& a_from){
0044     h1d2plot::operator=(a_from);
0045     m_cp = a_from.m_cp;
0046     return *this;
0047   }
0048 public:
0049   const histo::h1d& data() const {return m_cp;}
0050   histo::h1d& data() {return m_cp;}
0051 protected:
0052   histo::h1d m_cp;
0053 };
0054 
0055 class h2d2plot_cp : public h2d2plot {
0056 public:
0057   TOOLS_SCLASS(tools::sg::h2d2plot_cp)
0058 public:
0059   virtual void* cast(const std::string& a_class) const {
0060     if(void* p = cmp_cast<h2d2plot_cp>(this,a_class)) {return p;}
0061     return h2d2plot::cast(a_class);
0062   }
0063 public:
0064   virtual plottable* copy() const {return new h2d2plot_cp(*this);}
0065 public:
0066   h2d2plot_cp(const histo::h2d& a_data)
0067   :h2d2plot(m_cp)
0068   ,m_cp(a_data)
0069   {
0070   }
0071   virtual ~h2d2plot_cp(){
0072   }
0073 public:
0074   h2d2plot_cp(const h2d2plot_cp& a_from)
0075   :plottable(a_from),bins2D(a_from),h2d2plot(m_cp)
0076   ,m_cp(a_from.m_cp)
0077   {
0078   }
0079   h2d2plot_cp& operator=(const h2d2plot_cp& a_from){
0080     h2d2plot::operator=(a_from);
0081     m_cp = a_from.m_cp;
0082     return *this;
0083   }
0084 protected:
0085   histo::h2d m_cp;
0086 };
0087 
0088 class p1d2plot_cp : public p1d2plot {
0089 public:
0090   TOOLS_SCLASS(tools::sg::p1d2plot_cp)
0091 public:
0092   virtual void* cast(const std::string& a_class) const {
0093     if(void* p = cmp_cast<p1d2plot_cp>(this,a_class)) {return p;}
0094     return p1d2plot::cast(a_class);
0095   }
0096 public:
0097   virtual plottable* copy() const {return new p1d2plot_cp(*this);}
0098 public:
0099   p1d2plot_cp(const histo::p1d& a_data)
0100   :p1d2plot(m_cp)
0101   ,m_cp(a_data)
0102   {
0103   }
0104   virtual ~p1d2plot_cp(){
0105   }
0106 public:
0107   p1d2plot_cp(const p1d2plot_cp& a_from)
0108   :plottable(a_from),bins1D(a_from),p1d2plot(m_cp)
0109   ,m_cp(a_from.m_cp)
0110   {
0111   }
0112   p1d2plot_cp& operator=(const p1d2plot_cp& a_from){
0113     p1d2plot::operator=(a_from);
0114     m_cp = a_from.m_cp;
0115     return *this;
0116   }
0117 protected:
0118   histo::p1d m_cp;
0119 };
0120 
0121 }}
0122 
0123 #endif