CMS 3D CMS Logo

TrackerShapeToBounds.cc
Go to the documentation of this file.
5 #include "CLHEP/Units/GlobalSystemOfUnits.h"
6 #include <algorithm>
7 #include <iostream>
8 //#define DEBUG
9 
10 /* find out about the rotations of the detectors:
11 
12  (the code should also find out about other detector-types (pixes-fw, ...)
13  currently not implemented, of course)
14 
15  - for pixel-barrels:
16  detectors are modelled by boxes, ORCA convention for the local frame:
17  . the thickness is in global r-direction of global-CMS
18  . the longer side if in z-direction of global-CMS
19  . the shorter side is in phi-direction of global-CMS
20  ORCA convention of the local-frame:
21  . the local z-axis is defined to be in direction of the thickness of the box
22  . the local y-axis is defined to be in direction of the longer side of the box
23  . the local x-axis is thus in direction of the shorter side of the box
24 
25  1. So first look how the detector box is defined in DDD (which axis direction
26  is the thickness, which axis-direction is the shorter side,...)
27  2. Define a rotation which reorientates the box to Orca-conventions
28  in the local frame, if necessary
29  3. combine the global rotation from DDD with the rotation defined in 2.
30  */
31 
32 Bounds* TrackerShapeToBounds::buildBounds(const DDSolidShape& _shape, const std::vector<double>& _par) const {
33  switch (_shape) {
35  return buildBox(_par);
36  break;
38  return buildTrap(_par);
39  break;
41  return buildOpen(_par);
42  break;
44  return buildOpen(_par);
45  break;
47  return buildOpen(_par);
48  break;
49  default:
50  std::cout << "Wrong DDshape to build...." << DDSolidShapesName::name(_shape) << std::endl;
51  Bounds* bounds = nullptr;
52  return bounds;
53  }
54 }
55 
56 Bounds* TrackerShapeToBounds::buildBox(const std::vector<double>& paras) const {
57  int indexX = 0;
58  int indexY = 1;
59  int indexZ = 2;
60  Bounds* bounds = nullptr;
61 
62  if (paras[1] < paras[0] && paras[0] < paras[2]) {
63  indexX = 0;
64  indexY = 2;
65  indexZ = 1;
66  }
67 
68  bounds = new RectangularPlaneBounds(paras[indexX] / cm, // width - shorter side
69  paras[indexY] / cm, // length - longer side
70  paras[indexZ] / cm); // thickness
71  return bounds;
72 }
73 
74 Bounds* TrackerShapeToBounds::buildTrap(const std::vector<double>& paras) const {
75  Bounds* bounds = nullptr;
76  /*
77  TrapezoidalPlaneBounds (float be, float te, float a, float t)
78  constructed from:
79  half bottom edge (smaller side width)
80  half top edge (larger side width)
81  half apothem (distance from top to bottom sides, measured perpendicularly to them)
82  half thickness.
83 
84  if we have indexX=0, indexY=1 and indeZ=2
85  4 = be (ORCA x)
86  9 = te (ORCA x)
87  0 = a (ORCA y)
88  3 = t (ORCA z)
89 
90  if we have indexX=0, indexY=2 and indeZ=1
91  4 = be (ORCA x)
92  9 = te (ORCA x)
93  3 = a (ORCA y)
94  0 = t (ORCA z)
95 
96  so, so we have the indexes:
97  if indexX==0, indexY==1, indexZ==2, then everything is ok and
98  the following orcaCorrection-rotation will be a unit-matrix.
99  */
100 
101  if (paras[0] < 5) {
102  bounds = new TrapezoidalPlaneBounds(paras[4] / cm, paras[9] / cm, paras[3] / cm, paras[0] / cm);
103  } else if (paras[0] > paras[3]) {
104  bounds = new TrapezoidalPlaneBounds(paras[4] / cm, paras[9] / cm, paras[0] / cm, paras[3] / cm);
105  }
106  return bounds;
107 }
108 
109 Bounds* TrackerShapeToBounds::buildOpen(const std::vector<double>& paras) const {
110  OpenBounds* bounds = new OpenBounds();
111  return bounds;
112 }
Bounds * buildTrap(const std::vector< double > &) const
Bounds * buildBounds(const DDSolidShape &, const std::vector< double > &) const
static const char *const name(DDSolidShape s)
Definition: DDSolidShapes.h:32
Bounds * buildOpen(const std::vector< double > &) const
DDSolidShape
Definition: DDSolidShapes.h:6
Bounds * buildBox(const std::vector< double > &) const
Unlimited (trivial) bounds.
Definition: OpenBounds.h:9
Definition: Bounds.h:20