# Project CMSSW displayed by LXR

File indexing completed on 2024-04-06 12:11:11

```0001 #ifndef FastSimulation_CaloGeometryTools_CrystalPad
0003
0004 #include "Geometry/CaloTopology/interface/CaloDirection.h"
0005
0006 #include "CLHEP/Vector/TwoVector.h"
0007 #include "DataFormats/Math/interface/Vector3D.h"
0008 //#include "Math/GenVector/Transform3D.h"
0009 #include "FastSimulation/CaloGeometryTools/interface/Transform3DPJ.h"
0011 #include <vector>
0012
0014 public:
0015   typedef math::XYZVector XYZVector;
0016   typedef math::XYZVector XYZPoint;
0017   typedef ROOT::Math::Transform3DPJ Transform3D;
0018   typedef ROOT::Math::Transform3DPJ::Point Point;
0019
0020   CrystalPad() { dummy_ = true; };
0021   /// Order matters. 1234 2341 3412 4123 are ok but not 1324 ....
0022   CrystalPad(unsigned number, const std::vector<CLHEP::Hep2Vector>& corners);
0023   /// Constructor from space points, with the description of the local
0024   /// frame (origin,vec1,vec2) where vec1 is normal to the plane and vec2
0025   /// in the plane
0027              int onEcal,
0028              const std::vector<XYZPoint>& corners,
0029              const XYZPoint& origin,
0030              const XYZVector& vec1,
0031              const XYZVector& vec2);
0032
0034              const std::vector<XYZPoint>& corners,
0035              const Transform3D&,
0036              double scaf = 1.,
0037              bool bothdirections = false);
0038
0040
0042
0044
0045   /// Check that the point (in the local frame) is inside the crystal.
0046   bool inside(const CLHEP::Hep2Vector& point, bool debug = false) const;
0047   /// Check that the point (in the global frame) is inside the crystal.
0048   //  bool globalinside(XYZPoint) const;
0049
0050   /// coordinates of the point in the local frame
0051   //  CLHEP::Hep2Vector localPoint(XYZPoint point) const;
0052
0053   /// get the corners
0054   inline const std::vector<CLHEP::Hep2Vector>& getCorners() const { return corners_; }
0055
0056   /// Rescale the Quad to allow for some inaccuracy ...
0057   void resetCorners();
0058
0059   /// print
0060   void print() const;
0061
0062   /// access methods to the survivalProbability
0063   inline double survivalProbability() const { return survivalProbability_; };
0064   inline void setSurvivalProbability(double val) { survivalProbability_ = val; };
0065
0067   CLHEP::Hep2Vector& edge(unsigned iside, int n);
0068
0070   CLHEP::Hep2Vector& edge(CaloDirection);
0071
0073   inline unsigned getNumber() const { return number_; };
0074
0075   /// get the coordinates in the original frame
0076   /*
0077   inline XYZPoint originalCoordinates(CLHEP::Hep2Vector point) const
0078     {
0079       XYZPoint p(point.x(),point.y(),0.);
0080       return trans_.Inverse() * p;
0081     }
0082   */
0083
0085     //      std::cout << " First " << quad.getCellID() << " Second " << this->getCellID() << std::endl;
0087   }
0088
0090
0091   /// xmin xmax, ymin ymax of the quad
0092   void extrems(double& xmin, double& xmax, double& ymin, double& ymax) const;
0093
0094   ///get the center
0095   inline const CLHEP::Hep2Vector& center() const { return center_; }
0096
0097   /// for graphic debugging
0098   void getDrawingCoordinates(std::vector<float>& x, std::vector<float>& y) const;
0099
0100 private:
0101   static std::vector<CLHEP::Hep2Vector> aVector;
0102
0103   std::vector<CLHEP::Hep2Vector> corners_;
0104   std::vector<CLHEP::Hep2Vector> dir_;
0105   unsigned number_;
0106   Transform3D trans_;
0107   ROOT::Math::Rotation3D rotation_;
0108   XYZVector translation_;
0109   double survivalProbability_;
0110   CLHEP::Hep2Vector center_;
0111   double epsilon_;
0112   bool dummy_;
0113   double yscalefactor_;
0114
0115 public:
0116   /// equality operator
0118   public:
0120         : ref_(cell){
0121               //        std::cout << " quadEqual " << ref_ << std::endl;
0122           };