| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

PmtGeomInfo.cc

Go to the documentation of this file.
00001 #include "PmtGeomInfo.h"
00002 
00003 #include "DetDesc/IDetectorElement.h"
00004 #include "DetDesc/IGeometryInfo.h"
00005 
00006 #include "GaudiKernel/Point3DTypes.h"
00007 #include "GaudiKernel/Vector3DTypes.h"
00008 
00009 #include "CLHEP/Vector/ThreeVector.h"
00010 
00011 using namespace CLHEP;
00012 
00013 PmtGeomInfo::PmtGeomInfo(unsigned int pmtid,
00014                          IDetectorElement* me,
00015                          IDetectorElement* parent)
00016     : m_id(pmtid)
00017     , m_me(me)
00018     , m_parent(parent)
00019     , m_gp(0), m_lp(0), m_gd(0), m_ld(0)
00020 {
00021 }
00022 
00023 PmtGeomInfo::~PmtGeomInfo()
00024 {
00025     if (m_gp) delete m_gp; m_gp = 0;
00026     if (m_lp) delete m_lp; m_lp = 0;
00027     if (m_gd) delete m_gd; m_gd = 0;
00028     if (m_ld) delete m_ld; m_ld = 0;
00029 }
00030 
00031 unsigned int PmtGeomInfo::pmtid() const
00032 {
00033     return m_id;
00034 }
00035 
00036 const Hep3Vector& PmtGeomInfo::globalPosition() const
00037 {
00038     if (m_gp) return *m_gp;
00039 
00040     Gaudi::XYZPoint zero(0,0,0);
00041     Gaudi::XYZPoint gp = m_me->geometry()->toGlobal(zero);
00042 
00043     m_gp = new Hep3Vector(gp.x(),gp.y(),gp.z());
00044     return *m_gp;
00045 }
00046 
00047 const Hep3Vector& PmtGeomInfo::localPosition() const
00048 {
00049     if (m_lp) return *m_lp;
00050 
00051     Gaudi::XYZPoint zero(0,0,0);
00052     Gaudi::XYZPoint gp = m_me->geometry()->toGlobal(zero);
00053     Gaudi::XYZPoint lp = m_parent->geometry()->toLocal(gp);
00054     m_lp = new Hep3Vector(lp.x(),lp.y(),lp.z());
00055     return *m_lp;
00056 }
00057 
00058 const Hep3Vector& PmtGeomInfo::globalDirection() const
00059 {
00060     if (m_gd) return *m_gd;
00061 
00062     Gaudi::XYZVector norm(0,0,1);
00063     Gaudi::XYZVector gd = m_me->geometry()->toGlobal(norm);
00064     m_gd = new Hep3Vector(gd.x(),gd.y(),gd.z());
00065     return *m_gd;
00066 }
00067 
00068 const Hep3Vector& PmtGeomInfo::localDirection() const
00069 {
00070     if (m_ld) return *m_ld;
00071 
00072     Gaudi::XYZVector norm(0,0,1);
00073     Gaudi::XYZVector gd = m_me->geometry()->toGlobal(norm);
00074     Gaudi::XYZVector ld = m_parent->geometry()->toLocal(gd);
00075     m_ld = new Hep3Vector(ld.x(),ld.y(),ld.z());
00076     return *m_ld;
00077 }
00078 
00079 const IDetectorElement& PmtGeomInfo::detectorElement() const
00080 {
00081     return *m_me;
00082 }
00083 
00084 const IDetectorElement& PmtGeomInfo::parentDetector() const
00085 {
00086     return *m_parent;
00087 }
00088 
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:15:09 2011 for DetHelpers by doxygen 1.4.7