File indexing completed on 2024-06-07 02:29:32
0001 #ifndef FastSimulation_GeometryTool_BaseCrystal_h
0002 #define FastSimulation_GeometryTool_BaseCrystal_h
0003
0004
0005 #include "DataFormats/Math/interface/Vector3D.h"
0006 #include "Math/GenVector/Plane3D.h"
0007
0008
0009 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
0010 #include "Geometry/CaloTopology/interface/CaloDirection.h"
0011 #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
0012 #include "FastSimulation/CaloGeometryTools/interface/CaloDirectionOperations.h"
0013 #include "DataFormats/DetId/interface/DetId.h"
0014
0015 #include <vector>
0016
0017 class DetId;
0018
0019 class BaseCrystal {
0020 public:
0021 typedef math::XYZVector XYZVector;
0022 typedef math::XYZVector XYZPoint;
0023 typedef ROOT::Math::Plane3D Plane3D;
0024
0025
0026
0027
0028 BaseCrystal() = default;
0029
0030 BaseCrystal(const DetId& cell);
0031
0032
0033
0034
0035
0036
0037
0038
0039 ~BaseCrystal() = default;
0040
0041 void setCorners(const CaloCellGeometry::CornersVec& vec, const GlobalPoint& pos);
0042
0043
0044
0045
0046 inline const XYZPoint& getCorner(unsigned i) const { return corners_[i]; };
0047
0048 inline const XYZPoint& getCenter() const { return center_; };
0049
0050 inline const XYZPoint& getFrontCenter() const { return frontcenter_; };
0051
0052 inline const XYZPoint& getBackCenter() const { return backcenter_; }
0053
0054 inline const XYZVector& getFirstEdge() const { return firstedgedirection_; }
0055
0056 inline const XYZVector& getFifthEdge() const { return fifthedgedirection_; }
0057
0058 inline const DetId& getDetId() const { return cellid_; };
0059
0060 inline const int getSubdetNumber() const { return subdetn_; }
0061
0062
0063 void getLateralEdges(unsigned i, XYZPoint&, XYZPoint&) const;
0064
0065 void getFrontSide(XYZPoint& a, XYZPoint& b, XYZPoint& c, XYZPoint& d) const;
0066 void getFrontSide(std::vector<XYZPoint>& corners) const;
0067
0068 void getBackSide(XYZPoint& a, XYZPoint& b, XYZPoint& c, XYZPoint& d) const;
0069 void getBackSide(std::vector<XYZPoint>& corners) const;
0070
0071 void getLateralSide(unsigned i, XYZPoint& a, XYZPoint& b, XYZPoint& c, XYZPoint& d) const;
0072 void getLateralSide(unsigned i, std::vector<XYZPoint>& corners) const;
0073
0074 void getSide(const CaloDirection& side, XYZPoint& a, XYZPoint& b, XYZPoint& c, XYZPoint& d) const;
0075 void getSide(const CaloDirection& side, std::vector<XYZPoint>& corners) const;
0076
0077
0078 inline const Plane3D& getFrontPlane() const { return lateralPlane_[4]; }
0079
0080 inline const Plane3D& getBackPlane() const { return lateralPlane_[5]; }
0081
0082 inline const Plane3D& getLateralPlane(unsigned i) const { return lateralPlane_[i]; };
0083
0084 const Plane3D& getPlane(const CaloDirection& side) const {
0085 return lateralPlane_[CaloDirectionOperations::Side(side)];
0086 }
0087
0088
0089 inline const XYZVector& getLateralEdge(unsigned i) const { return lateraldirection_[i]; };
0090
0091
0092 inline const XYZVector& exitingNormal(const CaloDirection& side) const {
0093 return exitingNormal_[CaloDirectionOperations::Side(side)];
0094 };
0095
0096 static unsigned oppositeDirection(unsigned iside);
0097
0098
0099 void getDrawingCoordinates(std::vector<float>& x, std::vector<float>& y, std::vector<float>& z) const;
0100
0101
0102 inline const XYZVector& getAxis() const { return crystalaxis_; }
0103
0104 void print() const;
0105
0106 private:
0107 void computeBasicProperties();
0108
0109 private:
0110 XYZPoint corners_[8];
0111 DetId cellid_;
0112 int subdetn_;
0113 XYZPoint center_;
0114 XYZPoint frontcenter_;
0115 XYZPoint backcenter_;
0116 XYZVector firstedgedirection_;
0117 XYZVector fifthedgedirection_;
0118 XYZVector crystalaxis_;
0119 XYZVector lateraldirection_[4];
0120 Plane3D lateralPlane_[6];
0121 XYZVector exitingNormal_[6];
0122 };
0123 #endif