CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
MagGeoBuilderFromDDD.h
Go to the documentation of this file.
1 #ifndef MagGeoBuilderFromDDD_H
2 #define MagGeoBuilderFromDDD_H
3 
12 
15 
16 #include <string>
17 #include <vector>
18 #include <map>
19 #include <memory>
20 
21 class Surface;
22 class MagBLayer;
23 class MagESector;
24 class MagVolume6Faces;
25 namespace magneticfield {
28  class BaseVolumeHandle; // Needs to be public to share code with DD4hep
29  using handles = std::vector<BaseVolumeHandle*>;
30 } // namespace magneticfield
31 
33 public:
35  MagGeoBuilderFromDDD(std::string tableSet_, int geometryVersion, bool debug = false);
36 
38  virtual ~MagGeoBuilderFromDDD();
39 
43  void setScaling(const std::vector<int>& keys, const std::vector<double>& values);
44 
45  void setGridFiles(const magneticfield::TableFileMap& gridFiles);
46 
48  std::vector<MagBLayer*> barrelLayers() const;
49 
51  std::vector<MagESector*> endcapSectors() const;
52 
53  float maxR() const;
54 
55  float maxZ() const;
56 
57  // Temporary container to manipulate volumes and their surfaces.
58  class volumeHandle; // Needs to be public to share code with DD4hep
59 
60 private:
61  // Build the geometry.
62  //virtual void build();
63  virtual void build(const DDCompactView& cpv);
64 
65  // FIXME: only for temporary tests and debug, to be removed
66  friend class TestMagVolume;
67  friend class MagGeometry;
70 
71  std::vector<MagVolume6Faces*> barrelVolumes() const;
72  std::vector<MagVolume6Faces*> endcapVolumes() const;
73 
74  // Build interpolator for the volume with "correct" rotation
75  void buildInterpolator(const volumeHandle* vol, std::map<std::string, MagProviderInterpol*>& interpolators);
76 
77  // Build all MagVolumes setting the MagProviderInterpol
78  void buildMagVolumes(const magneticfield::handles& volumes,
79  std::map<std::string, MagProviderInterpol*>& interpolators);
80 
81  // Print checksums for surfaces.
82  void summary(magneticfield::handles& volumes);
83 
84  // Perform simple sanity checks
85  void testInside(magneticfield::handles& volumes);
86 
87  magneticfield::handles bVolumes; // the barrel volumes.
88  magneticfield::handles eVolumes; // the endcap volumes.
89 
90  std::vector<MagBLayer*> mBLayers; // Finally built barrel geometry
91  std::vector<MagESector*> mESectors; // Finally built barrel geometry
92 
93  std::string tableSet; // Version of the data files to be used
94  int geometryVersion; // Version of MF geometry
95 
96  std::map<int, double> theScalingFactors;
97  const magneticfield::TableFileMap* theGridFiles; // Non-owned pointer assumed to be valid until build() is called
98 
99  const bool debug;
100 };
101 #endif
void summary(magneticfield::handles &volumes)
std::vector< MagBLayer * > mBLayers
magneticfield::handles eVolumes
std::vector< MagBLayer * > barrelLayers() const
Get barrel layers.
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
std::vector< MagVolume6Faces * > barrelVolumes() const
virtual ~MagGeoBuilderFromDDD()
Destructor.
virtual void build(const DDCompactView &cpv)
magneticfield::handles bVolumes
std::vector< BaseVolumeHandle * > handles
std::vector< MagESector * > endcapSectors() const
Get endcap layers.
MagGeoBuilderFromDDD(std::string tableSet_, int geometryVersion, bool debug=false)
Constructor.
const magneticfield::TableFileMap * theGridFiles
void buildInterpolator(const volumeHandle *vol, std::map< std::string, MagProviderInterpol * > &interpolators)
void buildMagVolumes(const magneticfield::handles &volumes, std::map< std::string, MagProviderInterpol * > &interpolators)
void setScaling(const std::vector< int > &keys, const std::vector< double > &values)
std::vector< MagVolume6Faces * > endcapVolumes() const
void testInside(magneticfield::handles &volumes)
std::vector< MagESector * > mESectors
std::map< int, std::pair< std::string, int > > TableFileMap
std::map< int, double > theScalingFactors
void setGridFiles(const magneticfield::TableFileMap &gridFiles)