CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/FastSimulation/CaloGeometryTools/interface/Crystal.h

Go to the documentation of this file.
00001 #ifndef FastSimulation_GeometryTool_Crystal_h
00002 #define FastSimulation_GeometryTool_Crystal_h
00003 
00004 // Data Formats
00005 #include "Math/GenVector/Plane3D.h"
00006 #include "DataFormats/Math/interface/Vector3D.h"
00007 
00008 // Unfortunately, GlobalPoints are also needed
00009 #include "Geometry/CaloTopology/interface/CaloDirection.h"
00010 #include "DataFormats/DetId/interface/DetId.h"
00011 
00012 //FAMOS
00013 #include "FastSimulation/CaloGeometryTools/interface/CrystalNeighbour.h"
00014 #include "FastSimulation/CaloGeometryTools/interface/BaseCrystal.h"
00015 
00016 #include <vector>
00017 
00018 class DetId;
00019 
00020 class Crystal
00021 {
00022 
00023  public:
00024 
00025   typedef math::XYZVector XYZVector;
00026   typedef math::XYZVector XYZPoint;
00027   typedef ROOT::Math::Plane3D Plane3D;
00028 
00029   // side numbering
00030   //  enum CrystalSide{EAST=0,NORTH=1,WEST=2,SOUTH=3,FRONT=4,BACK=5};
00032   Crystal(){;};
00034   Crystal(const DetId&  cell,const BaseCrystal* bc=0);
00035 
00037   inline const XYZPoint& getCorner(unsigned i) const { return myCrystal_->getCorner(i);};
00039   inline const XYZPoint& getCenter() const {return myCrystal_->getCenter();};
00041   inline const XYZPoint& getFrontCenter() const {return myCrystal_->getFrontCenter();};
00043   inline const XYZPoint & getBackCenter() const {return myCrystal_->getBackCenter();}
00045   inline const XYZVector& getFirstEdge() const {return  myCrystal_->getFirstEdge();}
00047   inline const XYZVector& getFifthEdge() const {return myCrystal_->getFifthEdge();}
00049   inline const DetId & getDetId() const {return cellid_;};
00051   inline const int getSubdetNumber() const {return myCrystal_->getSubdetNumber();}
00052   void print() const {return myCrystal_->print();}
00054   void getLateralEdges(unsigned i,XYZPoint& a,XYZPoint& b) const {myCrystal_->getLateralEdges(i,a,b); };
00056   void getFrontSide(XYZPoint &a,XYZPoint &b,XYZPoint &c,XYZPoint &d) const {myCrystal_->getFrontSide(a,b,c,d); }
00057   void getFrontSide(std::vector<XYZPoint>& corners) const {myCrystal_->getFrontSide(corners);}
00059   void getBackSide(XYZPoint &a,XYZPoint &b,XYZPoint &c,XYZPoint &d) const {myCrystal_->getBackSide(a,b,c,d);}
00060   void getBackSide(std::vector<XYZPoint>& corners) const {myCrystal_->getBackSide(corners);}
00062   void getLateralSide(unsigned i,XYZPoint &a,XYZPoint &b,XYZPoint &c,XYZPoint &d) const {myCrystal_->getLateralSide(i,a,b,c,d);}
00063   void getLateralSide(unsigned i,std::vector<XYZPoint>& corners) const {myCrystal_->getLateralSide(i,corners);}
00065   void getSide(const CaloDirection& side, XYZPoint &a,XYZPoint &b,XYZPoint &c,XYZPoint &d) const
00066   {myCrystal_->getSide(side,a,b,c,d);}
00067   void getSide(const CaloDirection& side, std::vector<XYZPoint>& corners) const
00068   {myCrystal_->getSide(side,corners);}
00069 
00070 
00072   const Plane3D& getFrontPlane() const {return myCrystal_->getFrontPlane();}
00074   const Plane3D& getBackPlane() const {return myCrystal_->getBackPlane();}
00076   const Plane3D& getLateralPlane(unsigned i) const {return myCrystal_->getLateralPlane(i);}
00078   const Plane3D& getPlane(const CaloDirection& side) const { return myCrystal_->getPlane(side);}
00079 
00081  inline const XYZVector& getLateralEdge(unsigned i) const {return myCrystal_->getLateralEdge(i);}
00082 
00084  inline const XYZVector& exitingNormal(const CaloDirection& side) const {return myCrystal_->exitingNormal(side);}
00085 
00086   static unsigned oppositeDirection(unsigned iside);
00087 
00089   void getDrawingCoordinates(std::vector<float> &x,std::vector<float> &y,std::vector<float> &z) const
00090   {
00091     myCrystal_->getDrawingCoordinates(x,y,z);
00092   }
00093 
00095   inline void setNumber(unsigned n) {number_=n;};
00096 
00098   inline unsigned number() const {
00099     return number_;};
00100 
00102   inline CrystalNeighbour & crystalNeighbour(unsigned iq) { return  neighbours_[iq];}
00103   
00105   inline const XYZVector & getAxis() const { return myCrystal_->getAxis();}
00106 
00108   inline void setX0Back(double val) {X0back_=val;}
00109 
00111   inline double getX0Back() const { return X0back_;}
00112 
00113   ~Crystal(){;};
00114 
00115  private:
00116   unsigned number_;
00117   DetId cellid_ ;
00118   std::vector<CrystalNeighbour> neighbours_;
00119   double X0back_;
00120   const BaseCrystal * myCrystal_;
00121 
00122  public:
00123   class crystalEqual
00124     {
00125     public:
00126       crystalEqual(const DetId & cell):ref_(cell)
00127         {;};
00128       ~crystalEqual(){;};
00129       inline bool operator() (const Crystal& xtal) const
00130         {
00131           return (ref_==xtal.getDetId());
00132         }
00133     private:
00134       const DetId& ref_;
00135     };
00136 };
00137 #endif