00001 #ifndef MagGeoBuilderFromDDD_H 00002 #define MagGeoBuilderFromDDD_H 00003 00013 #include "DataFormats/GeometrySurface/interface/ReferenceCounted.h" 00014 #include "MagneticField/Interpolation/interface/MagProviderInterpol.h" 00015 00016 #include "DetectorDescription/Core/interface/DDCompactView.h" 00017 00018 #include <string> 00019 #include <vector> 00020 #include <map> 00021 00022 class Surface; 00023 class MagBLayer; 00024 class MagESector; 00025 class MagVolume6Faces; 00026 namespace magneticfield { 00027 class VolumeBasedMagneticFieldESProducer; 00028 class AutoMagneticFieldESProducer; 00029 } 00030 00031 00032 class MagGeoBuilderFromDDD { 00033 public: 00039 MagGeoBuilderFromDDD(std::string version_, bool debug=false, bool overrideMasterSector=false); 00040 00042 virtual ~MagGeoBuilderFromDDD(); 00043 00047 void setScaling(std::vector<int> keys, std::vector<double> values); 00048 00050 std::vector<MagBLayer*> barrelLayers() const; 00051 00053 std::vector<MagESector*> endcapSectors() const; 00054 00055 float maxR() const; 00056 00057 float maxZ() const; 00058 00059 private: 00060 typedef ConstReferenceCountingPointer<Surface> RCPS; 00061 00062 // Build the geometry. 00063 //virtual void build(); 00064 virtual void build(const DDCompactView & cpv); 00065 00066 00067 // FIXME: only for temporary tests and debug, to be removed 00068 friend class TestMagVolume; 00069 friend class MagGeometry; 00070 friend class magneticfield::VolumeBasedMagneticFieldESProducer; 00071 friend class magneticfield::AutoMagneticFieldESProducer; 00072 00073 00074 std::vector<MagVolume6Faces*> barrelVolumes() const; 00075 std::vector<MagVolume6Faces*> endcapVolumes() const; 00076 00077 // Temporary container to manipulate volumes and their surfaces. 00078 class volumeHandle; 00079 typedef std::vector<volumeHandle*> handles; 00080 00081 // Build interpolator for the volume with "correct" rotation 00082 void buildInterpolator(const volumeHandle * vol, 00083 std::map<std::string, MagProviderInterpol*>& interpolators); 00084 00085 // Build all MagVolumes setting the MagProviderInterpol 00086 void buildMagVolumes(const handles & volumes, 00087 std::map<std::string, MagProviderInterpol*> & interpolators); 00088 00089 // Print checksums for surfaces. 00090 void summary(handles & volumes); 00091 00092 // Perform simple sanity checks 00093 void testInside(handles & volumes); 00094 00095 // A layer of barrel volumes. 00096 class bLayer; 00097 // A sector of volumes in a layer. 00098 class bSector; 00099 // A rod of volumes in a sector. 00100 class bRod; 00101 // A slab of volumes in a rod. 00102 class bSlab; 00103 // A sector of endcap volumes. 00104 class eSector; 00105 // A layer of volumes in an endcap sector. 00106 class eLayer; 00107 00108 00109 // Extractors for precomputed_value_sort (to sort containers of volumeHandles). 00110 typedef std::unary_function<const volumeHandle*, double> uFcn; 00111 struct ExtractZ; 00112 struct ExtractAbsZ; 00113 struct ExtractPhi; 00114 struct ExtractPhiMax; 00115 struct ExtractR; 00116 struct ExtractRN; 00117 struct LessDPhi; 00118 // This one to be used only for max_element and min_element 00119 struct LessZ; 00120 00121 handles bVolumes; // the barrel volumes. 00122 handles eVolumes; // the endcap volumes. 00123 00124 std::vector<MagBLayer*> mBLayers; // Finally built barrel geometry 00125 std::vector<MagESector*> mESectors; // Finally built barrel geometry 00126 00127 std::string version; // Version of the data files to be used 00128 00129 std::map<int, double> theScalingFactors; 00130 00131 bool overrideMasterSector; // see comment on ctor 00132 00133 static bool debug; 00134 00135 }; 00136 #endif