CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MagGeoBuilderFromDDD.h
Go to the documentation of this file.
1 #ifndef MagGeoBuilderFromDDD_H
2 #define MagGeoBuilderFromDDD_H
3 
13 
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 
29  typedef std::map<unsigned, std::pair<std::string, int> > TableFileMap;
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 std::auto_ptr<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;
71 
72 
73  std::vector<MagVolume6Faces*> barrelVolumes() const;
74  std::vector<MagVolume6Faces*> endcapVolumes() const;
75 
76  // Temporary container to manipulate volumes and their surfaces.
77  class volumeHandle;
78  typedef std::vector<volumeHandle*> handles;
79 
80  // Build interpolator for the volume with "correct" rotation
81  void buildInterpolator(const volumeHandle * vol,
82  std::map<std::string, MagProviderInterpol*>& interpolators);
83 
84  // Build all MagVolumes setting the MagProviderInterpol
85  void buildMagVolumes(const handles & volumes,
86  std::map<std::string, MagProviderInterpol*> & interpolators);
87 
88  // Print checksums for surfaces.
89  void summary(handles & volumes);
90 
91  // Perform simple sanity checks
92  void testInside(handles & volumes);
93 
94  // A layer of barrel volumes.
95  class bLayer;
96  // A sector of volumes in a layer.
97  class bSector;
98  // A rod of volumes in a sector.
99  class bRod;
100  // A slab of volumes in a rod.
101  class bSlab;
102  // A sector of endcap volumes.
103  class eSector;
104  // A layer of volumes in an endcap sector.
105  class eLayer;
106 
107 
108  // Extractors for precomputed_value_sort (to sort containers of volumeHandles).
109  typedef std::unary_function<const volumeHandle*, double> uFcn;
110  struct ExtractZ;
111  struct ExtractAbsZ;
112  struct ExtractPhi;
113  struct ExtractPhiMax;
114  struct ExtractR;
115  struct ExtractRN;
116  struct LessDPhi;
117  // This one to be used only for max_element and min_element
118  struct LessZ;
119 
120  handles bVolumes; // the barrel volumes.
121  handles eVolumes; // the endcap volumes.
122 
123  std::vector<MagBLayer*> mBLayers; // Finally built barrel geometry
124  std::vector<MagESector*> mESectors; // Finally built barrel geometry
125 
126  std::string tableSet; // Version of the data files to be used
127  int geometryVersion; // Version of MF geometry
128 
129  std::map<int, double> theScalingFactors;
130  std::auto_ptr<magneticfield::TableFileMap> theGridFiles;
131 
132  static bool debug;
133 
134 };
135 #endif
std::vector< MagBLayer * > mBLayers
std::vector< volumeHandle * > handles
std::vector< MagBLayer * > barrelLayers() const
Get barrel layers.
type of data representation of DDCompactView
Definition: DDCompactView.h:77
void summary(handles &volumes)
std::vector< MagVolume6Faces * > barrelVolumes() const
virtual ~MagGeoBuilderFromDDD()
Destructor.
virtual void build(const DDCompactView &cpv)
ConstReferenceCountingPointer< Surface > RCPS
void testInside(handles &volumes)
std::vector< MagESector * > endcapSectors() const
Get endcap layers.
MagGeoBuilderFromDDD(std::string tableSet_, int geometryVersion, bool debug=false)
Constructor.
void buildInterpolator(const volumeHandle *vol, std::map< std::string, MagProviderInterpol * > &interpolators)
void setScaling(const std::vector< int > &keys, const std::vector< double > &values)
std::vector< MagVolume6Faces * > endcapVolumes() const
std::unary_function< const volumeHandle *, double > uFcn
std::vector< MagESector * > mESectors
std::map< int, double > theScalingFactors
void setGridFiles(const std::auto_ptr< magneticfield::TableFileMap > gridFiles)
std::auto_ptr< magneticfield::TableFileMap > theGridFiles
void buildMagVolumes(const handles &volumes, std::map< std::string, MagProviderInterpol * > &interpolators)
std::map< unsigned, std::pair< std::string, int > > TableFileMap