CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/FastSimulation/CaloGeometryTools/interface/BaseCrystal.h

Go to the documentation of this file.
00001 #ifndef FastSimulation_GeometryTool_BaseCrystal_h
00002 #define FastSimulation_GeometryTool_BaseCrystal_h
00003 
00004 //Data Formats
00005 #include "DataFormats/Math/interface/Vector3D.h"
00006 #include "Math/GenVector/Plane3D.h"
00007 
00008 // Unfortunately, GlobalPoints are also needed
00009 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
00010 #include "Geometry/CaloTopology/interface/CaloDirection.h"
00011 #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
00012 #include "FastSimulation/CaloGeometryTools/interface/CaloDirectionOperations.h"
00013 #include "DataFormats/DetId/interface/DetId.h"
00014 
00015 #include <vector>
00016 
00017 class DetId;
00018 
00019 class BaseCrystal
00020 {
00021 
00022  public:
00023 
00024   typedef math::XYZVector XYZVector;
00025   typedef math::XYZVector XYZPoint;
00026   typedef ROOT::Math::Plane3D Plane3D;
00027 
00028   // side numbering
00029   //  enum CrystalSide{EAST=0,NORTH=1,WEST=2,SOUTH=3,FRONT=4,BACK=5};
00031    BaseCrystal(){;};
00033   BaseCrystal(const DetId&  cell);
00034 
00036      //    BaseCrystal (const BaseCrystal& bc):corners_(bc.getCorners()),cellid_(bc.getDetId())
00037     //    { 
00038       //      std::cout << " Copy constructor " ;
00039     //      computeBasicProperties();
00040       //      std::cout << " done " << std::endl;
00041     //    }
00042   ~BaseCrystal() {;}
00044   void setCorners(const CaloCellGeometry::CornersVec& vec,const GlobalPoint& pos);
00045 
00046   inline const std::vector<XYZPoint>& getCorners() const {return corners_;}
00047 
00049   inline const XYZPoint& getCorner(unsigned i) const { return corners_[i];};
00051   inline const XYZPoint& getCenter() const {return center_;};
00053   inline const XYZPoint& getFrontCenter() const {return frontcenter_;};
00055   inline const XYZPoint & getBackCenter() const {return backcenter_;}
00057   inline const XYZVector& getFirstEdge() const {return  firstedgedirection_;}
00059   inline const XYZVector& getFifthEdge() const {return  fifthedgedirection_;}
00061   inline const DetId & getDetId() const {return cellid_;};
00063   inline const int getSubdetNumber() const {return subdetn_;}
00064 
00066   void getLateralEdges(unsigned i,XYZPoint&,XYZPoint&)const;
00068   void getFrontSide(XYZPoint &a,XYZPoint &b,XYZPoint &c,XYZPoint &d) const;
00069   void getFrontSide(std::vector<XYZPoint>& corners) const;
00071   void getBackSide(XYZPoint &a,XYZPoint &b,XYZPoint &c,XYZPoint &d) const;
00072   void getBackSide(std::vector<XYZPoint>& corners) const;
00074   void getLateralSide(unsigned i,XYZPoint &a,XYZPoint &b,XYZPoint &c,XYZPoint &d) const;
00075   void getLateralSide(unsigned i,std::vector<XYZPoint>& corners) const;
00077   void getSide(const CaloDirection& side, XYZPoint &a,XYZPoint &b,XYZPoint &c,XYZPoint &d) const;
00078   void getSide(const CaloDirection& side, std::vector<XYZPoint>& corners) const;
00079 
00080 
00081 
00083   inline const Plane3D& getFrontPlane() const {return lateralPlane_[4];}
00085   inline const  Plane3D& getBackPlane() const {return lateralPlane_[5];}
00087   inline const Plane3D& getLateralPlane(unsigned i) const {return lateralPlane_[i];};
00089   const Plane3D& getPlane(const CaloDirection& side) const {return lateralPlane_[CaloDirectionOperations::Side(side)];}
00090 
00092   inline const XYZVector& getLateralEdge(unsigned i) const {return lateraldirection_[i];};
00093 
00095   inline const XYZVector& exitingNormal(const CaloDirection& side) const {return exitingNormal_[CaloDirectionOperations::Side(side)];};
00096 
00097   static unsigned oppositeDirection(unsigned iside);
00098 
00100   void getDrawingCoordinates(std::vector<float> &x,std::vector<float> &y,std::vector<float> &z) const;
00101 
00103   inline const XYZVector & getAxis() const { return crystalaxis_;}
00104 
00105   void print() const;
00106 
00107  private:
00108   void computeBasicProperties();
00109 
00110  private:
00111   std::vector<XYZPoint> corners_;
00112   DetId cellid_;
00113   int subdetn_;
00114   XYZPoint center_;
00115   XYZPoint frontcenter_;
00116   XYZPoint backcenter_;
00117   XYZVector firstedgedirection_;
00118   XYZVector fifthedgedirection_;
00119   XYZVector crystalaxis_;
00120   std::vector<XYZVector> lateraldirection_;
00121   std::vector<Plane3D> lateralPlane_;
00122   std::vector<XYZVector> exitingNormal_;
00123 };
00124 #endif