Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:22:30

0001 #ifndef MagneticField_GeomBuilder_DD4hep_volumeHandle_h
0002 #define MagneticField_GeomBuilder_DD4hep_volumeHandle_h
0003 
0004 /** \class volumeHandle
0005  * A temporary container to cache info on a six-surface volume during
0006  * the processing. Used to sort, organise, and build shared planes.
0007  * One instance is created for each volume. The parameters of the 
0008  * boundary surfaces are calculated during construction.
0009  *
0010  *  \author N. Amapane - INFN Torino (original developer)
0011  */
0012 
0013 #include "BaseVolumeHandle.h"
0014 
0015 #include "DataFormats/GeometrySurface/interface/Surface.h"
0016 #include "DetectorDescription/DDCMS/interface/DDFilteredView.h"
0017 #include "MagneticField/VolumeGeometry/interface/VolumeSide.h"
0018 
0019 namespace magneticfield {
0020 
0021   typedef const char* ShapeType;
0022 
0023   class volumeHandle : public BaseVolumeHandle {
0024   public:
0025     volumeHandle(const cms::DDFilteredView& fv, bool expand2Pi = false, bool debugVal = false);
0026 
0027     // Disallow Default/copy ctor & assignment op.
0028     // (we want to handle only pointers!!!)
0029     volumeHandle(const volumeHandle& v) = delete;
0030     volumeHandle operator=(const volumeHandle& v) = delete;
0031 
0032     // Shape at initialization
0033     DDSolidShape shape() const override { return (theShape); }
0034 
0035     /// The surfaces and they orientation, as required to build a MagVolume.
0036     std::vector<VolumeSide> sides() const override;
0037 
0038   private:
0039     // initialise the refPlane
0040     void referencePlane(const cms::DDFilteredView& fv);
0041 
0042     // Build the surfaces for a box
0043     void buildBox(double halfX, double halfY, double halfZ);
0044     // Build the surfaces for a trapezoid
0045     void buildTrap(double x1,
0046                    double x2,
0047                    double x3,
0048                    double x4,
0049                    double y1,
0050                    double y2,
0051                    double theta,
0052                    double phi,
0053                    double halfZ,
0054                    double alpha1,
0055                    double alpha2);
0056     // Build the surfaces for a ddtubs shape
0057     void buildTubs(double zhalf, double rIn, double rOut, double startPhi, double deltaPhi);
0058     // Build the surfaces for a ddcons shape
0059     void buildCons(double zhalf,
0060                    double rInMinusZ,
0061                    double rOutMinusZ,
0062                    double rInPlusZ,
0063                    double rOutPlusZ,
0064                    double startPhi,
0065                    double deltaPhi);
0066     // Build the surfaces for a ddpseudotrap. This is not a supported
0067     // shape in DD4hep; it is handled here to cope with legacy geometries.
0068     void buildPseudoTrap(double x1, double x2, double y1, double y2, double halfZ, double radius, bool atMinusZ);
0069     // Build the surfaces for a ddtrunctubs shape
0070     void buildTruncTubs(double zhalf,
0071                         double rIn,
0072                         double rOut,
0073                         double startPhi,
0074                         double deltaPhi,
0075                         double cutAtStart,
0076                         double cutAtDelta,
0077                         bool cutInside);
0078 
0079     // Shape at initialization
0080     const DDSolidShape theShape;
0081     const cms::DDFilteredView& solid;
0082     // "solid" name is for backwards compatibility. Can be changed to "fview" after DD4hep migration.
0083   };
0084 }  // namespace magneticfield
0085 
0086 #endif