CMS 3D CMS Logo

MagGeoBuilderFromDDD.h
Go to the documentation of this file.
1 #ifndef MagGeoBuilderFromDDD_H
2 #define MagGeoBuilderFromDDD_H
3 
13 
16 
17 #include <string>
18 #include <vector>
19 #include <map>
20 #include <memory>
21 
22 class Surface;
23 class MagBLayer;
24 class MagESector;
25 class MagVolume6Faces;
26 namespace magneticfield {
30 }
31 
32 
34 public:
36  MagGeoBuilderFromDDD(std::string tableSet_, int geometryVersion, bool debug=false);
37 
39  virtual ~MagGeoBuilderFromDDD();
40 
44  void setScaling(const std::vector<int>& keys, const std::vector<double>& values);
45 
46  void setGridFiles(const magneticfield::TableFileMap& gridFiles);
47 
49  std::vector<MagBLayer*> barrelLayers() const;
50 
52  std::vector<MagESector*> endcapSectors() const;
53 
54  float maxR() const;
55 
56  float maxZ() const;
57 
58 private:
60 
61  // Build the geometry.
62  //virtual void build();
63  virtual void build(const DDCompactView & cpv);
64 
65 
66  // FIXME: only for temporary tests and debug, to be removed
67  friend class TestMagVolume;
68  friend class MagGeometry;
72 
73 
74  std::vector<MagVolume6Faces*> barrelVolumes() const;
75  std::vector<MagVolume6Faces*> endcapVolumes() const;
76 
77  // Temporary container to manipulate volumes and their surfaces.
78  class volumeHandle;
79  typedef std::vector<volumeHandle*> handles;
80 
81  // Build interpolator for the volume with "correct" rotation
82  void buildInterpolator(const volumeHandle * vol,
83  std::map<std::string, MagProviderInterpol*>& interpolators);
84 
85  // Build all MagVolumes setting the MagProviderInterpol
86  void buildMagVolumes(const handles & volumes,
87  std::map<std::string, MagProviderInterpol*> & interpolators);
88 
89  // Print checksums for surfaces.
90  void summary(handles & volumes);
91 
92  // Perform simple sanity checks
93  void testInside(handles & volumes);
94 
95  // A layer of barrel volumes.
96  class bLayer;
97  // A sector of volumes in a layer.
98  class bSector;
99  // A rod of volumes in a sector.
100  class bRod;
101  // A slab of volumes in a rod.
102  class bSlab;
103  // A sector of endcap volumes.
104  class eSector;
105  // A layer of volumes in an endcap sector.
106  class eLayer;
107 
108 
109  // Extractors for precomputed_value_sort (to sort containers of volumeHandles).
110  typedef std::unary_function<const volumeHandle*, double> uFcn;
111  struct ExtractZ;
112  struct ExtractAbsZ;
113  struct ExtractPhi;
114  struct ExtractPhiMax;
115  struct ExtractR;
116  struct ExtractRN;
117  struct LessDPhi;
118  // This one to be used only for max_element and min_element
119  struct LessZ;
120 
121  handles bVolumes; // the barrel volumes.
122  handles eVolumes; // the endcap volumes.
123 
124  std::vector<MagBLayer*> mBLayers; // Finally built barrel geometry
125  std::vector<MagESector*> mESectors; // Finally built barrel geometry
126 
127  std::string tableSet; // Version of the data files to be used
128  int geometryVersion; // Version of MF geometry
129 
130  std::map<int, double> theScalingFactors;
131  const magneticfield::TableFileMap* theGridFiles; // Non-owned pointer assumed to be valid until build() is called
132 
133  static bool debug;
134 
135 };
136 #endif
std::vector< MagBLayer * > mBLayers
std::vector< volumeHandle * > handles
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:80
ConstReferenceCountingPointer< Surface > RCPS
const magneticfield::TableFileMap * theGridFiles
#define debug
Definition: HDRShower.cc:19
std::unary_function< const volumeHandle *, double > uFcn
std::vector< MagESector * > mESectors
std::map< int, std::pair< std::string, int > > TableFileMap
std::map< int, double > theScalingFactors