Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:14:50

0001 #ifndef Geometry_HcalTowerAlgo_HcalDDDGeometry_h
0002 #define Geometry_HcalTowerAlgo_HcalDDDGeometry_h
0003 
0004 #include "Geometry/HcalCommonData/interface/HcalCellType.h"
0005 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
0006 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
0007 #include "Geometry/CaloGeometry/interface/IdealObliquePrism.h"
0008 #include "Geometry/CaloGeometry/interface/IdealZPrism.h"
0009 #include "Geometry/CaloTopology/interface/HcalTopology.h"
0010 #include "CondFormats/AlignmentRecord/interface/HcalAlignmentRcd.h"
0011 #include "Geometry/Records/interface/HcalGeometryRecord.h"
0012 #include "FWCore/Utilities/interface/thread_safety_macros.h"
0013 #include <atomic>
0014 
0015 class HcalDDDGeometryLoader;
0016 
0017 class HcalDDDGeometry : public CaloSubdetectorGeometry {
0018 public:
0019   friend class HcalDDDGeometryLoader;
0020 
0021   typedef std::vector<IdealObliquePrism> HBCellVec;
0022   typedef std::vector<IdealObliquePrism> HECellVec;
0023   typedef std::vector<IdealObliquePrism> HOCellVec;
0024   typedef std::vector<IdealZPrism> HFCellVec;
0025 
0026   explicit HcalDDDGeometry(const HcalTopology& theTopo);
0027   /// The HcalDDDGeometry will delete all its cell geometries at destruction time
0028   ~HcalDDDGeometry() override;
0029 
0030   const std::vector<DetId>& getValidDetIds(DetId::Detector det = DetId::Detector(0), int subdet = 0) const override;
0031 
0032   DetId getClosestCell(const GlobalPoint& r) const override;
0033 
0034   int insertCell(std::vector<HcalCellType> const&);
0035 
0036   void newCell(const GlobalPoint& f1,
0037                const GlobalPoint& f2,
0038                const GlobalPoint& f3,
0039                const CCGFloat* parm,
0040                const DetId& detId) override;
0041 
0042 protected:
0043   // Modify the RawPtr class
0044   const CaloCellGeometry* getGeometryRawPtr(uint32_t index) const override;
0045 
0046 private:
0047   void newCellImpl(
0048       const GlobalPoint& f1, const GlobalPoint& f2, const GlobalPoint& f3, const CCGFloat* parm, const DetId& detId);
0049 
0050   //can only be used by friend classes, to ensure sorting is done at the end
0051   void newCellFast(
0052       const GlobalPoint& f1, const GlobalPoint& f2, const GlobalPoint& f3, const CCGFloat* parm, const DetId& detId);
0053 
0054   void increaseReserve(unsigned int extra);
0055   void sortValidIds();
0056 
0057   void fillDetIds() const;
0058 
0059   std::vector<HcalCellType> hcalCells_;
0060   CMS_THREAD_GUARD(m_filledDetIds) mutable std::vector<DetId> m_hbIds;
0061   CMS_THREAD_GUARD(m_filledDetIds) mutable std::vector<DetId> m_heIds;
0062   CMS_THREAD_GUARD(m_filledDetIds) mutable std::vector<DetId> m_hoIds;
0063   CMS_THREAD_GUARD(m_filledDetIds) mutable std::vector<DetId> m_hfIds;
0064   CMS_THREAD_GUARD(m_filledDetIds) mutable std::vector<DetId> m_emptyIds;
0065 
0066   const HcalTopology& topo_;
0067   double etaMax_;
0068 
0069   HBCellVec m_hbCellVec;
0070   HECellVec m_heCellVec;
0071   HOCellVec m_hoCellVec;
0072   HFCellVec m_hfCellVec;
0073   mutable std::atomic<bool> m_filledDetIds;
0074 };
0075 
0076 #endif