File indexing completed on 2024-04-06 12:22:29
0001 #ifndef MagneticField_GeomBuilder_BaseVolumeHandle_H
0002 #define MagneticField_GeomBuilder_BaseVolumeHandle_H
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #include "DataFormats/GeometrySurface/interface/Surface.h"
0014 #include "DataFormats/GeometrySurface/interface/ReferenceCounted.h"
0015 #include "DetectorDescription/Core/interface/DDSolidShapes.h"
0016 #include "MagneticField/VolumeGeometry/interface/VolumeSide.h"
0017
0018 class MagVolume6Faces;
0019
0020 namespace magneticfield {
0021
0022 class BaseVolumeHandle {
0023 public:
0024 typedef Surface::GlobalPoint GlobalPoint;
0025 typedef Surface::LocalPoint LocalPoint;
0026 typedef Surface::LocalVector LocalVector;
0027 typedef SurfaceOrientation::GlobalFace Sides;
0028
0029 BaseVolumeHandle(bool expand2Pi = false, bool debugVal = false);
0030
0031
0032
0033 BaseVolumeHandle(const BaseVolumeHandle& v) = delete;
0034
0035 virtual ~BaseVolumeHandle();
0036
0037
0038 const GlobalPoint& center() const;
0039
0040
0041 const double RN() const { return theRN; }
0042
0043
0044 const Surface& surface(int which_side) const;
0045
0046 const Surface& surface(Sides which_side) const;
0047
0048
0049 bool sameSurface(const Surface& s1, Sides which_side, float tolerance = 0.01);
0050
0051
0052 bool setSurface(const Surface& s1, Sides which_side);
0053
0054
0055 bool isPlaneMatched(int which_side) const { return isAssigned[which_side]; }
0056
0057 int references(int which_side) const {
0058
0059 return 0;
0060 }
0061
0062
0063 std::string name;
0064
0065
0066 std::string magFile;
0067
0068
0069 unsigned short volumeno;
0070
0071
0072 unsigned short copyno;
0073
0074
0075
0076
0077
0078
0079
0080 Geom::Phi<float> minPhi() const { return thePhiMin; }
0081
0082
0083
0084
0085 Geom::Phi<float> maxPhi() const { return surface(SurfaceOrientation::phiplus).position().phi(); }
0086
0087
0088
0089
0090 double minZ() const { return surface(SurfaceOrientation::zminus).position().z(); }
0091 double maxZ() const { return surface(SurfaceOrientation::zplus).position().z(); }
0092
0093
0094 double minR() const { return theRMin; }
0095
0096
0097 const GloballyPositioned<float>* placement() const { return refPlane; }
0098
0099
0100 virtual std::vector<VolumeSide> sides() const = 0;
0101
0102
0103 MagVolume6Faces* magVolume;
0104
0105 bool toExpand() const { return expand; }
0106
0107
0108 bool isIron() const { return isIronFlag; }
0109
0110
0111 int masterSector;
0112
0113
0114 virtual DDSolidShape shape() const = 0;
0115
0116 protected:
0117 typedef ConstReferenceCountingPointer<Surface> RCPS;
0118
0119
0120 RCPS surfaces[6];
0121
0122 bool isAssigned[6];
0123
0124
0125 void buildPhiZSurf(double startPhi, double deltaPhi, double zhalf, double rCentr);
0126
0127
0128 double theRN;
0129
0130
0131
0132 double theRMin;
0133 double theRMax;
0134 Geom::Phi<float> thePhiMin;
0135
0136
0137
0138
0139 GloballyPositioned<float>* refPlane;
0140
0141
0142 GlobalPoint center_;
0143
0144
0145
0146 bool expand;
0147
0148
0149 bool isIronFlag;
0150
0151 const bool debug;
0152 };
0153
0154 typedef std::vector<BaseVolumeHandle*> handles;
0155
0156
0157
0158
0159 struct ExtractZ {
0160 double operator()(const BaseVolumeHandle* v) const { return v->center().z(); }
0161 };
0162
0163
0164 struct ExtractAbsZ {
0165 double operator()(const BaseVolumeHandle* v) const { return fabs(v->center().z()); }
0166 };
0167
0168
0169 struct ExtractPhi {
0170 double operator()(const BaseVolumeHandle* v) const {
0171
0172
0173 return v->center().phi();
0174 }
0175 };
0176
0177
0178 struct ExtractPhiMax {
0179 double operator()(const BaseVolumeHandle* v) const {
0180
0181
0182 return v->maxPhi();
0183 }
0184 };
0185
0186
0187 struct ExtractR {
0188 double operator()(const BaseVolumeHandle* v) const { return v->center().perp(); }
0189 };
0190
0191
0192 struct ExtractRN {
0193 double operator()(const BaseVolumeHandle* v) const { return v->RN(); }
0194 };
0195
0196
0197
0198
0199
0200 struct LessDPhi {
0201 bool operator()(double phi1, double phi2) const {
0202
0203 return ((Geom::Phi<float>(phi2) - Geom::Phi<float>(phi1)) > 0.);
0204 }
0205 };
0206
0207
0208
0209
0210 struct LessZ {
0211 bool operator()(const BaseVolumeHandle* v1, const BaseVolumeHandle* v2) const {
0212 if (v1->center().z() < v2->center().z())
0213 return true;
0214 return false;
0215 }
0216 };
0217
0218 inline const char* const newln = "\n";
0219
0220
0221
0222 }
0223
0224 #endif