CMS 3D CMS Logo

ME0GeometryBuilderFromCondDB.cc
Go to the documentation of this file.
1 
8 
12 
16 
19 
21 
22 #include "CLHEP/Units/GlobalSystemOfUnits.h"
23 
24 #include <iostream>
25 #include <algorithm>
26 
28 { }
29 
31 { }
32 
34 {
35  const std::vector<DetId>& detids(rgeo.detIds());
37 
39  std::vector<double>::const_iterator tranStart;
40  std::vector<double>::const_iterator shapeStart;
41  std::vector<double>::const_iterator rotStart;
42  std::vector<std::string>::const_iterator strStart;
43 
44  for (unsigned int id = 0; id < detids.size(); ++id)
45  {
46  ME0DetId me0id( detids[id]);
47 
48  tranStart = rgeo.tranStart(id);
49  shapeStart = rgeo.shapeStart(id);
50  rotStart = rgeo.rotStart(id);
51  strStart = rgeo.strStart(id);
52  name = *(strStart);
53 
54  Surface::PositionType pos(*(tranStart)/cm,*(tranStart+1)/cm, *(tranStart+2)/cm);
55  // CLHEP way
56  Surface::RotationType rot(*(rotStart+0), *(rotStart+1), *(rotStart+2),
57  *(rotStart+3), *(rotStart+4), *(rotStart+5),
58  *(rotStart+6), *(rotStart+7), *(rotStart+8));
59 
60  Bounds* bounds = nullptr;
61  float be = *(shapeStart+0)/cm;
62  float te = *(shapeStart+1)/cm;
63  float ap = *(shapeStart+2)/cm;
64  float ti = *(shapeStart+3)/cm;
65  float nstrip = *(shapeStart+4);
66  float npad = *(shapeStart+5);
67  // TrapezoidalPlaneBounds*
68  bounds = new TrapezoidalPlaneBounds(be, te, ap, ti);
69 
70  std::vector<float> pars;
71  pars.emplace_back(be); //b/2;
72  pars.emplace_back(te); //B/2;
73  pars.emplace_back(ap); //h/2;
74  pars.emplace_back(nstrip);
75  pars.emplace_back(npad);
76 
78 
79  //Change of axes for the forward
80  Basic3DVector<float> newX(1.,0.,0.);
81  Basic3DVector<float> newY(0.,0.,1.);
82  // if (tran[2] > 0. )
83  newY *= -1;
84  Basic3DVector<float> newZ(0.,1.,0.);
85  rot.rotateAxes (newX, newY, newZ);
86 
87  BoundPlane* bp = new BoundPlane(pos, rot, bounds);
89  ME0EtaPartition* mep=new ME0EtaPartition(me0id, surf, e_p_specs);
90  geometry->add(mep);
91  }
92  return geometry;
93 }
94 
95 
96 
Plane BoundPlane
Definition: Plane.h:95
std::vector< double >::const_iterator rotStart(size_t ind) const
TkRotation & rotateAxes(const Basic3DVector< T > &newX, const Basic3DVector< T > &newY, const Basic3DVector< T > &newZ)
std::vector< std::string >::const_iterator strStart(size_t ind) const
std::vector< double >::const_iterator tranStart(size_t ind) const
const std::vector< DetId > & detIds() const
ME0Geometry * build(const RecoIdealGeometry &rgeo)
ESHandle< TrackerGeometry > geometry
std::vector< double >::const_iterator shapeStart(size_t ind) const
Definition: Bounds.h:22