Geometry
TrackerNumberingBuilder
src
TrackerShapeToBounds.cc
Go to the documentation of this file.
1
#include "
Geometry/TrackerNumberingBuilder/interface/TrackerShapeToBounds.h
"
2
#include "
DataFormats/GeometrySurface/interface/OpenBounds.h
"
3
#include "
DataFormats/GeometrySurface/interface/RectangularPlaneBounds.h
"
4
#include "
DataFormats/GeometrySurface/interface/TrapezoidalPlaneBounds.h
"
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
cms::DDSolidShape
& shape,
const
std::vector<double>& par)
const
{
33
switch
(shape) {
34
case
cms::DDSolidShape::ddbox
:
35
return
buildBox
(par);
36
break
;
37
case
cms::DDSolidShape::ddtrap
:
38
return
buildTrap
(par);
39
break
;
40
case
cms::DDSolidShape::ddtubs
:
41
case
cms::DDSolidShape::ddpolycone
:
42
case
cms::DDSolidShape::ddsubtraction
:
43
return
buildOpen
();
44
break
;
45
default
:
46
std::cout
<<
"Wrong DDshape to build...."
<<
cms::dd::name
(
cms::DDSolidShapeMap
, shape) << std::endl;
47
Bounds
* bounds =
nullptr
;
48
return
bounds;
49
}
50
}
51
52
Bounds
*
TrackerShapeToBounds::buildBox
(
const
std::vector<double>& paras)
const
{
53
int
indexX = 0;
54
int
indexY = 1;
55
int
indexZ = 2;
56
Bounds
* bounds =
nullptr
;
57
58
if
(paras[1] < paras[0] && paras[0] < paras[2]) {
59
indexX = 0;
60
indexY = 2;
61
indexZ = 1;
62
}
63
64
bounds =
new
RectangularPlaneBounds
(paras[indexX] / cm,
// width - shorter side
65
paras[indexY] / cm,
// length - longer side
66
paras[indexZ] / cm);
// thickness
67
return
bounds;
68
}
69
70
Bounds
*
TrackerShapeToBounds::buildTrap
(
const
std::vector<double>& paras)
const
{
71
Bounds
* bounds =
nullptr
;
72
/*
73
TrapezoidalPlaneBounds (float be, float te, float a, float t)
74
constructed from:
75
half bottom edge (smaller side width)
76
half top edge (larger side width)
77
half apothem (distance from top to bottom sides, measured perpendicularly to them)
78
half thickness.
79
80
if we have indexX=0, indexY=1 and indeZ=2
81
4 = be (ORCA x)
82
9 = te (ORCA x)
83
0 = a (ORCA y)
84
3 = t (ORCA z)
85
86
if we have indexX=0, indexY=2 and indeZ=1
87
4 = be (ORCA x)
88
9 = te (ORCA x)
89
3 = a (ORCA y)
90
0 = t (ORCA z)
91
92
so, so we have the indexes:
93
if indexX==0, indexY==1, indexZ==2, then everything is ok and
94
the following orcaCorrection-rotation will be a unit-matrix.
95
*/
96
97
if
(paras[0] < 5) {
98
bounds =
new
TrapezoidalPlaneBounds
(paras[4] / cm, paras[9] / cm, paras[3] / cm, paras[0] / cm);
99
}
else
if
(paras[0] > paras[3]) {
100
bounds =
new
TrapezoidalPlaneBounds
(paras[4] / cm, paras[9] / cm, paras[0] / cm, paras[3] / cm);
101
}
102
return
bounds;
103
}
104
105
Bounds
*
TrackerShapeToBounds::buildOpen
()
const
{
106
OpenBounds
* bounds =
new
OpenBounds
();
107
return
bounds;
108
}
OpenBounds.h
cms::DDSolidShape::ddtubs
TrackerShapeToBounds::buildBox
Bounds * buildBox(const std::vector< double > &) const
Definition:
TrackerShapeToBounds.cc:52
gather_cfg.cout
cout
Definition:
gather_cfg.py:144
Bounds
Definition:
Bounds.h:18
cms::dd::name
std::string name(Mapping a, V value)
Definition:
DDSolidShapes.h:31
TrapezoidalPlaneBounds.h
RectangularPlaneBounds.h
TrackerShapeToBounds::buildOpen
Bounds * buildOpen() const
Definition:
TrackerShapeToBounds.cc:105
cms::DDSolidShape
DDSolidShape
Definition:
DDSolidShapes.h:73
cms::DDSolidShape::ddpolycone
cms::DDSolidShape::ddtrap
cms::DDSolidShape::ddbox
TrapezoidalPlaneBounds
Definition:
TrapezoidalPlaneBounds.h:15
RectangularPlaneBounds
Definition:
RectangularPlaneBounds.h:12
OpenBounds
Unlimited (trivial) bounds.
Definition:
OpenBounds.h:9
TrackerShapeToBounds.h
cms::DDSolidShape::ddsubtraction
TrackerShapeToBounds::buildTrap
Bounds * buildTrap(const std::vector< double > &) const
Definition:
TrackerShapeToBounds.cc:70
cms::DDSolidShapeMap
const std::array< const cms::dd::NameValuePair< DDSolidShape >, 21 > DDSolidShapeMap
Definition:
DDSolidShapes.h:99
TrackerShapeToBounds::buildBounds
Bounds * buildBounds(const cms::DDSolidShape &, const std::vector< double > &) const
Definition:
TrackerShapeToBounds.cc:32
Generated for CMSSW Reference Manual by
1.8.16