Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:48:35

0001 #ifndef GeometryHGCalGeometryFastTimeGeometry_h
0002 #define GeometryHGCalGeometryFastTimeGeometry_h
0003 
0004 /*
0005  * Geometry for Fast Timing Layer
0006  * This geometry is essentially driven by topology, 
0007  * which is thus encapsulated in this class. 
0008  * This makes this geometry not suitable to be loaded
0009  * by regular CaloGeometryLoader<T>
0010  */
0011 
0012 #include "DataFormats/Common/interface/AtomicPtrCache.h"
0013 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
0014 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
0015 #include "Geometry/CaloGeometry/interface/FlatTrd.h"
0016 #include "Geometry/Records/interface/IdealGeometryRecord.h"
0017 #include "DetectorDescription/Core/interface/DDFilteredView.h"
0018 #include "Geometry/CaloTopology/interface/FastTimeTopology.h"
0019 #include "Geometry/Records/interface/FastTimeGeometryRecord.h"
0020 #include <vector>
0021 
0022 class FlatTrd;
0023 
0024 class FastTimeGeometry final : public CaloSubdetectorGeometry {
0025 public:
0026   typedef std::vector<FlatTrd> CellVec;
0027 
0028   typedef CaloCellGeometry::CCGFloat CCGFloat;
0029   typedef CaloCellGeometry::Pt3D Pt3D;
0030   typedef CaloCellGeometry::Pt3DVec Pt3DVec;
0031 
0032   typedef std::set<DetId> DetIdSet;
0033   typedef std::vector<GlobalPoint> CornersVec;
0034 
0035   typedef FastTimeGeometryRecord AlignedRecord;  // NOTE: not aligned yet
0036   typedef PFastTimeRcd PGeometryRecord;
0037 
0038   enum { k_NumberOfParametersPerShape = 12 };  // FlatTrd
0039   enum { k_NumberOfShapes = 50 };
0040 
0041   static std::string dbString() { return "PFastTimeRcd"; }
0042 
0043   FastTimeGeometry(const FastTimeTopology& topology);
0044 
0045   ~FastTimeGeometry() override;
0046 
0047   void localCorners(Pt3DVec& lc, const CCGFloat* pv, unsigned int i, Pt3D& ref);
0048 
0049   void newCell(const GlobalPoint& f1,
0050                const GlobalPoint& f2,
0051                const GlobalPoint& f3,
0052                const CCGFloat* parm,
0053                const DetId& detId) override;
0054 
0055   /// Get the cell geometry of a given detector id.  Should return false if not found.
0056   std::shared_ptr<const CaloCellGeometry> getGeometry(const DetId& id) const override;
0057 
0058   bool present(const DetId& id) const override;
0059 
0060   void getSummary(CaloSubdetectorGeometry::TrVec& trVector,
0061                   CaloSubdetectorGeometry::IVec& iVector,
0062                   CaloSubdetectorGeometry::DimVec& dimVector,
0063                   CaloSubdetectorGeometry::IVec& dinsVector) const override;
0064 
0065   GlobalPoint getPosition(const DetId& id) const;
0066 
0067   /// Returns the corner points of this cell's volume.
0068   CornersVec getCorners(const DetId& id) const;
0069 
0070   // avoid sorting set in base class
0071   const std::vector<DetId>& getValidDetIds(DetId::Detector det = DetId::Detector(0), int subdet = 0) const override {
0072     return m_validIds;
0073   }
0074   const std::vector<DetId>& getValidGeomDetIds(void) const { return m_validGeomIds; }
0075 
0076   // Get closest cell, etc...
0077   DetId getClosestCell(const GlobalPoint& r) const override;
0078 
0079   /** \brief Get a list of all cells within a dR of the given cell
0080       
0081       The default implementation makes a loop over all cell geometries.
0082       Cleverer implementations are suggested to use rough conversions between
0083       eta/phi and ieta/iphi and test on the boundaries.
0084   */
0085   DetIdSet getCells(const GlobalPoint& r, double dR) const override;
0086 
0087   virtual void fillNamedParams(DDFilteredView fv);
0088   void initializeParms() override;
0089 
0090   static std::string producerTag() { return "FastTime"; }
0091   std::string cellElement() const;
0092 
0093   const FastTimeTopology& topology() const { return m_topology; }
0094   void sortDetIds();
0095 
0096 protected:
0097   unsigned int indexFor(const DetId& id) const override;
0098   using CaloSubdetectorGeometry::sizeForDenseIndex;
0099   unsigned int sizeForDenseIndex() const;
0100 
0101   // Modify the RawPtr class
0102   const CaloCellGeometry* getGeometryRawPtr(uint32_t index) const override;
0103   std::shared_ptr<const CaloCellGeometry> cellGeomPtr(uint32_t index) const override;
0104 
0105   void addValidID(const DetId& id);
0106 
0107 private:
0108   std::shared_ptr<const CaloCellGeometry> cellGeomPtr(uint32_t index, const GlobalPoint& p) const;
0109 
0110   const FastTimeTopology& m_topology;
0111 
0112   CellVec m_cellVec;
0113   std::vector<DetId> m_validGeomIds;
0114   int m_Type;
0115   ForwardSubdetector m_subdet;
0116 };
0117 
0118 #endif