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 unsigned short volumeno;
00064 unsigned short copyno;
00065
00067 static void printUniqueNames(handles::const_iterator begin,
00068 handles::const_iterator end);
00069
00070
00071
00072
00073
00075
00076
00077 Geom::Phi<float> minPhi() const {return thePhiMin;}
00079
00080
00081 Geom::Phi<float> maxPhi() const {return surface(SurfaceOrientation::phiplus).position().phi();}
00082
00084
00085
00086 double minZ() const {return surface(SurfaceOrientation::zminus).position().z();}
00087 double maxZ() const {return surface(SurfaceOrientation::zplus).position().z();}
00088
00090 double minR() const {return theRMin;}
00091
00093
00094
00096 const GloballyPositioned<float> * placement() const {return refPlane;}
00097
00099 DDSolidShape shape() const {return solid.shape();}
00100
00102 std::vector<VolumeSide> sides() const;
00103
00105 MagVolume6Faces* magVolume;
00106
00107 bool toExpand() const {return expand;}
00108
00110 bool isIron() const{return isIronFlag;}
00111
00113 int masterSector;
00114
00115 private:
00116
00117
00118 volumeHandle(const volumeHandle& v);
00119 volumeHandle operator=(const volumeHandle &v);
00120
00121
00122 RCPS surfaces[6];
00123
00124 bool isAssigned[6];
00125
00126
00127 void referencePlane(const DDExpandedView &fv);
00128
00129 void buildBox(const DDExpandedView & fv);
00130
00131 void buildTrap(const DDExpandedView & fv);
00132
00133 void buildTubs(const DDExpandedView & fv);
00134
00135 void buildCons(const DDExpandedView & fv);
00136
00137 void buildPseudoTrap(const DDExpandedView & fv);
00138
00139 void buildTruncTubs(const DDExpandedView & fv);
00140
00141
00142 void buildPhiZSurf(double startPhi, double deltaPhi, double zhalf,
00143 double rCentr);
00144
00145
00146 double theRN;
00147
00148
00149
00150 double theRMin;
00151 double theRMax;
00152 Geom::Phi<float> thePhiMin;
00153
00154
00155
00156
00157 GloballyPositioned<float> * refPlane;
00158
00159
00160 DDSolid solid;
00161
00162
00163 GlobalPoint center_;
00164
00165
00166
00167 bool expand;
00168
00169
00170 bool isIronFlag;
00171
00172 };
00173
00174
00175
00176
00177
00178 struct MagGeoBuilderFromDDD::ExtractZ : public uFcn {
00179 double operator()(const volumeHandle* v) const {
00180 return v->center().z();
00181 }
00182 };
00183
00184
00185 struct MagGeoBuilderFromDDD::ExtractAbsZ : public uFcn {
00186 double operator()(const volumeHandle* v) const {
00187 return fabs(v->center().z());
00188 }
00189 };
00190
00191
00192
00193 struct MagGeoBuilderFromDDD::ExtractPhi : public uFcn {
00194 double operator()(const volumeHandle* v) const {
00195
00196
00197 return v->center().phi();
00198 }
00199 };
00200
00201
00202 struct MagGeoBuilderFromDDD::ExtractPhiMax : public uFcn {
00203 double operator()(const volumeHandle* v) const {
00204
00205
00206 return v->maxPhi();
00207 }
00208 };
00209
00210
00211 struct MagGeoBuilderFromDDD::ExtractR : public uFcn {
00212 double operator()(const volumeHandle* v) const {
00213 return v->center().perp();
00214 }
00215 };
00216
00217
00218 struct MagGeoBuilderFromDDD::ExtractRN : public uFcn {
00219 double operator()(const volumeHandle* v) const {
00220 return v->RN();
00221 }
00222 };
00223
00224
00225
00226
00227
00228
00229 struct MagGeoBuilderFromDDD::LessDPhi{
00230 bool operator()(double phi1, double phi2) const {
00231
00232 return ((Geom::Phi<float>(phi2)-Geom::Phi<float>(phi1))>0.);
00233 }
00234 };
00235
00236
00237
00238
00239 struct MagGeoBuilderFromDDD::LessZ{
00240 bool operator()(const volumeHandle * v1, const volumeHandle * v2) const
00241 {
00242 if (v1->center().z() < v2->center().z()) return true;
00243 return false;
00244 }
00245 };
00246
00247 #endif
00248