CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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){
34  case ddbox: return buildBox(_par);
35  break;
36  case ddtrap: return buildTrap(_par);
37  break;
38  case ddtubs: return buildOpen(_par);
39  break;
40  case ddpolycone_rrz: return buildOpen(_par);
41  break;
42  case ddsubtraction: return buildOpen(_par);
43  break;
44  default:
45  std::cout<<"Wrong DDshape to build...."<<_shape<<std::endl;
46  Bounds* bounds = 0;
47  return bounds;
48  }
49 }
50 
51 Bounds * TrackerShapeToBounds::buildBox(const std::vector<double>& paras ) const{
52  int indexX = 0;
53  int indexY = 1;
54  int indexZ = 2;
55  Bounds* bounds = 0;
56 
57  if(paras[1]<paras[0]&&paras[0]<paras[2]){
58  indexX=0;
59  indexY=2;
60  indexZ=1;
61  }
62 
63  bounds = new RectangularPlaneBounds(paras[indexX]/cm, // width - shorter side
64  paras[indexY]/cm, // length - longer side
65  paras[indexZ]/cm);// thickness
66  return bounds;
67 }
68 
69 Bounds * TrackerShapeToBounds::buildTrap(const std::vector<double>& paras ) const{
70 
71 
72  Bounds* bounds = 0;
73  /*
74  TrapezoidalPlaneBounds (float be, float te, float a, float t)
75  constructed from:
76  half bottom edge (smaller side width)
77  half top edge (larger side width)
78  half apothem (distance from top to bottom sides, measured perpendicularly to them)
79  half thickness.
80 
81  if we have indexX=0, indexY=1 and indeZ=2
82  4 = be (ORCA x)
83  9 = te (ORCA x)
84  0 = a (ORCA y)
85  3 = t (ORCA z)
86 
87  if we have indexX=0, indexY=2 and indeZ=1
88  4 = be (ORCA x)
89  9 = te (ORCA x)
90  3 = a (ORCA y)
91  0 = t (ORCA z)
92 
93  so, so we have the indexes:
94  if indexX==0, indexY==1, indexZ==2, then everything is ok and
95  the following orcaCorrection-rotation will be a unit-matrix.
96  */
97 
98 
99  if(paras[0]<5){
100  bounds = new TrapezoidalPlaneBounds(paras[4]/cm,
101  paras[9]/cm,
102  paras[3]/cm,
103  paras[0]/cm);
104  }else if(paras[0]>paras[3]){
105  bounds = new TrapezoidalPlaneBounds(paras[4]/cm,
106  paras[9]/cm,
107  paras[0]/cm,
108  paras[3]/cm);
109  }
110  return bounds;
111 }
112 
113 
114 Bounds * TrackerShapeToBounds::buildOpen(const std::vector<double>& paras ) const{
115  OpenBounds* bounds = new OpenBounds();
116  return bounds;
117 }
DDSolidShape
Definition: DDSolidShapes.h:6
Bounds * buildTrap(const std::vector< double > &) const
Bounds * buildBounds(const DDSolidShape &, const std::vector< double > &) const
Bounds * buildOpen(const std::vector< double > &) const
Bounds * buildBox(const std::vector< double > &) const
Unlimited (trivial) bounds.
Definition: OpenBounds.h:10
tuple cout
Definition: gather_cfg.py:121
Definition: Bounds.h:18