CMS 3D CMS Logo

DD4hep_MagGeoBuilder.h
Go to the documentation of this file.
1 #ifndef MagneticField_GeomBuilder_DD4hep_MagGeoBuilder_h
2 #define MagneticField_GeomBuilder_DD4hep_MagGeoBuilder_h
3 
17 #include "DD4hep_volumeHandle.h"
18 
19 #include <string>
20 #include <vector>
21 #include <map>
22 #include <memory>
23 
24 namespace dd4hep {
25  class Detector;
26 }
27 
28 class Surface;
29 class MagBLayer;
30 class MagESector;
31 class MagVolume6Faces;
32 
33 namespace magneticfield {
34  class InterpolatorBuilder;
35 
36  class MagGeoBuilder {
37  public:
38  MagGeoBuilder(std::string tableSet, int geometryVersion, bool debug = false, bool useMergeFileIfAvailable = true);
39 
41 
42  // Build the geometry.
43  void build(const cms::DDDetector* det);
44 
48  void setScaling(const std::vector<int>& keys, const std::vector<double>& values);
49 
50  void setGridFiles(const TableFileMap& gridFiles);
51 
53  std::vector<MagBLayer*> barrelLayers() const;
54 
56  std::vector<MagESector*> endcapSectors() const;
57 
58  float maxR() const;
59 
60  float maxZ() const;
61 
62  std::vector<MagVolume6Faces*> barrelVolumes() const;
63  std::vector<MagVolume6Faces*> endcapVolumes() const;
64 
65  private:
66  // Build interpolator for the volume with "correct" rotation
68 
69  // Build all MagVolumes setting the MagProviderInterpol
70  void buildMagVolumes(const handles& volumes,
71  const std::map<std::string, MagProviderInterpol*>& interpolators) const;
72 
73  // Print checksums for surfaces.
74  void summary(handles& volumes) const;
75 
76  // Perform simple sanity checks
77  void testInside(handles& volumes) const;
78 
79  handles bVolumes_; // the barrel volumes.
80  handles eVolumes_; // the endcap volumes.
81 
82  std::vector<MagBLayer*> mBLayers_; // Finally built barrel geometry
83  std::vector<MagESector*> mESectors_; // Finally built barrel geometry
84 
85  std::string tableSet_; // Version of the data files to be used
86  int geometryVersion_; // Version of MF geometry
87 
88  std::map<int, double> theScalingFactors_;
89  const TableFileMap* theGridFiles_; // Non-owned pointer assumed to be valid until build() is called
90 
91  const bool debug_;
93  };
94 } // namespace magneticfield
95 #endif
void buildMagVolumes(const handles &volumes, const std::map< std::string, MagProviderInterpol *> &interpolators) const
std::vector< MagBLayer * > barrelLayers() const
Get barrel layers.
void summary(handles &volumes) const
MagGeoBuilder(std::string tableSet, int geometryVersion, bool debug=false, bool useMergeFileIfAvailable=true)
std::vector< MagESector * > mESectors_
std::vector< MagBLayer * > mBLayers_
std::vector< BaseVolumeHandle * > handles
MagProviderInterpol * buildInterpolator(const volumeHandle *vol, InterpolatorBuilder &) const
const TableFileMap * theGridFiles_
void setGridFiles(const TableFileMap &gridFiles)
#define debug
Definition: HDRShower.cc:19
void testInside(handles &volumes) const
std::vector< MagESector * > endcapSectors() const
Get endcap layers.
std::map< int, double > theScalingFactors_
std::vector< MagVolume6Faces * > barrelVolumes() const
void build(const cms::DDDetector *det)
void setScaling(const std::vector< int > &keys, const std::vector< double > &values)
std::map< int, std::pair< std::string, int > > TableFileMap
std::vector< MagVolume6Faces * > endcapVolumes() const