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 
35  class MagGeoBuilder {
36  public:
37  MagGeoBuilder(std::string tableSet, int geometryVersion, bool debug = false);
38 
40 
41  // Build the geometry.
42  void build(const cms::DDDetector* det);
43 
47  void setScaling(const std::vector<int>& keys, const std::vector<double>& values);
48 
49  void setGridFiles(const TableFileMap& gridFiles);
50 
52  std::vector<MagBLayer*> barrelLayers() const;
53 
55  std::vector<MagESector*> endcapSectors() const;
56 
57  float maxR() const;
58 
59  float maxZ() const;
60 
61  std::vector<MagVolume6Faces*> barrelVolumes() const;
62  std::vector<MagVolume6Faces*> endcapVolumes() const;
63 
64  private:
65  // Build interpolator for the volume with "correct" rotation
66  void buildInterpolator(const volumeHandle* vol, std::map<std::string, MagProviderInterpol*>& interpolators);
67 
68  // Build all MagVolumes setting the MagProviderInterpol
69  void buildMagVolumes(const handles& volumes, std::map<std::string, MagProviderInterpol*>& interpolators);
70 
71  // Print checksums for surfaces.
72  void summary(handles& volumes) const;
73 
74  // Perform simple sanity checks
75  void testInside(handles& volumes);
76 
77  handles bVolumes_; // the barrel volumes.
78  handles eVolumes_; // the endcap volumes.
79 
80  std::vector<MagBLayer*> mBLayers_; // Finally built barrel geometry
81  std::vector<MagESector*> mESectors_; // Finally built barrel geometry
82 
83  std::string tableSet_; // Version of the data files to be used
84  int geometryVersion_; // Version of MF geometry
85 
86  std::map<int, double> theScalingFactors_;
87  const TableFileMap* theGridFiles_; // Non-owned pointer assumed to be valid until build() is called
88 
89  const bool debug_;
90  };
91 } // namespace magneticfield
92 #endif
void buildInterpolator(const volumeHandle *vol, std::map< std::string, MagProviderInterpol *> &interpolators)
std::vector< MagBLayer * > barrelLayers() const
Get barrel layers.
void summary(handles &volumes) const
std::vector< MagESector * > mESectors_
std::vector< MagBLayer * > mBLayers_
std::vector< BaseVolumeHandle * > handles
MagGeoBuilder(std::string tableSet, int geometryVersion, bool debug=false)
void buildMagVolumes(const handles &volumes, std::map< std::string, MagProviderInterpol *> &interpolators)
const TableFileMap * theGridFiles_
void setGridFiles(const TableFileMap &gridFiles)
#define debug
Definition: HDRShower.cc:19
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
void testInside(handles &volumes)