Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef GEOMETRY_ECALGEOMETRYLOADER_H
0002 #define GEOMETRY_ECALGEOMETRYLOADER_H
0003 
0004 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
0005 #include "CondFormats/Alignment/interface/Alignments.h"
0006 #include "DetectorDescription/Core/interface/DDCompactView.h"
0007 #include "DetectorDescription/Core/interface/DDFilteredView.h"
0008 #include "DetectorDescription/DDCMS/interface/DDCompactView.h"
0009 #include "DetectorDescription/DDCMS/interface/DDFilteredView.h"
0010 
0011 #include "DD4hep/DD4hepUnits.h"
0012 #include "CLHEP/Geometry/Transform3D.h"
0013 #include <string>
0014 #include <vector>
0015 
0016 /** \class CaloGeometryLoader<T>
0017  *
0018  * Templated class for calo subdetector geometry loaders either from DDD or DD4hep.
0019 */
0020 
0021 template <class T>
0022 class CaloGeometryLoader {
0023 public:
0024   using ParmVec = std::vector<double>;
0025   using PtrType = std::unique_ptr<CaloSubdetectorGeometry>;
0026   using ParVec = CaloSubdetectorGeometry::ParVec;
0027   using ParVecVec = CaloSubdetectorGeometry::ParVecVec;
0028 
0029   static constexpr double k_ScaleFromDDD = 0.1;
0030   static constexpr double k_ScaleFromDD4hep = (1.0 / dd4hep::cm);
0031 
0032   virtual ~CaloGeometryLoader() = default;
0033 
0034   CaloGeometryLoader() = default;
0035 
0036   PtrType load(const DDCompactView* cpv, const Alignments* alignments = nullptr, const Alignments* globals = nullptr);
0037   PtrType load(const cms::DDCompactView* cpv,
0038                const Alignments* alignments = nullptr,
0039                const Alignments* globals = nullptr);
0040 
0041 private:
0042   void makeGeometry(const DDCompactView* cpv, T* geom, const Alignments* alignments, const Alignments* globals);
0043   void makeGeometry(const cms::DDCompactView* cpv, T* geom, const Alignments* alignments, const Alignments* globals);
0044 
0045   void fillNamedParams(const DDFilteredView& fv, T* geom);
0046   void fillNamedParams(const cms::DDFilteredView& fv, T* geom);
0047 
0048   void fillGeom(T* geom, const ParmVec& pv, const HepGeom::Transform3D& tr, const DetId& id, const double& scale);
0049 
0050   unsigned int getDetIdForDDDNode(const DDFilteredView& fv);
0051   unsigned int getDetIdForDD4hepNode(const cms::DDFilteredView& fv);
0052 
0053   typename T::NumberingScheme m_scheme;
0054 };
0055 
0056 #endif