File indexing completed on 2024-04-06 12:11:11
0001 #ifndef FastSimulation_GeometryTool_Crystal_h
0002 #define FastSimulation_GeometryTool_Crystal_h
0003
0004
0005 #include "Math/GenVector/Plane3D.h"
0006 #include "DataFormats/Math/interface/Vector3D.h"
0007
0008
0009 #include "Geometry/CaloTopology/interface/CaloDirection.h"
0010 #include "DataFormats/DetId/interface/DetId.h"
0011
0012
0013 #include "FastSimulation/CaloGeometryTools/interface/CrystalNeighbour.h"
0014 #include "FastSimulation/CaloGeometryTools/interface/BaseCrystal.h"
0015
0016 #include <vector>
0017
0018 class DetId;
0019
0020 class Crystal {
0021 public:
0022 typedef math::XYZVector XYZVector;
0023 typedef math::XYZVector XYZPoint;
0024 typedef ROOT::Math::Plane3D Plane3D;
0025
0026
0027
0028
0029 Crystal() = default;
0030
0031 Crystal(const DetId& cell, const BaseCrystal* bc = nullptr);
0032
0033
0034 inline const XYZPoint& getCorner(unsigned i) const { return myCrystal_->getCorner(i); };
0035
0036 inline const XYZPoint& getCenter() const { return myCrystal_->getCenter(); };
0037
0038 inline const XYZPoint& getFrontCenter() const { return myCrystal_->getFrontCenter(); };
0039
0040 inline const XYZPoint& getBackCenter() const { return myCrystal_->getBackCenter(); }
0041
0042 inline const XYZVector& getFirstEdge() const { return myCrystal_->getFirstEdge(); }
0043
0044 inline const XYZVector& getFifthEdge() const { return myCrystal_->getFifthEdge(); }
0045
0046 inline const DetId& getDetId() const { return cellid_; };
0047
0048 inline const int getSubdetNumber() const { return myCrystal_->getSubdetNumber(); }
0049 void print() const { return myCrystal_->print(); }
0050
0051 void getLateralEdges(unsigned i, XYZPoint& a, XYZPoint& b) const { myCrystal_->getLateralEdges(i, a, b); };
0052
0053 void getFrontSide(XYZPoint& a, XYZPoint& b, XYZPoint& c, XYZPoint& d) const { myCrystal_->getFrontSide(a, b, c, d); }
0054 void getFrontSide(std::vector<XYZPoint>& corners) const { myCrystal_->getFrontSide(corners); }
0055
0056 void getBackSide(XYZPoint& a, XYZPoint& b, XYZPoint& c, XYZPoint& d) const { myCrystal_->getBackSide(a, b, c, d); }
0057 void getBackSide(std::vector<XYZPoint>& corners) const { myCrystal_->getBackSide(corners); }
0058
0059 void getLateralSide(unsigned i, XYZPoint& a, XYZPoint& b, XYZPoint& c, XYZPoint& d) const {
0060 myCrystal_->getLateralSide(i, a, b, c, d);
0061 }
0062 void getLateralSide(unsigned i, std::vector<XYZPoint>& corners) const { myCrystal_->getLateralSide(i, corners); }
0063
0064 void getSide(const CaloDirection& side, XYZPoint& a, XYZPoint& b, XYZPoint& c, XYZPoint& d) const {
0065 myCrystal_->getSide(side, a, b, c, d);
0066 }
0067 void getSide(const CaloDirection& side, std::vector<XYZPoint>& corners) const { myCrystal_->getSide(side, corners); }
0068
0069
0070 const Plane3D& getFrontPlane() const { return myCrystal_->getFrontPlane(); }
0071
0072 const Plane3D& getBackPlane() const { return myCrystal_->getBackPlane(); }
0073
0074 const Plane3D& getLateralPlane(unsigned i) const { return myCrystal_->getLateralPlane(i); }
0075
0076 const Plane3D& getPlane(const CaloDirection& side) const { return myCrystal_->getPlane(side); }
0077
0078
0079 inline const XYZVector& getLateralEdge(unsigned i) const { return myCrystal_->getLateralEdge(i); }
0080
0081
0082 inline const XYZVector& exitingNormal(const CaloDirection& side) const { return myCrystal_->exitingNormal(side); }
0083
0084 static unsigned oppositeDirection(unsigned iside);
0085
0086
0087 void getDrawingCoordinates(std::vector<float>& x, std::vector<float>& y, std::vector<float>& z) const {
0088 myCrystal_->getDrawingCoordinates(x, y, z);
0089 }
0090
0091
0092 inline void setNumber(unsigned n) { number_ = n; };
0093
0094
0095 inline unsigned number() const { return number_; };
0096
0097
0098 inline CrystalNeighbour& crystalNeighbour(unsigned iq) { return neighbours_[iq]; }
0099
0100
0101 inline const XYZVector& getAxis() const { return myCrystal_->getAxis(); }
0102
0103
0104 inline void setX0Back(double val) { X0back_ = val; }
0105
0106
0107 inline double getX0Back() const { return X0back_; }
0108
0109 ~Crystal() { ; };
0110
0111 private:
0112 unsigned number_ = 0;
0113 DetId cellid_;
0114 std::vector<CrystalNeighbour> neighbours_;
0115 double X0back_ = 0.;
0116 const BaseCrystal* myCrystal_ = nullptr;
0117
0118 public:
0119 class crystalEqual {
0120 public:
0121 crystalEqual(const DetId& cell) : ref_(cell) { ; };
0122 ~crystalEqual() { ; };
0123 inline bool operator()(const Crystal& xtal) const { return (ref_ == xtal.getDetId()); }
0124
0125 private:
0126 const DetId& ref_;
0127 };
0128 };
0129 #endif