Go to the documentation of this file.00001 #ifndef volumeHandle_H
00002 #define volumeHandle_H
00003
00015 #include "MagneticField/GeomBuilder/src/MagGeoBuilderFromDDD.h"
00016
00017
00018 #include "DetectorDescription/Core/interface/DDSolid.h"
00019 #include "DataFormats/GeometrySurface/interface/Surface.h"
00020
00021 #include "MagneticField/VolumeGeometry/interface/VolumeSide.h"
00022
00023 class DDExpandedView;
00024 class MagVolume6Faces;
00025
00026
00027 class MagGeoBuilderFromDDD::volumeHandle {
00028 public:
00029 typedef Surface::GlobalPoint GlobalPoint;
00030 typedef Surface::LocalPoint LocalPoint;
00031 typedef Surface::LocalVector LocalVector;
00032 typedef SurfaceOrientation::GlobalFace Sides;
00033 volumeHandle(const DDExpandedView & fv, bool expand2Pi=false);
00034 ~volumeHandle();
00035
00037 const GlobalPoint & center() const;
00039 const double RN() const {return theRN;}
00041 const Surface & surface(int which_side) const;
00042 const Surface & surface(Sides which_side) const;
00044 bool sameSurface(const Surface & s1, Sides which_side, float tolerance = 0.01);
00046 bool setSurface(const Surface & s1, Sides which_side);
00048 bool isPlaneMatched(int which_side) const {
00049 return isAssigned[which_side];
00050 }
00051
00052 int references(int which_side) const {
00053
00054 return 0;
00055 }
00056
00058 std::string name;
00060 std::string magFile;
00062 int copyno;
00063
00065 static void printUniqueNames(handles::const_iterator begin,
00066 handles::const_iterator end);
00067
00068
00069
00070
00071
00073
00074
00075 Geom::Phi<float> minPhi() const {return thePhiMin;}
00077
00078
00079 Geom::Phi<float> maxPhi() const {return surface(SurfaceOrientation::phiplus).position().phi();}
00080
00082
00083
00084 double minZ() const {return surface(SurfaceOrientation::zminus).position().z();}
00085 double maxZ() const {return surface(SurfaceOrientation::zplus).position().z();}
00086
00088 double minR() const {return theRMin;}
00089
00091
00092
00094 const GloballyPositioned<float> * placement() const {return refPlane;}
00095
00097 DDSolidShape shape() const {return solid.shape();}
00098
00100 std::vector<VolumeSide> sides() const;
00101
00103 MagVolume6Faces* magVolume;
00104
00105 bool toExpand() const {return expand;}
00106
00108 bool isIron() const{return isIronFlag;}
00109
00111 int masterSector;
00112
00113 private:
00114
00115
00116 volumeHandle(const volumeHandle& v);
00117 volumeHandle operator=(const volumeHandle &v);
00118
00119
00120 RCPS surfaces[6];
00121
00122 bool isAssigned[6];
00123
00124
00125 void referencePlane(const DDExpandedView &fv);
00126
00127 void buildBox(const DDExpandedView & fv);
00128
00129 void buildTrap(const DDExpandedView & fv);
00130
00131 void buildTubs(const DDExpandedView & fv);
00132
00133 void buildCons(const DDExpandedView & fv);
00134
00135 void buildPseudoTrap(const DDExpandedView & fv);
00136
00137 void buildTruncTubs(const DDExpandedView & fv);
00138
00139
00140 void buildPhiZSurf(double startPhi, double deltaPhi, double zhalf,
00141 double rCentr);
00142
00143
00144 double theRN;
00145
00146
00147
00148 double theRMin;
00149 double theRMax;
00150 Geom::Phi<float> thePhiMin;
00151
00152
00153
00154
00155 GloballyPositioned<float> * refPlane;
00156
00157
00158 DDSolid solid;
00159
00160
00161 GlobalPoint center_;
00162
00163
00164
00165 bool expand;
00166
00167
00168 bool isIronFlag;
00169
00170 };
00171
00172
00173
00174
00175
00176 struct MagGeoBuilderFromDDD::ExtractZ : public uFcn {
00177 double operator()(const volumeHandle* v) const {
00178 return v->center().z();
00179 }
00180 };
00181
00182
00183 struct MagGeoBuilderFromDDD::ExtractAbsZ : public uFcn {
00184 double operator()(const volumeHandle* v) const {
00185 return fabs(v->center().z());
00186 }
00187 };
00188
00189
00190
00191 struct MagGeoBuilderFromDDD::ExtractPhi : public uFcn {
00192 double operator()(const volumeHandle* v) const {
00193
00194
00195 return v->center().phi();
00196 }
00197 };
00198
00199
00200 struct MagGeoBuilderFromDDD::ExtractPhiMax : public uFcn {
00201 double operator()(const volumeHandle* v) const {
00202
00203
00204 return v->maxPhi();
00205 }
00206 };
00207
00208
00209 struct MagGeoBuilderFromDDD::ExtractR : public uFcn {
00210 double operator()(const volumeHandle* v) const {
00211 return v->center().perp();
00212 }
00213 };
00214
00215
00216 struct MagGeoBuilderFromDDD::ExtractRN : public uFcn {
00217 double operator()(const volumeHandle* v) const {
00218 return v->RN();
00219 }
00220 };
00221
00222
00223
00224
00225
00226
00227 struct MagGeoBuilderFromDDD::LessDPhi{
00228 bool operator()(double phi1, double phi2) const {
00229
00230 return ((Geom::Phi<float>(phi2)-Geom::Phi<float>(phi1))>0.);
00231 }
00232 };
00233
00234
00235
00236
00237 struct MagGeoBuilderFromDDD::LessZ{
00238 bool operator()(const volumeHandle * v1, const volumeHandle * v2) const
00239 {
00240 if (v1->center().z() < v2->center().z()) return true;
00241 return false;
00242 }
00243 };
00244
00245 #endif
00246