CMS 3D CMS Logo

DTGeometryBuilderFromCondDB.cc
Go to the documentation of this file.
1 /******* \class DTGeometryBuilderFromCondDB *******
2  *
3  * Description:
4  *
5  * detailed description
6  *
7  * \author : Stefano Lacaprara - INFN LNL <stefano.lacaprara@pd.infn.it>
8  *
9  * Modification:
10  *
11  *********************************/
12 
13 /* This Class Header */
15 
16 /* Collaborating Class Header */
24 
25 /* C++ Headers */
26 #include <iostream>
27 using namespace std;
28 
29 using namespace geant_units;
30 using namespace geant_units::operators;
31 
32 /* ====================================================================== */
33 
34 /* Constructor */
36 
37 /* Destructor */
39 
40 /* Operations */
41 void DTGeometryBuilderFromCondDB::build(const std::shared_ptr<DTGeometry>& theGeometry, const RecoIdealGeometry& rig) {
42  // cout << "DTGeometryBuilderFromCondDB " << endl;
43  const std::vector<DetId>& detids(rig.detIds());
44  // cout << "size " << detids.size() << endl;
45 
46  size_t idt = 0;
47  DTChamber* chamber(nullptr);
48  DTSuperLayer* sl(nullptr);
49  while (idt < detids.size()) {
50  //copy(par.begin(), par.end(), ostream_iterator<double>(std::cout," "));
51  if (int(*(rig.shapeStart(idt))) == 0) { // a Chamber
52  // add the provious chamber which by now has been updated with SL and
53  // layers
54  if (chamber)
55  theGeometry->add(chamber);
56  // go for the actual one
57  DTChamberId chid(detids[idt]);
58  //cout << "CH: " << chid << endl;
59  chamber = buildChamber(chid, rig, idt);
60  } else if (int(*(rig.shapeStart(idt))) == 1) { // a SL
61  DTSuperLayerId slid(detids[idt]);
62  //cout << " SL: " << slid << endl;
63  sl = buildSuperLayer(chamber, slid, rig, idt);
64  theGeometry->add(sl);
65  } else if (int(*(rig.shapeStart(idt))) == 2) { // a Layer
66  DTLayerId lid(detids[idt]);
67  //cout << " LAY: " << lid << endl;
68  DTLayer* lay = buildLayer(sl, lid, rig, idt);
69  theGeometry->add(lay);
70  } else {
71  cout << "What is this?" << endl;
72  }
73  ++idt;
74  }
75  if (chamber)
76  theGeometry->add(chamber); // add the last chamber
77 }
78 
79 // Calling function has the responsibility to delete the allocated RectangularPlaneBounds object
80 RectangularPlaneBounds* dtGeometryBuilder::getRecPlaneBounds(const std::vector<double>::const_iterator& shapeStart) {
81  float width = convertMmToCm(*(shapeStart)); // r-phi dimension - different in different chambers
82  float length = convertMmToCm(*(shapeStart + 1)); // z dimension - constant
83  float thickness = convertMmToCm(*(shapeStart + 2)); // radial thickness - almost constant
84  return new RectangularPlaneBounds(width, length, thickness);
85 }
86 
88  DTChamberId detId(id);
89 
91  // width is along local X
92  // length is along local Y
93  // length z dimension - constant 125.55 cm
94  // thickness is along local Z
95  // radial thickness - almost constant about 18 cm
96  RCPPlane surf(
97  plane(rig.tranStart(idt), rig.rotStart(idt), dtGeometryBuilder::getRecPlaneBounds(++rig.shapeStart(idt))));
98 
99  DTChamber* chamber = new DTChamber(detId, surf);
100 
101  return chamber;
102 }
103 
105  const DetId& id,
106  const RecoIdealGeometry& rig,
107  size_t idt) const {
108  DTSuperLayerId slId(id);
109 
110  // r-phi dimension - different in different chambers
111  // z dimension - constant 126.8 cm
112  // radial thickness - almost constant about 5 cm
113 
114  // Ok this is the slayer position...
115  RCPPlane surf(
116  plane(rig.tranStart(idt), rig.rotStart(idt), dtGeometryBuilder::getRecPlaneBounds(++rig.shapeStart(idt))));
117 
118  DTSuperLayer* slayer = new DTSuperLayer(slId, surf, chamber);
119 
120  // cout << "adding slayer " << slayer->id() << " to chamber "<< chamber->id() << endl;
121  assert(chamber);
122  chamber->add(slayer);
123  return slayer;
124 }
125 
127  const DetId& id,
128  const RecoIdealGeometry& rig,
129  size_t idt) const {
130  DTLayerId layId(id);
131 
132  // Layer specific parameter (size)
133  // r-phi dimension - different in different chambers
134  // z dimension - constant 126.8 cm
135  // radial thickness - almost constant about 20 cm
136 
137  auto shapeStartPtr = rig.shapeStart(idt);
138  RCPPlane surf(
139  plane(rig.tranStart(idt), rig.rotStart(idt), dtGeometryBuilder::getRecPlaneBounds((shapeStartPtr + 1))));
140 
141  // Loop on wires
142  int firstWire = static_cast<int>(*(shapeStartPtr + 4)); //par[4]);
143  int WCounter = static_cast<int>(*(shapeStartPtr + 5)); //par[5]);
144  double sensibleLength = convertMmToCm(*(shapeStartPtr + 6)); //par[6] in cm;
145  DTTopology topology(firstWire, WCounter, sensibleLength);
146 
147  DTLayerType layerType;
148 
149  DTLayer* layer = new DTLayer(layId, surf, topology, layerType, sl);
150  // cout << "adding layer " << layer->id() << " to sl "<< sl->id() << endl;
151 
152  assert(sl);
153  sl->add(layer);
154  return layer;
155 }
156 
157 DTGeometryBuilderFromCondDB::RCPPlane DTGeometryBuilderFromCondDB::plane(const vector<double>::const_iterator tranStart,
158  const vector<double>::const_iterator rotStart,
159  Bounds* bounds) const {
160  // extract the position
161  const Surface::PositionType posResult(*(tranStart), *(tranStart + 1), *(tranStart + 2));
162  // now the rotation
163  Surface::RotationType rotResult(*(rotStart + 0),
164  *(rotStart + 1),
165  *(rotStart + 2),
166  *(rotStart + 3),
167  *(rotStart + 4),
168  *(rotStart + 5),
169  *(rotStart + 6),
170  *(rotStart + 7),
171  *(rotStart + 8));
172 
173  return RCPPlane(new Plane(posResult, rotResult, bounds));
174 }
TkRotation< float >
DTSuperLayerId
Definition: DTSuperLayerId.h:12
ApeEstimator_cff.width
width
Definition: ApeEstimator_cff.py:24
DTGeometryBuilderFromCondDB::buildSuperLayer
DTSuperLayer * buildSuperLayer(DTChamber *chamber, const DetId &id, const RecoIdealGeometry &rig, size_t idt) const
Definition: DTGeometryBuilderFromCondDB.cc:104
MessageLogger.h
DTGeometryBuilderFromCondDB::buildChamber
DTChamber * buildChamber(const DetId &id, const RecoIdealGeometry &rig, size_t idt) const
Definition: DTGeometryBuilderFromCondDB.cc:87
dtGeometryBuilder::getRecPlaneBounds
RectangularPlaneBounds * getRecPlaneBounds(const std::vector< double >::const_iterator &shapeStart)
Definition: DTGeometryBuilderFromCondDB.cc:80
DTLayerId.h
gather_cfg.cout
cout
Definition: gather_cfg.py:144
DTChamber
Definition: DTChamber.h:24
Bounds
Definition: Bounds.h:18
cms::cuda::assert
assert(be >=bs)
ReferenceCountingPointer< Plane >
DTSuperLayer
Definition: DTSuperLayer.h:24
geant_units::operators
Definition: GeantUnits.h:18
DTGeometryBuilderFromCondDB.h
DTTopology
Definition: DTTopology.h:28
DetId
Definition: DetId.h:17
RecoIdealGeometry::rotStart
std::vector< double >::const_iterator rotStart(size_t ind) const
Definition: RecoIdealGeometry.h:91
DTGeometryBuilderFromCondDB::plane
RCPPlane plane(const std::vector< double >::const_iterator tranStart, const std::vector< double >::const_iterator rotStart, Bounds *bounds) const
Definition: DTGeometryBuilderFromCondDB.cc:157
Calorimetry_cff.thickness
thickness
Definition: Calorimetry_cff.py:115
Point3DBase< float, GlobalTag >
DTChamberId.h
DTLayerId
Definition: DTLayerId.h:12
RecoIdealGeometry.h
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
DTSuperLayer::add
void add(DTLayer *l)
Add layer to the SL which owns it.
Definition: DTSuperLayer.cc:47
DTGeometry.h
DTGeometryBuilderFromCondDB::buildLayer
DTLayer * buildLayer(DTSuperLayer *sl, const DetId &id, const RecoIdealGeometry &rig, size_t idt) const
Definition: DTGeometryBuilderFromCondDB.cc:126
DTGeometryBuilderFromCondDB::~DTGeometryBuilderFromCondDB
virtual ~DTGeometryBuilderFromCondDB()
Definition: DTGeometryBuilderFromCondDB.cc:38
GeantUnits.h
RecoIdealGeometry::detIds
const std::vector< DetId > & detIds() const
Definition: RecoIdealGeometry.h:85
DTGeometryBuilderFromCondDB::build
void build(const std::shared_ptr< DTGeometry > &theGeometry, const RecoIdealGeometry &rig)
Definition: DTGeometryBuilderFromCondDB.cc:41
RecoIdealGeometry::tranStart
std::vector< double >::const_iterator tranStart(size_t ind) const
Definition: RecoIdealGeometry.h:87
DTLayer
Definition: DTLayer.h:25
DTGeometryBuilderFromCondDB::DTGeometryBuilderFromCondDB
DTGeometryBuilderFromCondDB()
Definition: DTGeometryBuilderFromCondDB.cc:35
std
Definition: JetResolutionObject.h:76
RectangularPlaneBounds
Definition: RectangularPlaneBounds.h:12
DTLayerType
Definition: DTLayerType.h:15
RecoIdealGeometry::shapeStart
std::vector< double >::const_iterator shapeStart(size_t ind) const
Definition: RecoIdealGeometry.h:95
Plane
Definition: Plane.h:16
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
geant_units::operators::convertMmToCm
constexpr NumType convertMmToCm(NumType millimeters)
Definition: GeantUnits.h:63
geant_units
Definition: GeantUnits.h:11
DTChamberId
Definition: DTChamberId.h:14
DTSuperLayerId.h
RecoIdealGeometry
Definition: RecoIdealGeometry.h:28