File indexing completed on 2023-10-25 09:50:14
0001 #include "Geometry/TrackerNumberingBuilder/interface/TrackerShapeToBounds.h"
0002 #include "DataFormats/GeometrySurface/interface/OpenBounds.h"
0003 #include "DataFormats/GeometrySurface/interface/RectangularPlaneBounds.h"
0004 #include "DataFormats/GeometrySurface/interface/TrapezoidalPlaneBounds.h"
0005 #include "CLHEP/Units/GlobalSystemOfUnits.h"
0006 #include <algorithm>
0007 #include <iostream>
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032 Bounds* TrackerShapeToBounds::buildBounds(const cms::DDSolidShape& shape, const std::vector<double>& par) const {
0033 switch (shape) {
0034 case cms::DDSolidShape::ddbox:
0035 return buildBox(par);
0036 break;
0037 case cms::DDSolidShape::ddtrap:
0038 return buildTrap(par);
0039 break;
0040 case cms::DDSolidShape::ddtubs:
0041 case cms::DDSolidShape::ddpolycone:
0042 case cms::DDSolidShape::ddsubtraction:
0043 return buildOpen();
0044 break;
0045 default:
0046 std::cout << "Wrong DDshape to build...." << cms::dd::name(cms::DDSolidShapeMap, shape) << std::endl;
0047 Bounds* bounds = nullptr;
0048 return bounds;
0049 }
0050 }
0051
0052 Bounds* TrackerShapeToBounds::buildBox(const std::vector<double>& paras) const {
0053 int indexX = 0;
0054 int indexY = 1;
0055 int indexZ = 2;
0056 Bounds* bounds = nullptr;
0057
0058 if (paras[1] < paras[0] && paras[0] < paras[2]) {
0059 indexX = 0;
0060 indexY = 2;
0061 indexZ = 1;
0062 }
0063
0064 bounds = new RectangularPlaneBounds(paras[indexX] / cm,
0065 paras[indexY] / cm,
0066 paras[indexZ] / cm);
0067 return bounds;
0068 }
0069
0070 Bounds* TrackerShapeToBounds::buildTrap(const std::vector<double>& paras) const {
0071 Bounds* bounds = nullptr;
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097 if (paras[0] < 5) {
0098 bounds = new TrapezoidalPlaneBounds(paras[4] / cm, paras[9] / cm, paras[3] / cm, paras[0] / cm);
0099 } else if (paras[0] > paras[3]) {
0100 bounds = new TrapezoidalPlaneBounds(paras[4] / cm, paras[9] / cm, paras[0] / cm, paras[3] / cm);
0101 }
0102 return bounds;
0103 }
0104
0105 Bounds* TrackerShapeToBounds::buildOpen() const {
0106 OpenBounds* bounds = new OpenBounds();
0107 return bounds;
0108 }